#include <list>
#include "llvm/Annotation.h"
+#include "llvm/AbstractTypeUser.h"
class User;
class Type;
class Instruction;
class BasicBlock;
class Method;
+class GlobalVariable;
class Module;
+class SymbolTable;
template<class ValueSubclass, class ItemParentType, class SymTabType>
class ValueHolder;
// Value Class
//===----------------------------------------------------------------------===//
-class Value : public Annotable { // Value's are annotable
+class Value : public Annotable, // Values are annotable
+ public AbstractTypeUser { // Values use potentially abstract types
public:
enum ValueTy {
TypeVal, // This is an instance of Type
ConstantVal, // This is an instance of ConstPoolVal
MethodArgumentVal, // This is an instance of MethodArgument
InstructionVal, // This is an instance of Instruction
-
BasicBlockVal, // This is an instance of BasicBlock
MethodVal, // This is an instance of Method
+ GlobalVal, // This is an instance of GlobalVariable
ModuleVal, // This is an instance of Module
};
private:
list<User *> Uses;
string Name;
- const Type *Ty;
+ PATypeHandle<Type> Ty;
ValueTy VTy;
Value(const Value &); // Do not implement
// All values can potentially be named...
inline bool hasName() const { return Name != ""; }
inline const string &getName() const { return Name; }
- virtual void setName(const string &name) { Name = name; }
+ virtual void setName(const string &name, SymbolTable * = 0) { Name = name; }
// Methods for determining the subtype of this Value. The getValueType()
// method returns the type of the value directly. The cast*() methods are
CAST_FN(Instruction , Instruction )
CAST_FN(BasicBlock , BasicBlock )
CAST_FN(Method , Method )
+ CAST_FN(Global , GlobalVariable)
CAST_FN(Module , Module )
#undef CAST_FN
//
void replaceAllUsesWith(Value *D);
+ // refineAbstractType - This function is implemented because we use
+ // potentially abstract types, and these types may be resolved to more
+ // concrete types after we are constructed.
+ //
+ virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
+
//----------------------------------------------------------------------
// Methods for handling the list of uses of this DEF.
//