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 | d738c0f7c9aed9462360a1b86bfd10fc4ba53147 (patch) | |
tree | 999d5fca961fc55e12d7b5fdfaf732dafac9e525 /llvm/lib/Target/Mips/MipsMachineFunction.h | |
parent | 552f8c4819dba0970591da3c15532f76eb42aea2 (diff) | |
download | bcm5719-llvm-d738c0f7c9aed9462360a1b86bfd10fc4ba53147.tar.gz bcm5719-llvm-d738c0f7c9aed9462360a1b86bfd10fc4ba53147.zip |
Define variables and functions in MipsFunctionInfo.
This is the first of a series of patches that attempt to simplify handling of
stack frame objects.
llvm-svn: 131710
Diffstat (limited to 'llvm/lib/Target/Mips/MipsMachineFunction.h')
-rw-r--r-- | llvm/lib/Target/Mips/MipsMachineFunction.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/MipsMachineFunction.h b/llvm/lib/Target/Mips/MipsMachineFunction.h index 1e8e4feedd0..bbb14a54e19 100644 --- a/llvm/lib/Target/Mips/MipsMachineFunction.h +++ b/llvm/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 |