[LLVMdev] Named Register Implementation

Krzysztof Parzyszek kparzysz at codeaurora.org
Fri Mar 28 09:51:00 PDT 2014


On 3/28/2014 11:22 AM, Renato Golin wrote:
>
> On the IR level, I expect a call to an intrinsic to never be pruned.
> But I also need more guarantees regarding code movement, which I'm not
> there is. Function calls that are not const can't be moved around, so
> I expected that an intrinsic (being a function call in the IR level)
> without any annotation regarding its safety would guarantee that it
> doesn't happen.

If foo doesn't read memory, then it's legal to interchange these two:
   store x, 1
   call foo()

It means that you can, in fact, move a call around as long as some 
restrictions are met.  Even if you restrict the intrinsics to only apply 
to non-allocatable registers, can you guarantee that such apparently 
safe code motion won't alter these registers?  A, perhaps hypothetical, 
example could be reading "sp" on x86, while the code that have been 
moved around caused spill and "push/pop" to be generated.  Even if this 
example is only hypothetical, couldn't something of that nature happen 
in practice?
On the other hand, if you treat the intrinsics as accessing memory, it 
would be strictly worse than inline asm.

-K


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list