[LLVMdev] Instruction Operands

James Molloy james.molloy at arm.com
Tue Sep 6 09:37:50 PDT 2011


Hi Brandon,

Firstly, "%add" is the Instruction object itself - an instruction is its own
return value.

Secondly, getOperand(int i) is what you want:
http://llvm.org/docs/doxygen/html/User_8h_source.html#l00086.

Cheers,

James

> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
> Behalf Of bdavis at cs.fsu.edu
> Sent: 06 September 2011 17:25
> To: llvmdev at cs.uiuc.edu
> Subject: [LLVMdev] Instruction Operands
> 
> Working with the LLVM source, if I have an Instruction object by
> itself (created by parsing a module using LLVM's parser), is there a
> way to get its operands/destination?
> 
> e.g. '%add = add nsw i32 %tmp2, %tmp1'
> Being able to get some form of %add, %tmp2, and %tmp1?
> 
> All I can pull is the operation itself, i.e. that it's an add.
> 
> Thanks,
> Brandon
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 
> _______________________________________________
> 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