<div dir="ltr">Hello all!<br>Does anybody know why "lib/CodeGen/PrologEpilogInserter.cpp" has code:<br>---------------------------<br>// Add the code to save and restore the callee saved registers<br>  if (!F->hasFnAttribute(Attribute::Naked))<br>
    insertCSRSpillsAndRestores(Fn);<br>  .....<br>  if (!F->hasFnAttribute(Attribute::Naked))<br>    insertPrologEpilogCode(Fn);<br>-----------------------------<br>and than we use 'hacks' like this(example for MSP430(emitEpilogue,<br>
MSP430FrameLowering.cpp) but other archs has the same code):<br>----------------------------<br>// Skip the callee-saved pop instructions.<br>while (MBBI != MBB.begin()) {<br>  MachineBasicBlock::iterator PI = prior(MBBI);<br>
  unsigned Opc = PI->getOpcode();<br>  if (Opc != MSP430::POP16r && !PI->isTerminator())<br>    break;<br>  --MBBI;<br>}<br>-----------------------------<br>Why we don't use directly:<br>insertCSRSpiil<br>
insertProlog<br>insertEpilog<br>InsertCSRRestore</div>