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

Jim Laskey jlaskey at apple.com
Tue Jul 25 16:22:14 PDT 2006



Changes in directory llvm/lib/VMCore:

Type.cpp updated: 1.141 -> 1.142
---
Log message:

Moving this function to a permanent home to prevent a dependency cycle created
by the inline heuristic.  Was preventing llvm-gcc4 from building.


---
Diffs of the changes:  (+19 -0)

 Type.cpp |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+)


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.141 llvm/lib/VMCore/Type.cpp:1.142
--- llvm/lib/VMCore/Type.cpp:1.141	Wed Jun 28 16:38:54 2006
+++ llvm/lib/VMCore/Type.cpp	Tue Jul 25 18:22:00 2006
@@ -33,6 +33,25 @@
 
 AbstractTypeUser::~AbstractTypeUser() {}
 
+
+//===----------------------------------------------------------------------===//
+//                         Type PATypeHolder Implementation
+//===----------------------------------------------------------------------===//
+
+// This routine was moved here to resolve a cyclic dependency caused by
+// inline heuristics.
+
+/// get - This implements the forwarding part of the union-find algorithm for
+/// abstract types.  Before every access to the Type*, we check to see if the
+/// type we are pointing to is forwarding to a new type.  If so, we drop our
+/// reference to the type.
+///
+Type* PATypeHolder::get() const {
+  const Type *NewTy = Ty->getForwardedType();
+  if (!NewTy) return const_cast<Type*>(Ty);
+  return *const_cast<PATypeHolder*>(this) = NewTy;
+}
+
 //===----------------------------------------------------------------------===//
 //                         Type Class Implementation
 //===----------------------------------------------------------------------===//






More information about the llvm-commits mailing list