[LLVMdev] Stackmaps: caller-save-registers passed as deopt args

Sanjoy Das sanjoy at playingwithpointers.com
Fri Oct 31 17:28:01 PDT 2014

Hi Kevin,

Thank you for starting this discussion!

I think the distinction is really between whether the live values are
"live on call" or "live on return".  Ideally we should be able to mark
values to be of either kind (liveoncall vs. liveonreturn) in the call
to the patchpoint intrinsic.  This will make the semantics of
patchpoint slightly odd though -- we'll end up with an SSA instruction
where some inputs are expected to be live *after* the instruction has
been retired.  Are there other SSA instructions that have this sort of
semantics?  Nevertheless, I think splitting the inputs to a patchpoint
into "function arguments", "values live on call" and "values live on
return" is a good idea.

> There was some discussion about what the behavior should be if you use
> anyregcc, since in that case it seems reasonable to receive a
> caller-save register if you are interested in using it inside the
> patchpoint.  My thoughts are that in that case you might be better off
> including the value as part of the function arguments instead of the
> stackmap/deopt arguments.

I don't see why anything needs to be different for patchpoints running
with anyregcc.  The call arguments always get lowered based on the
calling convention, the "live on call" values get arbitrary stack
slots / registers and the "live on return" values get assigned to CSRs
or stack slots.  If I've read X86RegisterInfo::getCalleeSavedRegs
correctly, I think all registers are callee-saved for anyregcc so
whatever you call using the anyregcc convention will have to respect
that; but that's a different problem.

-- Sanjoy

More information about the llvm-dev mailing list