diff options
Diffstat (limited to 'lib/Target/PowerPC/PPCFrameInfo.h')
-rw-r--r-- | lib/Target/PowerPC/PPCFrameInfo.h | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/lib/Target/PowerPC/PPCFrameInfo.h b/lib/Target/PowerPC/PPCFrameInfo.h index 7587b03..c04d1f5 100644 --- a/lib/Target/PowerPC/PPCFrameInfo.h +++ b/lib/Target/PowerPC/PPCFrameInfo.h @@ -20,15 +20,28 @@ #include "llvm/ADT/STLExtras.h" namespace llvm { + class PPCSubtarget; class PPCFrameInfo: public TargetFrameInfo { - const TargetMachine &TM; + const PPCSubtarget &Subtarget; public: - PPCFrameInfo(const TargetMachine &tm, bool LP64) - : TargetFrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), TM(tm) { + PPCFrameInfo(const PPCSubtarget &sti) + : TargetFrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), Subtarget(sti) { } + void determineFrameLayout(MachineFunction &MF) const; + + /// emitProlog/emitEpilog - These methods insert prolog and epilog code into + /// the function. + void emitPrologue(MachineFunction &MF) const; + void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; + + /// targetHandlesStackFrameRounding - Returns true if the target is + /// responsible for rounding up the stack frame (probably at emitPrologue + /// time). + bool targetHandlesStackFrameRounding() const { return true; } + /// getReturnSaveOffset - Return the previous frame offset to save the /// return address. static unsigned getReturnSaveOffset(bool isPPC64, bool isDarwinABI) { @@ -48,17 +61,17 @@ public: // around that does use it, and that needs to continue to work. if (isDarwinABI) return isPPC64 ? -8U : -4U; - + // SVR4 ABI: First slot in the general register save area. return isPPC64 ? -8U : -4U; } - + /// getLinkageSize - Return the size of the PowerPC ABI linkage area. /// static unsigned getLinkageSize(bool isPPC64, bool isDarwinABI) { if (isDarwinABI || isPPC64) return 6 * (isPPC64 ? 8 : 4); - + // SVR4 ABI: return 8; } @@ -74,7 +87,7 @@ public: // least enough stack space for the caller to store the 8 GPRs. if (isDarwinABI || isPPC64) return 8 * (isPPC64 ? 8 : 4); - + // 32-bit SVR4 ABI: // There is no default stack allocated for the 8 first GPR arguments. return 0; @@ -91,9 +104,9 @@ public: // With the SVR4 ABI, callee-saved registers have fixed offsets on the stack. const SpillSlot * getCalleeSavedSpillSlots(unsigned &NumEntries) const { - if (TM.getSubtarget<PPCSubtarget>().isDarwinABI()) { + if (Subtarget.isDarwinABI()) { NumEntries = 1; - if (TM.getSubtarget<PPCSubtarget>().isPPC64()) { + if (Subtarget.isPPC64()) { static const SpillSlot darwin64Offsets = {PPC::X31, -8}; return &darwin64Offsets; } else { @@ -103,7 +116,7 @@ public: } // Early exit if not using the SVR4 ABI. - if (!TM.getSubtarget<PPCSubtarget>().isSVR4ABI()) { + if (!Subtarget.isSVR4ABI()) { NumEntries = 0; return 0; } @@ -283,7 +296,7 @@ public: {PPC::V20, -192} }; - if (TM.getSubtarget<PPCSubtarget>().isPPC64()) { + if (Subtarget.isPPC64()) { NumEntries = array_lengthof(Offsets64); return Offsets64; |