diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-07-09 06:53:48 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-07-09 06:53:48 +0000 |
commit | 910139f9ca53fc20a680d51ae61bb1e072095141 (patch) | |
tree | e81c343258b9cd4068b9008f1820962721174b85 /lib/CodeGen/PrologEpilogInserter.cpp | |
parent | 1945b7b5c5da39b89c2a2d3083d02e2aabf3cf98 (diff) | |
download | external_llvm-910139f9ca53fc20a680d51ae61bb1e072095141.zip external_llvm-910139f9ca53fc20a680d51ae61bb1e072095141.tar.gz external_llvm-910139f9ca53fc20a680d51ae61bb1e072095141.tar.bz2 |
Targets sometimes assign fixed stack object to spill certain callee-saved
registers based on dynamic conditions. For example, X86 EBP/RBP, when used as
frame register has to be spilled in the first fixed object. It should inform
PEI this so it doesn't get allocated another stack object. Also, it should not
be spilled as other callee-saved registers but rather its spilling and restoring
are being handled by emitPrologue and emitEpilogue. Avoid spilling it twice.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75116 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r-- | lib/CodeGen/PrologEpilogInserter.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index 6582fd8..2365316 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -210,6 +210,12 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) { unsigned Reg = I->getReg(); const TargetRegisterClass *RC = I->getRegClass(); + int FrameIdx; + if (RegInfo->hasReservedSpillSlot(Fn, Reg, FrameIdx)) { + I->setFrameIdx(FrameIdx); + continue; + } + // Check to see if this physreg must be spilled to a particular stack slot // on this target. const std::pair<unsigned,int> *FixedSlot = FixedSpillSlots; @@ -217,7 +223,6 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) { FixedSlot->first != Reg) ++FixedSlot; - int FrameIdx; if (FixedSlot == FixedSpillSlots + NumFixedSpillSlots) { // Nope, just spill it anywhere convenient. unsigned Align = RC->getAlignment(); |