[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Value.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Oct 2 14:45:08 PDT 2003


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.52 -> 1.53
Value.cpp updated: 1.34 -> 1.35

---
Log message:

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.


---
Diffs of the changes:

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.52 llvm/lib/VMCore/Constants.cpp:1.53
--- llvm/lib/VMCore/Constants.cpp:1.52	Fri Aug 29 00:36:46 2003
+++ llvm/lib/VMCore/Constants.cpp	Thu Oct  2 14:44:40 2003
@@ -581,7 +581,6 @@
 ///
 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::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::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::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: llvm/lib/VMCore/Value.cpp
diff -u llvm/lib/VMCore/Value.cpp:1.34 llvm/lib/VMCore/Value.cpp:1.35
--- llvm/lib/VMCore/Value.cpp:1.34	Fri Aug 29 00:37:22 2003
+++ llvm/lib/VMCore/Value.cpp	Thu Oct  2 14:44:40 2003
@@ -21,7 +21,7 @@
 }
 
 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 @@
   // 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";
@@ -85,18 +85,6 @@
   }
 }
 
-
-// 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;





More information about the llvm-commits mailing list