hi, all
I'm reading LLVM code, but there is one thing bothering me a lot: How
are the source & result operands of an instruction organised? Is the
operand(0) the result operand and others are the source operand? thanks
--zhoufeng
The "operands" of an instruction are the values that it uses. The result is always implicitly the instruction itself. For example, consider this LLVM instruction:
%X = add int %Y, %Z
This instruction will have two operands, one for Y and one for Z. The %X value is actually the *add instruction itself*. Because LLVM uses SSA form, each value can only be defined by a single instruction. Additionally, each instruction defines at most one value.
You might find some of the information in the programmer's manual useful, such as this section:
http://llvm.cs.uiuc.edu/docs/ProgrammersManual.html#iterate_chains
If you haven't looked at it, the Programmer's Manual has lots of useful gems in it.
-Chris