[LLVMdev] Instruction Conversion
John Criswell
criswell at uiuc.edu
Sat May 9 12:38:34 PDT 2009
Rotem Varon wrote:
> Hi,
>
> Let say i am writing a code inside basic block pass and iterating all
> the instructions inside,
> and i encountered in this instruction :
If you're asking how to get the operands of an Instruction, use the
getOperand() method:
Value * Operand1 = I->getOperand(0);
Value * Operand2 = I->getOperand(1);
The LLVM doxygen documentation (http://llvm.org/doxygen/) is an
invaluable resource. You may also want to read the Programmer's Guide
(http://llvm.org/docs/ProgrammersManual.html).
Does this answer your question?
-- John T.
>
> %3 = add i32 %1, 2
>
> I want to convert this instruction to something like this:
>
> add R1, 2, R3
>
> I know the opocode, but i what i need is, the operands %1 and 2 (in
> this example).
>
> I will be grateful if some one will tell me how to do so .
More information about the llvm-dev
mailing list