<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I am familiarizing myself with llvm. <div class="">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? <div class=""><br class=""></div><div class="">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 <a href="http://web5.cs.columbia.edu/~angelos/Papers/2012/rop-randomizer.pdf" class="">http://web5.cs.columbia.edu/~angelos/Papers/2012/rop-randomizer.pdf</a>. The goal is to eliminate ROP gadgets. What is the best way to go about it? </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thank you,</div><div class="">Aravind</div><div class=""><br class=""></div><div class=""><br class=""></div></div></body></html>