Deleted Added
sdiff udiff text old ( 12105:742d80361989 ) new ( 12106:7784fac1b159 )
full compact
1/*
2 * Copyright (c) 2011, 2016 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 38 unchanged lines hidden (view full) ---

47
48#include <vector>
49
50#include "arch/types.hh"
51#include "base/types.hh"
52#include "cpu/inst_seq.hh"
53#include "sim/faults.hh"
54
55/** Physical register index type.
56 * Although the Impl might be a better for this, but there are a few classes
57 * that need this typedef yet are not templated on the Impl.
58 */
59using PhysRegIndex = short int;
60
61/** Physical register ID.
62 * Like a register ID but physical. The inheritance is private because the
63 * only relationship between this types is functional, and it is done to
64 * prevent code replication. */
65class PhysRegId : private RegId {
66 private:
67 PhysRegIndex flatIdx;
68
69 public:
70 explicit PhysRegId() : RegId(IntRegClass, -1), flatIdx(-1) {}
71
72 /** Scalar PhysRegId constructor. */
73 explicit PhysRegId(RegClass _regClass, PhysRegIndex _regIdx,
74 PhysRegIndex _flatIdx)
75 : RegId(_regClass, _regIdx), flatIdx(_flatIdx)
76 {}
77
78 /** Visible RegId methods */
79 /** @{ */
80 using RegId::index;
81 using RegId::classValue;
82 using RegId::isZeroReg;
83 using RegId::className;
84 /** @} */
85 /**
86 * Explicit forward methods, to prevent comparisons of PhysRegId with
87 * RegIds.
88 */
89 /** @{ */
90 bool operator<(const PhysRegId& that) const {
91 return RegId::operator<(that);
92 }
93
94 bool operator==(const PhysRegId& that) const {
95 return RegId::operator==(that);
96 }
97
98 bool operator!=(const PhysRegId& that) const {
99 return RegId::operator!=(that);
100 }
101 /** @} */
102
103 /** @return true if it is an integer physical register. */
104 bool isIntPhysReg() const { return isIntReg(); }
105
106 /** @return true if it is a floating-point physical register. */
107 bool isFloatPhysReg() const { return isFloatReg(); }
108
109 /** @Return true if it is a condition-code physical register. */
110 bool isCCPhysReg() const { return isCCReg(); }
111
112 /** @Return true if it is a condition-code physical register. */
113 bool isMiscPhysReg() const { return isMiscReg(); }
114
115 /**
116 * Returns true if this register is always associated to the same
117 * architectural register.
118 */
119 bool isFixedMapping() const
120 {
121 return !isRenameable();
122 }
123
124 /** Flat index accessor */
125 const PhysRegIndex& flatIndex() const { return flatIdx; }
126};
127
128// PhysRegIds only need to be created once and then we can use the following
129// to work with them
130typedef const PhysRegId* PhysRegIdPtr;
131
132/** Struct that defines the information passed from fetch to decode. */
133template<class Impl>

--- 176 unchanged lines hidden ---