I am new to llvm and I am trying to discover a way to write and insert X86 instructions using llvm passes.
I was going through the different files, X86IbstrInfo being one of them, and I can see a listing of all the different instructions (X86::MOV16rr, X86::MOV16rm…) but I can’t find anywhere with the description of each of the instructions.
Does anyone have any resources or direct me somewhere from where to start?

Thank you in advance.


These opcodes are generated from *.td files automatically. There’s no document for them in LLVM. But you can find the introductions of the corresponding instructions from SDM.
I think one easy way is you write the code in C/LLVM IR, and dump it before the pass you want to write, e.g., Compiler Explorer Line73~79

1 Like