[llvm-dev] RFC: callee saved register verifier
Sanjoy Das via llvm-dev
llvm-dev at lists.llvm.org
Fri May 13 16:04:30 PDT 2016
Thanks for the quick response!
Quentin Colombet wrote:
> You mean with code generated by another compiler/handwritten,
> because otherwise, this is pretty easy to verify in the machine
> verifier :).
> (We probably do not verify that though, but we should.)
> Thus, could you elaborate on the use cases.
The runtime functions in question are usually hand-written assembly,
or generated from another ("tier-1") JIT.
I expect this to be more useful when calling into hand-written
assembly routines than when calling into other-compiler-generated
code, since hand-written assembly tends to be more prone to the kind
of mistakes I'm verifying against (accidentally clobbering a CSR on a
rarely taken path).
So far we've not seen any bugs around _LLVM_ failing to obey a calling
convention, so (as yet! :) ) I'm not too worried around LLVM
miscompiling due to some exotic calling convention.
>> Implementation wise, I have a rough prototype that works by running a
>> MachineFunctionPass before register allocation that emits the
>> necessary MachineInstrs / control flow to make this happen. Is that a
>> right way to solve the problem?
> I’d say yes, assuming the use cases do not involve llvm, otherwise
the verifier approach seems preferable to me.
>> If so, I'll clean up what I have and
>> put it up for review on llvm-commits. If there are better ways to do
>> this, then I'm happy to hear them.
>> -- Sanjoy
More information about the llvm-dev