[LLVMdev] ValueTy not set appropriately in Value.h?

Michael McCracken michael.mccracken at gmail.com
Wed Aug 10 16:37:33 PDT 2005

Hi, for some temporary debugging I wanted to know what sort of Value I
was seeing, and I ran across this comment in Value.h - it's probably a
minor point, but unless I'm missing something I think either the last
line of the comment is wrong or the code is.

It appears in rev 1.58, as part of fixing bug 122.

00134   /// getValueType - Return an ID for the concrete type of this
object.  This is
00135   /// used to implement the classof checks.  This should not be
used for any
00136   /// other purpose, as the values may change as LLVM evolves. 
Also, note that
00137   /// starting with the InstructionVal value, the value stored
is actually the
00138   /// Instruction opcode, so there are more than just these
values possible here
00139   /// (and Instruction must be last).
00140   ///
00141   enum ValueTy {
00142     ArgumentVal,              // This is an instance of Argument
00143     BasicBlockVal,            // This is an instance of BasicBlock
00144     FunctionVal,              // This is an instance of Function
00145     GlobalVariableVal,        // This is an instance of GlobalVariable
00146     UndefValueVal,            // This is an instance of UndefValue
00147     ConstantExprVal,          // This is an instance of ConstantExpr
00148     ConstantAggregateZeroVal, // This is an instance of
00149     SimpleConstantVal,        // This is some other type of Constant
00150     InstructionVal,           // This is an instance of Instruction
00151     ValueListVal              // This is for bcreader, a special ValTy
00152   };
00153   unsigned getValueType() const {
00154     return SubclassID;
00155   }

Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/blog/

More information about the llvm-dev mailing list