[LLVMdev] Fwd: can i avoid saving CSRs for functions with noreturn

Tim Northover t.p.northover at gmail.com
Thu Aug 1 01:06:47 PDT 2013


Hi

(Adding the list back in).

On 1 August 2013 08:44, Liu Xin <navy.xliu at gmail.com> wrote:
> i know where to calculate CSRs. the additional stack space is calculated in
> PEI::calculateCalleeSavedRegisters. the real instructions are inserted in
> insertCSRSpillsAndRestores.
> my point is why llvm code honor 'naked' but does not 'noreturn' for CSR.

And to me it sounds like a good point, but it should probably be done
carefully so that LLVM's internal data structures remain consistent
with reality. It looks like other parts of the backends rely on the
values produced by calculateCalleeSavedRegisters being accurate.

Cheers.

Tim.

> i don't know who invent 'naked' attribute. it completely wipes
> out prolog and epilog and expects outer code to save CSRs
> and adjust 'sp'. in my case, i just want to skip CSRs. in traditional
> programming language, i think 'noreturn' attribute marks 'abort'
> 'exception throw' functions. control flow  will go anywhere but
> absolutely not the parent of current functions, right?  if so, why
> do i need to save CSRs for 'noreturn' functions ?



More information about the llvm-dev mailing list