mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-05 18:49:06 +00:00
refactor some code to avoid overloading the name 'usesLR' in
different places to mean different things. Document what the one in PPCFunctionInfo means and when it is valid. llvm-svn: 44699
This commit is contained in:
parent
68527b332e
commit
1024cda0bd
@ -39,8 +39,12 @@ public:
|
|||||||
int getFramePointerSaveIndex() const { return FramePointerSaveIndex; }
|
int getFramePointerSaveIndex() const { return FramePointerSaveIndex; }
|
||||||
void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; }
|
void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; }
|
||||||
|
|
||||||
|
/// UsesLR - This is set when the prolog/epilog inserter does its initial scan
|
||||||
|
/// of the function, it is true if the LR/LR8 register is ever explicitly
|
||||||
|
/// accessed/clobbered in the machine function (e.g. by calls and movpctolr,
|
||||||
|
/// which is used in PIC generation).
|
||||||
void setUsesLR(bool U) { UsesLR = U; }
|
void setUsesLR(bool U) { UsesLR = U; }
|
||||||
bool usesLR() { return UsesLR; }
|
bool usesLR() const { return UsesLR; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -645,11 +645,13 @@ bool PPCRegisterInfo::hasFP(const MachineFunction &MF) const {
|
|||||||
return MFI->getStackSize() && needsFP(MF);
|
return MFI->getStackSize() && needsFP(MF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// usesLR - Returns if the link registers (LR) has been used in the function.
|
/// MustSaveLR - Return true if this function requires that we save the LR
|
||||||
///
|
/// register onto the stack in the prolog and restore it in the epilog of the function.
|
||||||
bool PPCRegisterInfo::usesLR(MachineFunction &MF) const {
|
static bool MustSaveLR(const MachineFunction &MF) {
|
||||||
PPCFunctionInfo *FI = MF.getInfo<PPCFunctionInfo>();
|
return MF.getInfo<PPCFunctionInfo>()->usesLR() ||
|
||||||
return FI->usesLR();
|
// FIXME: Anything that has a call should clobber the LR register,
|
||||||
|
// isn't this redundant??
|
||||||
|
MF.getFrameInfo()->hasCalls();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPCRegisterInfo::
|
void PPCRegisterInfo::
|
||||||
@ -1062,7 +1064,7 @@ void PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
|||||||
// Get operating system
|
// Get operating system
|
||||||
bool IsMachoABI = Subtarget.isMachoABI();
|
bool IsMachoABI = Subtarget.isMachoABI();
|
||||||
// Check if the link register (LR) has been used.
|
// Check if the link register (LR) has been used.
|
||||||
bool UsesLR = MFI->hasCalls() || usesLR(MF);
|
bool UsesLR = MustSaveLR(MF);
|
||||||
// Do we have a frame pointer for this function?
|
// Do we have a frame pointer for this function?
|
||||||
bool HasFP = hasFP(MF) && FrameSize;
|
bool HasFP = hasFP(MF) && FrameSize;
|
||||||
|
|
||||||
@ -1226,7 +1228,7 @@ void PPCRegisterInfo::emitEpilogue(MachineFunction &MF,
|
|||||||
// Get operating system
|
// Get operating system
|
||||||
bool IsMachoABI = Subtarget.isMachoABI();
|
bool IsMachoABI = Subtarget.isMachoABI();
|
||||||
// Check if the link register (LR) has been used.
|
// Check if the link register (LR) has been used.
|
||||||
bool UsesLR = MFI->hasCalls() || usesLR(MF);
|
bool UsesLR = MustSaveLR(MF);
|
||||||
// Do we have a frame pointer for this function?
|
// Do we have a frame pointer for this function?
|
||||||
bool HasFP = hasFP(MF) && FrameSize;
|
bool HasFP = hasFP(MF) && FrameSize;
|
||||||
|
|
||||||
|
@ -96,10 +96,6 @@ public:
|
|||||||
MachineBasicBlock &MBB,
|
MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator I) const;
|
MachineBasicBlock::iterator I) const;
|
||||||
|
|
||||||
/// usesLR - Returns if the link registers (LR) has been used in the function.
|
|
||||||
///
|
|
||||||
bool usesLR(MachineFunction &MF) const;
|
|
||||||
|
|
||||||
void lowerDynamicAlloc(MachineBasicBlock::iterator II) const;
|
void lowerDynamicAlloc(MachineBasicBlock::iterator II) const;
|
||||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||||
int SPAdj, RegScavenger *RS = NULL) const;
|
int SPAdj, RegScavenger *RS = NULL) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user