There is no reason for Value to be an AbstractTypeUser. This just makes things
authorChris Lattner <sabre@nondot.org>
Thu, 2 Oct 2003 19:44:40 +0000 (19:44 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 2 Oct 2003 19:44:40 +0000 (19:44 +0000)
significantly more complete.  Instead, just make DerivedType's AbstractTypeUser's,
and make Value contain a PATypeHolder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8828 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Constants.cpp
lib/VMCore/Value.cpp

index 20f99134892976e8b25d04574b09715276648482..bc9196c8ce89ed8ecda7571a63f0e1d4e25ab6f1 100644 (file)
@@ -581,7 +581,6 @@ void ConstantArray::destroyConstant() {
 ///
 void ConstantArray::refineAbstractType(const DerivedType *OldTy,
                                        const Type *NewTy) {
-  Value::refineAbstractType(OldTy, NewTy);
   if (OldTy == NewTy) return;
 
   // Make everyone now use a constant of the new type...
@@ -650,7 +649,6 @@ void ConstantStruct::destroyConstant() {
 ///
 void ConstantStruct::refineAbstractType(const DerivedType *OldTy,
                                         const Type *NewTy) {
-  Value::refineAbstractType(OldTy, NewTy);
   if (OldTy == NewTy) return;
 
   // Make everyone now use a constant of the new type...
@@ -694,7 +692,6 @@ void ConstantPointerNull::destroyConstant() {
 ///
 void ConstantPointerNull::refineAbstractType(const DerivedType *OldTy,
                                              const Type *NewTy) {
-  Value::refineAbstractType(OldTy, NewTy);
   if (OldTy == NewTy) return;
 
   // Make everyone now use a constant of the new type...
@@ -828,7 +825,6 @@ void ConstantExpr::destroyConstant() {
 ///
 void ConstantExpr::refineAbstractType(const DerivedType *OldTy,
                                       const Type *NewTy) {
-  Value::refineAbstractType(OldTy, NewTy);
   if (OldTy == NewTy) return;
 
   // FIXME: These need to use a lower-level implementation method, because the
index 245fa482b74ae2c01b99919b55b462e03c827371..d0fcafbdf019bdd27942e67ef9171fab3728f2d6 100644 (file)
@@ -21,7 +21,7 @@ static inline const Type *checkType(const Type *Ty) {
 }
 
 Value::Value(const Type *ty, ValueTy vty, const std::string &name)
-  : Name(name), Ty(checkType(ty), this) {
+  : Name(name), Ty(checkType(ty)) {
   VTy = vty;
 }
 
@@ -34,7 +34,7 @@ Value::~Value() {
   // a <badref>
   //
   if (Uses.begin() != Uses.end()) {
-    std::cerr << "While deleting: " << Ty << "%" << Name << "\n";
+    std::cerr << "While deleting: " << *Ty << "%" << Name << "\n";
     for (use_const_iterator I = Uses.begin(); I != Uses.end(); ++I)
       std::cerr << "Use still stuck around after Def is destroyed:"
                 << **I << "\n";
@@ -86,18 +86,6 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) {
 }
 
 
-// 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.  For the value class, we simply
-// change Ty to point to the right type.  :)
-//
-void Value::refineAbstractType(const DerivedType *OldTy, const Type *NewTy) {
-  assert(Ty.get() == OldTy && "Can't refine anything but my type!");
-  if (OldTy == NewTy && !OldTy->isAbstract())
-    Ty.removeUserFromConcrete();
-  Ty = NewTy;
-}
-
 void Value::killUse(User *U) {
   if (U == 0) return;
   unsigned i;