[LLVMdev] how to change one operand of an LLVM instruction
Susan Horwitz
horwitz at cs.wisc.edu
Tue Sep 8 14:46:34 PDT 2009
I am trying to implement node splitting to transform irreducible CFGS to
reducible ones. This means making copies of some basic blocks, which in
turn means making copies of individual instructions. I can use the
"clone" function to make an exact copy, but then I need to change some
operands. For example, when I copy
%1 = ...
%2 = add %1, 5
I get
%3 = ...
%4 = add %1, 5
and I need to change the %1 operand in the copy to be %3.
The only way I see to do this is to create a new instruction instead of a
clone, using a big switch on the opcode (since different instructions'
constructors have different parameters).
Anyone know of an easier way to do this?
More information about the llvm-dev
mailing list