[LLVMdev] Representing a safepoint as an instruction in the x86 backend?

Juergen Ributzka juergen at apple.com
Thu Feb 27 13:08:27 PST 2014


Hi Philip,

wouldn’t it be easier to adapt the patchpoint intrinsic to allow it to take also a function address/global address as target argument. We are already tapping into the target-specific call lowering, so the call would be lowered exactly the same way. By doing this you don’t have to worry about anything getting inserted between your CALL and SAFEPOINT instruction. I know the GLUE flag is supposed to keep things together in the call sequence, but I think it is very fragile to rely on this.
 
On Feb 25, 2014, at 5:32 PM, Philip Reames <listmail at philipreames.com> wrote:

> The reason for this is that the folding logic only applies if there's a single use of the physical register.  If there's more than one use, it's assumed to be cheaper to reload than to perform two folded operations against memory.  (I don't know if this is true always, but more importantly for me, it breaks my intended semantics.)
> 

Yes, that is true and the code would break if you remove that constraint, because it would delete the instruction without checking if there are still any uses remaining - although this should be easy to fix.

> Does anyone know of a way to avoid the fold step to begin with?  I'd really like the register allocation to not give preference to register uses for this instruction.  If a virtual register is already in the stack, it shouldn't attempt to reload before this instruction. I haven't been able to find the appropriate hook for this.

I thought Andy did something about this for patchpoints and stackmaps. Didn't we handled that in the target-specific frame index elimination?

-Juergen



More information about the llvm-dev mailing list