[llvm-commits] CVS: llvm/include/llvm/Value.h
Chris Lattner
lattner at cs.uiuc.edu
Sat Jun 26 15:34:09 PDT 2004
Changes in directory llvm/include/llvm:
Value.h updated: 1.51 -> 1.52
---
Log message:
Rearrange some code.
---
Diffs of the changes: (+24 -17)
Index: llvm/include/llvm/Value.h
diff -u llvm/include/llvm/Value.h:1.51 llvm/include/llvm/Value.h:1.52
--- llvm/include/llvm/Value.h:1.51 Tue Jun 8 12:44:21 2004
+++ llvm/include/llvm/Value.h Sat Jun 26 15:33:27 2004
@@ -41,26 +41,17 @@
/// as operands to other values.
///
struct Value {
- enum ValueTy {
- TypeVal, // This is an instance of Type
- ConstantVal, // This is an instance of Constant
- ArgumentVal, // This is an instance of Argument
- InstructionVal, // This is an instance of Instruction
- BasicBlockVal, // This is an instance of BasicBlock
- FunctionVal, // This is an instance of Function
- GlobalVariableVal, // This is an instance of GlobalVariable
- };
-
private:
+ unsigned SubclassID; // Subclass identifier (for isa/dyn_cast)
+ PATypeHolder Ty;
iplist<Use> Uses;
std::string Name;
- PATypeHolder Ty;
- ValueTy VTy;
void operator=(const Value &); // Do not implement
Value(const Value &); // Do not implement
+
public:
- Value(const Type *Ty, ValueTy vty, const std::string &name = "");
+ Value(const Type *Ty, unsigned scid, const std::string &name = "");
virtual ~Value();
/// dump - Support for debugging, callable in GDB: V->dump()
@@ -83,10 +74,6 @@
Name = name;
}
- /// getValueType - Return the immediate subclass of this Value.
- ///
- inline ValueTy getValueType() const { return VTy; }
-
/// replaceAllUsesWith - Go through the uses list for this definition and make
/// each use point to "V" instead of "this". After this completes, 'this's
/// use list is guaranteed to be empty.
@@ -126,6 +113,26 @@
///
void addUse(Use &U) { Uses.push_back(&U); }
void killUse(Use &U) { Uses.remove(&U); }
+
+ /// getValueType - Return an ID for the concrete type of this object. This is
+ /// used to implement the classof checks. This should not be used for any
+ /// other purpose, as the values may change as LLVM evolves. Also, note that
+ /// starting with the InstructionVal value, the value stored is actually the
+ /// Instruction opcode, so there are more than just these values possible here
+ /// (and Instruction must be last).
+ ///
+ enum ValueTy {
+ TypeVal, // This is an instance of Type
+ ArgumentVal, // This is an instance of Argument
+ BasicBlockVal, // This is an instance of BasicBlock
+ FunctionVal, // This is an instance of Function
+ GlobalVariableVal, // This is an instance of GlobalVariable
+ ConstantVal, // This is an instance of Constant
+ InstructionVal, // This is an instance of Instruction
+ };
+ unsigned getValueType() const {
+ return SubclassID;
+ }
};
inline std::ostream &operator<<(std::ostream &OS, const Value *V) {
More information about the llvm-commits
mailing list