[LLVMdev] is there some canonical way to extend liveness?

Nick Lewycky nlewycky at google.com
Tue Feb 17 13:47:52 PST 2015


On 17 February 2015 at 12:46, Andy Ayers <andya at microsoft.com> wrote:

>  In other compilers I’ve worked on there were special pseudo instructions
> (or similar mechanisms like adding extra source operands to returns) that
> allowed you to artificially extend lifetimes of values. For instance we
> might have a requirement that a certain local (say the ‘this pointer’)
> remain live throughout the method.
>
>
>
> Is there anything like this in LLVM?
>

Do you need this at the IR level? Or in codegen?

In the IR we use SSA, so variables are live exactly as long as they could
be used. There isn't a way to extend lifetimes in the IR per se, you would
need to mark it used in some fashion. For instance adding an intrinsic
@llvm.gc.range.ends.here(%ssavar) and the value needs to live long enough
for that intrinsic to be called. I suppose if it gets called twice, the
subsequent calls are no-ops.

Matt's answer is good if you want it in codegen. Most of the use-cases I
can think of apply to codegen anyways.

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150217/1f05d1be/attachment.html>


More information about the llvm-dev mailing list