[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Sep 4 21:31:12 PDT 2003
Changes in directory llvm/lib/VMCore:
Type.cpp updated: 1.65 -> 1.66
---
Log message:
Refactor what has effectively become copy-and-pasted code
---
Diffs of the changes:
Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.65 llvm/lib/VMCore/Type.cpp:1.66
--- llvm/lib/VMCore/Type.cpp:1.65 Thu Sep 4 21:21:39 2003
+++ llvm/lib/VMCore/Type.cpp Thu Sep 4 21:30:47 2003
@@ -503,6 +503,7 @@
return I;
}
+
// containsEquivalent - Return true if the typemap contains a type that is
// structurally equivalent to the specified type.
//
@@ -519,6 +520,18 @@
return 0;
}
+ void finishRefinement(TypeClass *Ty) {
+ if (TypeClass *NewTy = containsEquivalent(Ty)) {
+ // Refined to a different type altogether?
+ Ty->refineAbstractTypeToInternal(NewTy, false);
+ } else {
+ // If the type is currently thought to be abstract, rescan all of our
+ // subtypes to see if the type has just become concrete!
+ if (Ty->isAbstract()) Ty->setAbstract(Ty->isTypeAbstract());
+ Ty->typeIsRefined(); // Same type, different contents...
+ }
+ }
+
// refineAbstractType - This is called when one of the contained abstract
// types gets refined... this simply removes the abstract type from our table.
// We expect that whoever refined the type will add it back to the table,
@@ -1181,14 +1194,7 @@
ParamTys[i] = NewType;
}
- if (const FunctionType *MT = FunctionTypes.containsEquivalent(this)) {
- refineAbstractTypeToInternal(MT, false); // Different type altogether...
- } else {
- // If the type is currently thought to be abstract, rescan all of our
- // subtypes to see if the type has just become concrete!
- if (isAbstract()) setAbstract(isTypeAbstract());
- typeIsRefined(); // Same type, different contents...
- }
+ FunctionTypes.finishRefinement(this);
}
@@ -1215,14 +1221,7 @@
ElementType.removeUserFromConcrete();
ElementType = NewType;
- if (const ArrayType *AT = ArrayTypes.containsEquivalent(this)) {
- refineAbstractTypeToInternal(AT, false); // Different type altogether...
- } else {
- // If the type is currently thought to be abstract, rescan all of our
- // subtypes to see if the type has just become concrete!
- if (isAbstract()) setAbstract(isTypeAbstract());
- typeIsRefined(); // Same type, different contents...
- }
+ ArrayTypes.finishRefinement(this);
}
@@ -1253,14 +1252,7 @@
ETypes[i] = NewType;
}
- if (const StructType *ST = StructTypes.containsEquivalent(this)) {
- refineAbstractTypeToInternal(ST, false); // Different type altogether...
- } else {
- // If the type is currently thought to be abstract, rescan all of our
- // subtypes to see if the type has just become concrete!
- if (isAbstract()) setAbstract(isTypeAbstract());
- typeIsRefined(); // Same type, different contents...
- }
+ StructTypes.finishRefinement(this);
}
// refineAbstractType - Called when a contained type is found to be more
@@ -1286,13 +1278,6 @@
ElementType.removeUserFromConcrete();
ElementType = NewType;
- if (const PointerType *PT = PointerTypes.containsEquivalent(this)) {
- refineAbstractTypeToInternal(PT, false); // Different type altogether...
- } else {
- // If the type is currently thought to be abstract, rescan all of our
- // subtypes to see if the type has just become concrete!
- if (isAbstract()) setAbstract(isTypeAbstract());
- typeIsRefined(); // Same type, different contents...
- }
+ PointerTypes.finishRefinement(this);
}
More information about the llvm-commits
mailing list