llvm.org GIT mirror llvm / 78268b9
Remember if LR register has been spilled in this function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33632 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 13 years ago
2 changed file(s) with 17 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
3535 /// processFunctionBeforeCalleeSavedScan().
3636 bool HasStackFrame;
3737
38 /// LRSpilled - True if the LR register has been spilled.
39 ///
40 bool LRSpilled;
41
3842 /// FramePtrSpillOffset - If HasStackFrame, this records the frame pointer
3943 /// spill stack offset.
4044 unsigned FramePtrSpillOffset;
7074 public:
7175 ARMFunctionInfo() :
7276 isThumb(false),
73 VarArgsRegSaveSize(0), HasStackFrame(false), FramePtrSpillOffset(0),
74 GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
77 VarArgsRegSaveSize(0), HasStackFrame(false), LRSpilled(false),
78 FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
7579 GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), JumpTableUId(0) {}
7680
7781 ARMFunctionInfo(MachineFunction &MF) :
7882 isThumb(MF.getTarget().getSubtarget().isThumb()),
79 VarArgsRegSaveSize(0), HasStackFrame(false), FramePtrSpillOffset(0),
80 GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
83 VarArgsRegSaveSize(0), HasStackFrame(false), LRSpilled(false),
84 FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
8185 GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), JumpTableUId(0) {}
8286
8387 bool isThumbFunction() const { return isThumb; }
8791
8892 bool hasStackFrame() const { return HasStackFrame; }
8993 void setHasStackFrame(bool s) { HasStackFrame = s; }
94
95 bool isLRSpilled() const { return LRSpilled; }
96 void setLRIsSpilled(bool s) { LRSpilled = s; }
97
9098 unsigned getFramePtrSpillOffset() const { return FramePtrSpillOffset; }
9199 void setFramePtrSpillOffset(unsigned o) { FramePtrSpillOffset = o; }
92100
768768 }
769769 }
770770
771 ARMFunctionInfo *AFI = MF.getInfo();
771772 if (!CanEliminateFrame) {
772 ARMFunctionInfo *AFI = MF.getInfo();
773773 AFI->setHasStackFrame(true);
774774
775775 // If LR is not spilled, but at least one of R4, R5, R6, and R7 is spilled.
776776 // Spill LR as well so we can fold BX_RET to the registers restore (LDM).
777777 if (!LRSpilled && CS1Spilled) {
778 LRSpilled = true;
778779 MF.changePhyRegUsed(ARM::LR, true);
779780 NumGPRSpills++;
780781 UnspilledCS1GPRs.erase(std::find(UnspilledCS1GPRs.begin(),
797798 MF.changePhyRegUsed(UnspilledCS2GPRs.front(), true);
798799 }
799800 }
801
802 // Remembe if LR has been spilled.
803 AFI->setLRIsSpilled(LRSpilled);
800804 }
801805
802806 /// Move iterator pass the next bunch of callee save load / store ops for