[llvm-dev] Reliably mapping memcpy intrinsic
Matt Fysh via llvm-dev
llvm-dev at lists.llvm.org
Fri Mar 27 03:01:02 PDT 2020
Similar to how `operator new(size)` can be overridden during linking, to
capture and customize all memory allocation operations, I'd like to be able
to capture all scenarios where memory is copied or moved. I've tried to use
`--wrap memcpy` with some success, however I've noticed that in some
instances (e.g. copying a small struct) the memcpy instruction in the IR is
replaced with a sequence of movq instructions, and the wrap function is not
able to hook into that piece of the code.
Is there a way to ensure all llvm.memcpy intrinsics in the IR are always
lowered to call the memcpy symbol?
Failing that approach, can you suggest other ways to plug into the desired
memory options? I'd like to hook into every memory operation that has a
source and a destination address (copy, move, etc) so I can trace the
passage of symbols through an executing program.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev