[LLVMdev] MachineFunction Pass

Aravind Prakash binjanitor at gmail.com
Wed Dec 10 09:04:12 PST 2014

I am familiarizing myself with llvm. 
1) I want to investigate all the instructions that write to e/rax register. First, I wish to print such instructions. Then, I would like to insert some instructions after the write to e/rax. Specifically, I want to invoke (or maybe inline) a function that will perform some checks. What would be the best way to go about this? 

2) I want to control the machine level instructions generated. I want to be able to inspect the generated code, and if some precondition is met, I want to request the code generator to pick a different set of opcodes. I want to repeat till the code is acceptable. For example, if the instructions generated are mov al, 0x1; cmp al, bl;, I wish to change it to (semantically equivalent) mov al, 0x1; cmp bl, al; — This example is from http://web5.cs.columbia.edu/~angelos/Papers/2012/rop-randomizer.pdf <http://web5.cs.columbia.edu/~angelos/Papers/2012/rop-randomizer.pdf>. The goal is to eliminate ROP gadgets. What is the best way to go about it? 

Thank you,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141210/6b2c0b1a/attachment.html>

More information about the llvm-dev mailing list