[LLVMdev] IR code modification/transformation

Rinaldini Julien julien.rinaldini at heig-vd.ch
Thu Aug 11 03:11:42 PDT 2011


Hi,

I have a question about the llvm passes.

I'm iterating over a basicblock and I can get an instruction and print it.
Now, I want to iterate over the instruction and be able to modify the values of the instruction.

For example, if my instruction is an add "<result> = add i32 4, %var" I want to transform it in a sub "<result> = sub i32 4, %var".

I looked up on getOperands() and getAllMetadata() and some others methods, but none work.

Can you help me with that please?

Thx



More information about the llvm-dev mailing list