Rearrange some code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14427 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-06-26 20:33:27 +00:00
parent fae098a56b
commit f6b7844101

View File

@ -41,26 +41,17 @@ class SymbolTable;
/// as operands to other values. /// as operands to other values.
/// ///
struct Value { 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: private:
unsigned SubclassID; // Subclass identifier (for isa/dyn_cast)
PATypeHolder Ty;
iplist<Use> Uses; iplist<Use> Uses;
std::string Name; std::string Name;
PATypeHolder Ty;
ValueTy VTy;
void operator=(const Value &); // Do not implement void operator=(const Value &); // Do not implement
Value(const Value &); // Do not implement Value(const Value &); // Do not implement
public: public:
Value(const Type *Ty, ValueTy vty, const std::string &name = ""); Value(const Type *Ty, unsigned scid, const std::string &name = "");
virtual ~Value(); virtual ~Value();
/// dump - Support for debugging, callable in GDB: V->dump() /// dump - Support for debugging, callable in GDB: V->dump()
@ -83,10 +74,6 @@ public:
Name = name; 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 /// replaceAllUsesWith - Go through the uses list for this definition and make
/// each use point to "V" instead of "this". After this completes, 'this's /// each use point to "V" instead of "this". After this completes, 'this's
/// use list is guaranteed to be empty. /// use list is guaranteed to be empty.
@ -126,6 +113,26 @@ public:
/// ///
void addUse(Use &U) { Uses.push_back(&U); } void addUse(Use &U) { Uses.push_back(&U); }
void killUse(Use &U) { Uses.remove(&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) { inline std::ostream &operator<<(std::ostream &OS, const Value *V) {