[LLVMdev] instruction/register identifier?

Chris Lattner sabre at nondot.org
Thu Nov 21 09:27:01 PST 2002


On Thu, 21 Nov 2002, Bill? Wendling wrote:
> You can get the name of an instruction with the "getName()" method.
> However, it's been pointed out that names are rather meaningless in LLVM
> and aren't guaranteed to be unique.

Just to emphasize a bit here, names _are completely meaningless in LLVM_
and are meant for debugging purposes only.  Do not count on them even
existing!  :)  Specifically, try running 'opt -strip' on a bytecode file
and see what happens (a hint, it removes all names, making _every
instruction_ have the name "").

> Why not store a Value* instead? (Or Instruction* if you prefer)

In general, in LLVM this is the right way to go.  Instructions are
uniquely identified by their address, so any time you'd like to use a
name, please use a Value*.  :)

Thanks for bringing this up Bill,

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/





More information about the llvm-dev mailing list