[LLVMdev] [llvm]/lib/CodeGen/PrologEpilogInserter.cpp RestoreCSRegs before epilogue, why?
Daniil Troshkov
troshkovdanil at gmail.com
Thu Jul 17 06:15:26 PDT 2014
Hello all!
Does anybody know why "lib/CodeGen/PrologEpilogInserter.cpp" has code:
---------------------------
// Add the code to save and restore the callee saved registers
if (!F->hasFnAttribute(Attribute::Naked))
insertCSRSpillsAndRestores(Fn);
.....
if (!F->hasFnAttribute(Attribute::Naked))
insertPrologEpilogCode(Fn);
-----------------------------
and than we use 'hacks' like this(example for MSP430(emitEpilogue,
MSP430FrameLowering.cpp) but other archs has the same code):
----------------------------
// Skip the callee-saved pop instructions.
while (MBBI != MBB.begin()) {
MachineBasicBlock::iterator PI = prior(MBBI);
unsigned Opc = PI->getOpcode();
if (Opc != MSP430::POP16r && !PI->isTerminator())
break;
--MBBI;
}
-----------------------------
Why we don't use directly:
insertCSRSpiil
insertProlog
insertEpilog
InsertCSRRestore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140717/d0e2b1a2/attachment.html>
More information about the llvm-dev
mailing list