diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2012-06-14 01:15:36 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-06-14 01:15:36 +0000 |
commit | a76220a40c1fcb0aa986a2ea2c129b7549e84c3e (patch) | |
tree | 6e80f21937a22c2ad1f02c406298706a5cb6062b /lib/Target/Mips/MipsMachineFunction.h | |
parent | 158413930f25ecdd0902e1cc11bb8dc3683b94f8 (diff) | |
download | llvm-a76220a40c1fcb0aa986a2ea2c129b7549e84c3e.tar.gz llvm-a76220a40c1fcb0aa986a2ea2c129b7549e84c3e.tar.bz2 llvm-a76220a40c1fcb0aa986a2ea2c129b7549e84c3e.tar.xz |
Add methods to MipsFunctionInfo for initializing and accessing the stack frame
object for the global base register.
This is the first of a series of patches which implements long branch expansion
for MIPS.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsMachineFunction.h')
-rw-r--r-- | lib/Target/Mips/MipsMachineFunction.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/Target/Mips/MipsMachineFunction.h b/lib/Target/Mips/MipsMachineFunction.h index 04cb3f22b2..b2232c6573 100644 --- a/lib/Target/Mips/MipsMachineFunction.h +++ b/lib/Target/Mips/MipsMachineFunction.h @@ -14,8 +14,11 @@ #ifndef MIPS_MACHINE_FUNCTION_INFO_H #define MIPS_MACHINE_FUNCTION_INFO_H +#include "MipsSubtarget.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/Target/TargetFrameLowering.h" +#include "llvm/Target/TargetMachine.h" #include <utility> namespace llvm { @@ -45,6 +48,7 @@ class MipsFunctionInfo : public MachineFunctionInfo { // OutArgFIRange: Range of indices of all frame objects created during call to // LowerCall except for the frame object for restoring $gp. std::pair<int, int> InArgFIRange, OutArgFIRange; + int GlobalRegFI; mutable int DynAllocFI; // Frame index of dynamically allocated stack area. unsigned MaxCallFrameSize; @@ -54,7 +58,7 @@ public: MipsFunctionInfo(MachineFunction& MF) : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), VarArgsFrameIndex(0), InArgFIRange(std::make_pair(-1, 0)), - OutArgFIRange(std::make_pair(-1, 0)), DynAllocFI(0), + OutArgFIRange(std::make_pair(-1, 0)), GlobalRegFI(0), DynAllocFI(0), MaxCallFrameSize(0), EmitNOAT(false) {} @@ -73,6 +77,24 @@ public: OutArgFIRange.second = LastFI; } + bool isGlobalRegFI(int FI) const { + return GlobalRegFI && (FI == GlobalRegFI); + } + + int getGlobalRegFI() const { + return GlobalRegFI; + } + + int initGlobalRegFI() { + const TargetMachine &TM = MF.getTarget(); + unsigned RegSize = TM.getSubtarget<MipsSubtarget>().isABI_N64() ? 8 : 4; + int64_t StackAlignment = TM.getFrameLowering()->getStackAlignment(); + uint64_t Offset = RoundUpToAlignment(MaxCallFrameSize, StackAlignment); + + GlobalRegFI = MF.getFrameInfo()->CreateFixedObject(RegSize, Offset, true); + return GlobalRegFI; + } + // The first call to this function creates a frame object for dynamically // allocated stack area. int getDynAllocFI() const { |