[llvm-dev] How to insert instructions before each function calls?
SHUCAI YAO via llvm-dev
llvm-dev at lists.llvm.org
Sun Sep 4 23:14:56 PDT 2016
2016年9月5日星期一，Dean Michael Berris <dean.berris at gmail.com> 写道：
> > For the function call lowering, do you mean lowercall function? I did
> insert the instruction before the stack adjustments, but the inserted code
> appears in the prologue of the function, other than before the function
> call. Maybe I did something wrong with the iterator.
> > So you mean I should insert a pseudo instruction in the machinefunction
> pass, then replace it when function call lowering? (Like segemented stack
> Yes, inserting pseudo instructions in the MachineFunctionPass -- you might
> want to have a look at PATCHABLE_RET and how we handle this in XRay.
> Essentially the idea (which I saw Sanjoy Das do first) is to wrap the
> actual instruction (in this case, CALL or LEA, or something specific in the
> platform you're targeting) in a pseudo instruction that just lowers to the
> correct sequence. This gives you complete control of the actual assembly of
> the instructions that you're replacing.
Do you have any example for this? I would like have a look at how you
handle this in XRay if it is possible.
Thank you very much!
> -- Dean
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev