[LLVMdev] LLVM Instruction Operands

Reid Kleckner reid.kleckner at gmail.com
Thu Jun 2 09:52:50 PDT 2011


LLVM IR operands *are* other instructions.  For example, if you want
to use the result of a multiply in an add, the operand of the add is
simply a pointer to the multiply instruction.  This is possible
because the IR is always in SSA form, so there is only one def.

Reid

On Thu, Jun 2, 2011 at 12:46 PM, Griffin Wright <grwright at umich.edu> wrote:
>
> Hello all:
>
> I apologize for what I imagine is a rather silly question, but I'm still
> somewhat new to LLVM and am stuck.  I am reworking some code that was
> originally in the backend involving MachineInstructions and
> MachineOperands, and I now need for it to function as an LLVM IR pass,
> using just Instructions, etc, and nothing related to 'Machine'.
>
> However, I am not sure how to get the information I need at the IR level.
> I need to iterate over all operands of an instruction, analyzing each
> operand to get a register number (if available), see if the operand is a
> register or an immediate, get the operand def, and some other stuff.  I
> also need to be able to do implicitDef/Use determination on instructions.
> I don't see a way to do this at present.
>
> So, any guidance would be much appreciated.
>
> Thanks!
> Griffin Wright
> _______________________________________________
> 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