[LLVMdev] How do I get the result of an instruction?

John Criswell criswell at uiuc.edu
Sun Nov 16 02:55:46 PST 2008


bhavani krishnan wrote:
> Hi all,
>
> I probably have a stupid question but I could not find out so please help me out here. I can use getOperand to get the operands of an instruction. Similarly, How do I get the result of an instruction? 
>   
The instruction itself is its result.

For example, if I wanted to generate code that does a getlemeneptr 
instruction (GEP) and then uses the result of the GEP as the pointer to 
a load instruction, I would do the following:

Instruction * GEP = new GetElementPtrInst (Value, ....);
Instruction * LI = new LoadInst (GEP, "name", ...);

-- John T.

> Thanks,
> Bhavani
>
>
>       
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list