[llvm-dev] Why LR is saved before calling a 'noreturn' function ?

HEITZMANN Frédéric 218168 via llvm-dev llvm-dev at lists.llvm.org
Thu May 12 08:53:32 PDT 2016


Hi Tim,

> De : Tim Northover [mailto:t.p.northover at gmail.com]
> In your case, Clang is producing a proper frame record. r11 is set to the
> address of a struct roughly this form:
> 
> struct {
>   void *previous_r11;
>   void *return_address;
> };
> 
> This is necessary for producing a coherent backtraces and other usability
> features.

If I get your point, this additional instructions are need by gdb to rebuild the call stack.
Strange that we cannot remove it if we want to save every tiny bit in a memory-constraint target.
-fomit-frame-pointer does not change this.
 
> To fix it, you'll want to look into XYZFrameLowering.cpp (and possibly code
> that ends up marking your LR as callee-saved in XYZCallingConv.td).
> 
You got it, LR was wrongly marked as callee-saved here.
Thanks for you help.

--
Fred


More information about the llvm-dev mailing list