mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
There is no reason for Value to be an AbstractTypeUser. This just makes things
significantly more complete. Instead, just make DerivedType's AbstractTypeUser's, and make Value contain a PATypeHolder. This will also be more efficient in the future. llvm-svn: 8827
This commit is contained in:
parent
bd6ff0adbc
commit
564dbbf299
@ -19,7 +19,7 @@ class ArrayValType;
|
|||||||
class StructValType;
|
class StructValType;
|
||||||
class PointerValType;
|
class PointerValType;
|
||||||
|
|
||||||
class DerivedType : public Type {
|
class DerivedType : public Type, public AbstractTypeUser {
|
||||||
char isRefining; // Used for recursive types
|
char isRefining; // Used for recursive types
|
||||||
|
|
||||||
// AbstractTypeUsers - Implement a list of the users that need to be notified
|
// AbstractTypeUsers - Implement a list of the users that need to be notified
|
||||||
@ -80,6 +80,8 @@ public:
|
|||||||
refineAbstractTypeToInternal(NewType, true);
|
refineAbstractTypeToInternal(NewType, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump() const { Value::dump(); }
|
||||||
|
|
||||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const DerivedType *T) { return true; }
|
static inline bool classof(const DerivedType *T) { return true; }
|
||||||
static inline bool classof(const Type *T) {
|
static inline bool classof(const Type *T) {
|
||||||
@ -149,7 +151,6 @@ public:
|
|||||||
const std::vector<const Type*> &Params,
|
const std::vector<const Type*> &Params,
|
||||||
bool isVarArg);
|
bool isVarArg);
|
||||||
|
|
||||||
|
|
||||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const FunctionType *T) { return true; }
|
static inline bool classof(const FunctionType *T) { return true; }
|
||||||
static inline bool classof(const Type *T) {
|
static inline bool classof(const Type *T) {
|
||||||
@ -410,6 +411,16 @@ public:
|
|||||||
return new OpaqueType(); // All opaque types are distinct
|
return new OpaqueType(); // All opaque types are distinct
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// refineAbstractType - Called when a contained type is found to be more
|
||||||
|
// concrete - this could potentially change us from an abstract type to a
|
||||||
|
// concrete type.
|
||||||
|
//
|
||||||
|
virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy) {
|
||||||
|
// This class never uses other types!
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
static inline bool classof(const OpaqueType *T) { return true; }
|
static inline bool classof(const OpaqueType *T) { return true; }
|
||||||
static inline bool classof(const Type *T) {
|
static inline bool classof(const Type *T) {
|
||||||
|
@ -34,9 +34,7 @@ class SymbolTable;
|
|||||||
/// Value - The base class of all values computed by a program that may be used
|
/// Value - The base class of all values computed by a program that may be used
|
||||||
/// as operands to other values.
|
/// as operands to other values.
|
||||||
///
|
///
|
||||||
class Value : public Annotable, // Values are annotable
|
struct Value : public Annotable { // Values are annotable
|
||||||
public AbstractTypeUser { // Values use potentially abstract types
|
|
||||||
public:
|
|
||||||
enum ValueTy {
|
enum ValueTy {
|
||||||
TypeVal, // This is an instance of Type
|
TypeVal, // This is an instance of Type
|
||||||
ConstantVal, // This is an instance of Constant
|
ConstantVal, // This is an instance of Constant
|
||||||
@ -50,7 +48,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::vector<User *> Uses;
|
std::vector<User *> Uses;
|
||||||
std::string Name;
|
std::string Name;
|
||||||
PATypeHandle Ty;
|
PATypeHolder Ty;
|
||||||
ValueTy VTy;
|
ValueTy VTy;
|
||||||
|
|
||||||
void operator=(const Value &); // Do not implement
|
void operator=(const Value &); // Do not implement
|
||||||
@ -61,7 +59,7 @@ public:
|
|||||||
|
|
||||||
/// dump - Support for debugging, callable in GDB: V->dump()
|
/// dump - Support for debugging, callable in GDB: V->dump()
|
||||||
//
|
//
|
||||||
void dump() const;
|
virtual void dump() const;
|
||||||
|
|
||||||
/// print - Implement operator<< on Value...
|
/// print - Implement operator<< on Value...
|
||||||
///
|
///
|
||||||
@ -93,12 +91,6 @@ public:
|
|||||||
// Only use when in type resolution situations!
|
// Only use when in type resolution situations!
|
||||||
void uncheckedReplaceAllUsesWith(Value *V);
|
void uncheckedReplaceAllUsesWith(Value *V);
|
||||||
|
|
||||||
/// 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 vector of uses of this Value.
|
// Methods for handling the vector of uses of this Value.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user