Displaying 5 results from an estimated 5 matches for "patchable_ret".
2016 Sep 05
2
How to insert instructions before each function calls?
...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 implementation?)
>
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...
2016 Sep 06
2
How to insert instructions before each function calls?
...>
> Do you have any example for this? I would like have a look at how you handle this in XRay if it is possible.
>
Yes, this is all upstream -- if you look in lib/CodeGen/XRayInstrument.cpp and the associated lowering code for X86 in lib/Target/X86/X86MCInstLower.cpp and/or search for PATCHABLE_RET in include/... and lib/... then that should give you a better idea of how this works. :)
Cheers
-- Dean
2016 Apr 29
2
RFC: XRay -- A Function Call Tracing System
...dd thresholds for some
heuristics.
3.
*LLVM:* Add new LLVM pseudo instructions for indicating where the
instrumentation sleds should be placed, and what kind of sleds these are.
For entry sleds, we can use the `PATCHABLE_OP` instruction, and a new
instruction for patching exits (`PATCHABLE_RET`?) that get handled by the
assembly printer per platform. Currently only implemented for x86_64.
4.
*LLVM:* Use a separate section to map the instrumentation sled
locations. This will work even in non-debug builds and the sections will be
merged by the linker.
5.
*compiler-rt...
2016 Jul 04
4
[XRay] RFC: LLVM-side Changes for nop-sleds
...=============
XRay relies on statically inserted instrumentation points (implemented as
nop-sleds) and a dynamic enable/disable mechanism implemented in a runtime
library. As of this writing the implementation of the XRay prototype
involves adding two pseudo-instructions (PATCHABLE_FUNCTION_ENTER,
PATCHABLE_RET) that serve as placeholders for where the nop-sleds are to be
emitted when lowering. PATCHABLE_FUNCTION_ENTER is an instruction that
takes no operands and serves as a pure placeholder. PATCHABLE_RET
effectively behaves as a return instruction (isReturn = true) and wraps
whatever the return instruct...
2016 Sep 05
2
How to insert instructions before each function calls?
We do something very similar here for XRay, and I would think the approach would be similar. What XRay does are the following:
- Find the machine instructions in a MachineFunctionPass that look interesting from the XRay perspective. Theses turn out to be: the beginning of the function (not really an instruction but a location), tail calls, and returns. I suspect you can very simply find the call