diff options
author | Akira Hatanaka <ahatanak@gmail.com> | 2011-05-20 01:17:58 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanak@gmail.com> | 2011-05-20 01:17:58 +0000 |
commit | da0a3571d635ca2b6f58929217995c1700200485 (patch) | |
tree | 76811ca8a91c7f76178ab512d254602d0bccc863 /lib/Target/Mips/MipsMachineFunction.h | |
parent | a166089f36cf17cd3733c98000bbe2428011503b (diff) | |
download | external_llvm-da0a3571d635ca2b6f58929217995c1700200485.zip external_llvm-da0a3571d635ca2b6f58929217995c1700200485.tar.gz external_llvm-da0a3571d635ca2b6f58929217995c1700200485.tar.bz2 |
Define variables and functions in MipsFunctionInfo.
This is the first of a series of patches that attempt to simplify handling of
stack frame objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsMachineFunction.h')
-rw-r--r-- | lib/Target/Mips/MipsMachineFunction.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/Target/Mips/MipsMachineFunction.h b/lib/Target/Mips/MipsMachineFunction.h index 1e8e4fe..bbb14a5 100644 --- a/lib/Target/Mips/MipsMachineFunction.h +++ b/lib/Target/Mips/MipsMachineFunction.h @@ -14,6 +14,7 @@ #ifndef MIPS_MACHINE_FUNCTION_INFO_H #define MIPS_MACHINE_FUNCTION_INFO_H +#include <utility> #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/VectorExtras.h" #include "llvm/CodeGen/MachineFunction.h" @@ -83,12 +84,21 @@ private: /// VarArgsFrameIndex - FrameIndex for start of varargs area. int VarArgsFrameIndex; + // Range of frame object indices. + // InArgFIRange: Range of indices of all frame objects created during call to + // LowerFormalArguments. + // 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 GPFI; // Index of the frame object for restoring $gp + bool HasCall; // True if function has a function call. public: MipsFunctionInfo(MachineFunction& MF) : FPStackOffset(0), RAStackOffset(0), CPUTopSavedRegOff(0), FPUTopSavedRegOff(0), GPHolder(-1,-1), HasLoadArgs(false), HasStoreVarArgs(false), SRetReturnReg(0), GlobalBaseReg(0), - VarArgsFrameIndex(0) + VarArgsFrameIndex(0), InArgFIRange(std::make_pair(-1, 0)), + OutArgFIRange(std::make_pair(-1, 0)), GPFI(0), HasCall(false) {} int getFPStackOffset() const { return FPStackOffset; } @@ -103,11 +113,27 @@ public: int getFPUTopSavedRegOff() const { return FPUTopSavedRegOff; } void setFPUTopSavedRegOff(int Off) { FPUTopSavedRegOff = Off; } + bool isInArgFI(int FI) const { + return FI <= InArgFIRange.first && FI >= InArgFIRange.second; + } + void setLastInArgFI(int FI) { InArgFIRange.second = FI; } + + bool isOutArgFI(int FI) const { + return FI <= OutArgFIRange.first && FI >= OutArgFIRange.second; + } + void extendOutArgFIRange(int FirstFI, int LastFI) { + if (!OutArgFIRange.second) + // this must be the first time this function was called. + OutArgFIRange.first = FirstFI; + OutArgFIRange.second = LastFI; + } + int getGPStackOffset() const { return GPHolder.SPOffset; } int getGPFI() const { return GPHolder.FI; } void setGPStackOffset(int Off) { GPHolder.SPOffset = Off; } void setGPFI(int FI) { GPHolder.FI = FI; } bool needGPSaveRestore() const { return GPHolder.SPOffset != -1; } + bool isGPFI(int FI) const { return GPFI && GPFI == FI; } bool hasLoadArgs() const { return HasLoadArgs; } bool hasStoreVarArgs() const { return HasStoreVarArgs; } @@ -140,6 +166,9 @@ public: int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } + + bool hasCall() const { return HasCall; }; + void setHasCall() { HasCall = true; } }; } // end of namespace llvm |