17 #define DEBUG_TYPE "regalloc"
30 cl::desc(
"Limit all regclasses to N registers"));
44 PSetLimits.
reset(
new unsigned[NumPSets]);
45 std::fill(&PSetLimits[0], &PSetLimits[NumPSets], 0);
51 if (Update || CSR != CalleeSaved) {
56 for (
unsigned N = 0;
unsigned Reg = CSR[
N]; ++
N)
65 if (Reserved.
size() != RR.
size() || RR != Reserved) {
79 RCInfo &RCI = RegClass[RC->
getID()];
89 unsigned MinCost = 0xff;
90 unsigned LastCost = ~0u;
91 unsigned LastCostChange = 0;
96 for (
unsigned i = 0; i != RawOrder.
size(); ++i) {
97 unsigned PhysReg = RawOrder[i];
99 if (Reserved.
test(PhysReg))
102 MinCost = std::min(MinCost, Cost);
108 if (Cost != LastCost)
110 RCI.Order[N++] = PhysReg;
114 RCI.NumRegs = N + CSRAlias.
size();
115 assert (RCI.NumRegs <= NumRegs &&
"Allocation order larger than regclass");
118 for (
unsigned i = 0, e = CSRAlias.
size(); i != e; ++i) {
119 unsigned PhysReg = CSRAlias[i];
121 if (Cost != LastCost)
123 RCI.Order[N++] = PhysReg;
134 RCI.ProperSubClass =
true;
136 RCI.MinCost = uint8_t(MinCost);
137 RCI.LastCostChange = LastCostChange;
140 dbgs() <<
"AllocationOrder(" << RC->
getName() <<
") = [";
141 for (
unsigned I = 0;
I != RCI.NumRegs; ++
I)
143 dbgs() << (RCI.ProperSubClass ?
" ] (sub-class)\n" :
" ]\n");
155 unsigned NumRCUnits = 0;
159 for (; *PSetID != -1; ++PSetID) {
160 if ((
unsigned)*PSetID == Idx)
169 if (!RC || NUnits > NumRCUnits) {
void push_back(const T &Elt)
virtual unsigned getNumRegPressureSets() const =0
Get the number of dimensions of register pressure.
virtual unsigned getRegPressureSetLimit(unsigned Idx) const =0
regclass_iterator regclass_end() const
virtual const int * getRegClassPressureSets(const TargetRegisterClass *RC) const =0
unsigned getNumAllocatableRegs(const TargetRegisterClass *RC) const
const BitVector & getReservedRegs() const
virtual const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF=0) const =0
unsigned getNumRegClasses() const
const char * getName() const
ArrayRef< MCPhysReg > getRawAllocationOrder(const MachineFunction &MF) const
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
size_t size() const
size - Get the array size.
initializer< Ty > init(const Ty &Val)
* if(!EatIfPresent(lltok::kw_thread_local)) return false
regclass_iterator regclass_begin() const
unsigned getCostPerUse(unsigned RegNo) const
void runOnMachineFunction(const MachineFunction &MF)
virtual const RegClassWeight & getRegClassWeight(const TargetRegisterClass *RC) const =0
Get the weight in units of pressure for this register class.
bool test(unsigned Idx) const
unsigned computePSetLimit(unsigned Idx) const
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
unsigned getNumRegs() const
MachineRegisterInfo & getRegInfo()
const TargetMachine & getTarget() const
virtual const TargetRegisterInfo * getRegisterInfo() const
static cl::opt< unsigned > StressRA("stress-regalloc", cl::Hidden, cl::init(0), cl::value_desc("N"), cl::desc("Limit all regclasses to N registers"))
virtual const TargetRegisterClass * getLargestLegalSuperClass(const TargetRegisterClass *RC) const
const TargetRegisterClass *const * regclass_iterator
unsigned size() const
size - Returns the number of bits in this bitvector.