[LLVMdev] Code documentation

Bill Wendling wendling at isanbard.org
Thu Apr 8 09:16:01 PDT 2004


Vladimir Prus wrote:
} 
} Hello,
} is there any documentation for LLVM codebase other than produced by doxygen?
} The reason I'm asking is that doxygen docs are 
} (1) not very complete at the moment, as lot of classes don't even have a 
} description
} (2) is generally not the best way to get high-level view of a big codebase.
} 
} As an example, consider this code:
} 
}      %tmp.1 = setgt int %i, 0
}      br bool %tmp.1, label %then.0, label %else.0
} 
} It appears that Value* that corresponds to the %tmp.1 operand of the second 
} instruction is actually a pointer to Instruction* which represents the first 
} instruction.
} 
} This looks a nice design, given that all code is in SSA, but I've spend 
} considerable time today before understanding it, because I first tried to 
} look up a  ways to find the instruction which defines tmp.1, then looked for 
} a method which returns destination of an instruction, and so on..
} 
There is a lot of documentation other than Doxygen. Try here:

    http://llvm.cs.uiuc.edu/Documentation.html

There is a paper on LLVM's design. There's also the language reference
manual. And information on writing an LLVM pass.

I think the answer to your question above is: since LLVM is in SSA form,
you have one definition and multiple uses of a variable. Since names are
meaningless in LLVM, variables used in an instruction are pointers to
the definition of that varialbe, which is just an Instruction*. I
believe that they are Value* because the operands can be other than
Instructions (Constants, for instance).

I hope this helps :-)

-bw

-- 
||  "If wishes and buts were clusters of nuts, we'd all have a bowl of
||   granola!" - Mr. Jellineck



More information about the llvm-dev mailing list