<div dir="ltr">hi, list, <div style><br></div><div style>i am making a llvm compiler for shader-like programs. as we known, shader programs are short and have less function calls. i found that i have to save/restore callee-saved register(CSR) in prolog and epilog.  because I can violate ABI from driver(c code) and shader, i plan to append the attribute 'noreturn' to all shader functions. </div>
<div style><br></div><div style>in PrologEpilogInserter.cpp, you can find that it actually honor an attribute 'naked' which avoid saving CSR. however, it also skips generating stack-pointer adjustment, which i need. my patch is as follows. i am targeting RISC processor. can anyone tell me this patch is generic ? </div>
<div style><br></div><div style><div>diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp</div><div>index c791ffb..f19b47a 100644</div><div>--- a/lib/CodeGen/PrologEpilogInserter.cpp</div>
<div>+++ b/lib/CodeGen/PrologEpilogInserter.cpp</div><div>@@ -96,7 +96,7 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) {</div><div>   placeCSRSpillsAndRestores(Fn);</div><div> </div><div>   // Add the code to save and restore the callee saved registers</div>
<div>-  if (!F->hasFnAttr(Attribute::Naked))</div><div>+  if (!F->hasFnAttr(Attribute::Naked) && !F->hasFnAttr(Attribute::NoReturn)) </div><div>     insertCSRSpillsAndRestores(Fn);</div><div> </div><div>   // Allow the target machine to make final modifications to the function</div>
<div><br></div><div><br></div><div style>thanks,</div><div style>--lx</div></div></div>