How to get the left-hand operand of an instruction?

Hi,

I am a new novice of LLVM, and I want know how to get the left-hand operand of an instruction?

For example:
how to get the %temp2 operand in the next instruction:

%temp2 = malloc i8, i32 %n

Thanks a lot!

Best Regards!

Hi Qiuping yi,

I am a new novice of LLVM, and I want know how to get the left-hand
operand of an instruction?

For example:
how to get the %temp2 operand in the next instruction:

%temp2 = malloc i8, i32 %n

there is no left-hand side, temp2 is just a name for the instruction.
Since the LLVM IR is in SSA form, registers have exactly one definition,
and thus there is no point in distinguishing between a register and the
instruction that defines it. In short, whenever you would like to make
use of "%temp2", just use the instruction ("malloc i8, i32 %n") directly.

Ciao,

Duncan.

Yes, Duncan is right. You can use (“malloc i8, i32 %n”) as a value
to mark its uses.

cheers,

Liu Jian

Hi Duncan,

I have catched your reply and solved the problem. Thank you for the elaborate reply.

Best Regards!

2010/4/6 Duncan Sands <baldrick@free.fr>