return static_cast<Ty*>(MFInfo);
}
+ template<typename Ty>
+ const Ty *getInfo() const {
+ return const_cast<MachineFunction*>(this)->getInfo<Ty>();
+ }
+
/// setUsedPhysRegs - The register allocator should call this to initialized
/// the UsedPhysRegs set. This should be passed a new[]'d array with entries
/// for all of the physical registers that the target supports. Each array
///
/// By default, these methods return all registers in the class.
///
- virtual iterator allocation_order_begin(MachineFunction &MF) const {
+ virtual iterator allocation_order_begin(const MachineFunction &MF) const {
return begin();
}
- virtual iterator allocation_order_end(MachineFunction &MF) const {
+ virtual iterator allocation_order_end(const MachineFunction &MF) const {
return end();
}
R7, R8, R9, R10, R11, R12,
R13, R14, R15]> {
let MethodProtos = [{
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
IntRegsClass::iterator
- IntRegsClass::allocation_order_end(MachineFunction &MF) const {
+ IntRegsClass::allocation_order_end(const MachineFunction &MF) const {
// r15 == Program Counter
// r14 == Link Register
// r13 == Stack Pointer
// pointer register. This is true if the function has variable sized allocas or
// if frame pointer elimination is disabled.
//
-static bool hasFP(MachineFunction &MF) {
+static bool hasFP(const MachineFunction &MF) {
MachineFrameInfo *MFI = MF.getFrameInfo();
return MFI->hasVarSizedObjects();
}
R15, R30, R31 ]> //zero
{
let MethodProtos = [{
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
GPRCClass::iterator
- GPRCClass::allocation_order_end(MachineFunction &MF) const {
+ GPRCClass::allocation_order_end(const MachineFunction &MF) const {
return end()-3;
}
}];
F31 ]> //zero
{
let MethodProtos = [{
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
F4RCClass::iterator
- F4RCClass::allocation_order_end(MachineFunction &MF) const {
+ F4RCClass::allocation_order_end(const MachineFunction &MF) const {
return end()-1;
}
}];
F31 ]> //zero
{
let MethodProtos = [{
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
F8RCClass::iterator
- F8RCClass::allocation_order_end(MachineFunction &MF) const {
+ F8RCClass::allocation_order_end(const MachineFunction &MF) const {
return end()-1;
}
}];
// pointer register. This is true if the function has variable sized allocas or
// if frame pointer elimination is disabled.
//
-static bool hasFP(MachineFunction &MF) {
+static bool hasFP(const MachineFunction &MF) {
return NoFramePointerElim || MF.getFrameInfo()->hasVarSizedObjects();
}
r0, r1, r2, r5, r12, r13, r22, rp]> // the last 16 are special (look down)
{
let MethodProtos = [{
- iterator allocation_order_begin(MachineFunction &MF) const;
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_begin(const MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
GRClass::iterator
- GRClass::allocation_order_begin(MachineFunction &MF) const {
+ GRClass::allocation_order_begin(const MachineFunction &MF) const {
// hide the 8 out? registers appropriately:
return begin()+(8-(MF.getInfo<IA64FunctionInfo>()->outRegsUsed));
}
GRClass::iterator
- GRClass::allocation_order_end(MachineFunction &MF) const {
+ GRClass::allocation_order_end(const MachineFunction &MF) const {
int numReservedRegs=8; // the 8 special registers r0,r1,r2,r5,r12,r13 etc
// we also can't allocate registers for use as locals if they're
let Alignment=128;
let MethodProtos = [{
- iterator allocation_order_begin(MachineFunction &MF) const;
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_begin(const MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
FPClass::iterator
- FPClass::allocation_order_begin(MachineFunction &MF) const {
+ FPClass::allocation_order_begin(const MachineFunction &MF) const {
return begin(); // we don't hide any FP regs from the start
}
FPClass::iterator
- FPClass::allocation_order_end(MachineFunction &MF) const {
+ FPClass::allocation_order_end(const MachineFunction &MF) const {
return end()-2; // we hide regs F0, F1 from the end
}
}];
R16, R15, R14, R13, R31, R0, R1, LR]>
{
let MethodProtos = [{
- iterator allocation_order_begin(MachineFunction &MF) const;
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_begin(const MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
GPRCClass::iterator
- GPRCClass::allocation_order_begin(MachineFunction &MF) const {
+ GPRCClass::allocation_order_begin(const MachineFunction &MF) const {
return begin();
}
GPRCClass::iterator
- GPRCClass::allocation_order_end(MachineFunction &MF) const {
+ GPRCClass::allocation_order_end(const MachineFunction &MF) const {
if (hasFP(MF))
return end()-4; // don't allocate R31, R0, R1, LR
else
X16, X15, X14, X13, X31, X0, X1]>
{
let MethodProtos = [{
- iterator allocation_order_begin(MachineFunction &MF) const;
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_begin(const MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
G8RCClass::iterator
- G8RCClass::allocation_order_begin(MachineFunction &MF) const {
+ G8RCClass::allocation_order_begin(const MachineFunction &MF) const {
return begin();
}
G8RCClass::iterator
- G8RCClass::allocation_order_end(MachineFunction &MF) const {
+ G8RCClass::allocation_order_end(const MachineFunction &MF) const {
if (hasFP(MF))
return end()-3;
else
G5, G6, G7 // reserved for kernel
]> {
let MethodProtos = [{
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
IntRegsClass::iterator
- IntRegsClass::allocation_order_end(MachineFunction &MF) const {
+ IntRegsClass::allocation_order_end(const MachineFunction &MF) const {
// FIXME: These special regs should be taken out of the regclass!
return end()-10 // Don't allocate special registers
-1; // FIXME: G1 reserved for large imm generation by frame code.
// pointer register. This is true if the function has variable sized allocas or
// if frame pointer elimination is disabled.
//
-static bool hasFP(MachineFunction &MF) {
+static bool hasFP(const MachineFunction &MF) {
return (NoFramePointerElim ||
MF.getFrameInfo()->hasVarSizedObjects() ||
MF.getInfo<X86FunctionInfo>()->getForceFramePointer());
def GR16 : RegisterClass<"X86", [i16], 16, [AX, CX, DX, SI, DI, BX, BP, SP]> {
let MethodProtos = [{
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
GR16Class::iterator
- GR16Class::allocation_order_end(MachineFunction &MF) const {
+ GR16Class::allocation_order_end(const MachineFunction &MF) const {
if (hasFP(MF)) // Does the function dedicate EBP to being a frame ptr?
return end()-2; // If so, don't allocate SP or BP
else
def GR32 : RegisterClass<"X86", [i32], 32,
[EAX, ECX, EDX, ESI, EDI, EBX, EBP, ESP]> {
let MethodProtos = [{
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
GR32Class::iterator
- GR32Class::allocation_order_end(MachineFunction &MF) const {
+ GR32Class::allocation_order_end(const MachineFunction &MF) const {
if (hasFP(MF)) // Does the function dedicate EBP to being a frame ptr?
return end()-2; // If so, don't allocate ESP or EBP
else
def RST : RegisterClass<"X86", [f64], 32,
[ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7]> {
let MethodProtos = [{
- iterator allocation_order_end(MachineFunction &MF) const;
+ iterator allocation_order_end(const MachineFunction &MF) const;
}];
let MethodBodies = [{
RSTClass::iterator
- RSTClass::allocation_order_end(MachineFunction &MF) const {
+ RSTClass::allocation_order_end(const MachineFunction &MF) const {
return begin();
}
}];