[llvm-commits] CVS: llvm/lib/Support/Mangler.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Jul 8 17:10:01 PDT 2004


Changes in directory llvm/lib/Support:

Mangler.cpp updated: 1.12 -> 1.13

---
Log message:

Do not call Type::getUniqueID


---
Diffs of the changes:  (+12 -4)

Index: llvm/lib/Support/Mangler.cpp
diff -u llvm/lib/Support/Mangler.cpp:1.12 llvm/lib/Support/Mangler.cpp:1.13
--- llvm/lib/Support/Mangler.cpp:1.12	Tue Jul  6 15:29:05 2004
+++ llvm/lib/Support/Mangler.cpp	Thu Jul  8 17:09:34 2004
@@ -46,6 +46,15 @@
   return Result;
 }
 
+/// getTypeID - Return a unique ID for the specified LLVM type.
+///
+unsigned Mangler::getTypeID(const Type *Ty) {
+  unsigned &E = TypeMap[Ty];
+  if (E == 0) E = ++TypeCounter;
+  return E;
+}
+
+
 std::string Mangler::getValueName(const Value *V) {
   // Check to see whether we've already named V.
   ValueMap::iterator VI = Memo.find(V);
@@ -71,12 +80,11 @@
     } else {
       // Non-global, or global with internal linkage / colliding name
       // -> mangle.
-      unsigned TypeUniqueID = V->getType()->getUniqueID();
+      unsigned TypeUniqueID = getTypeID(V->getType());
       name = "l" + utostr(TypeUniqueID) + "_" + makeNameProper(V->getName());
     }
   } else {
-    name = "ltmp_" + utostr(Count++) + "_"
-      + utostr(V->getType()->getUniqueID());
+    name = "ltmp_" + utostr(Count++) + "_" + utostr(getTypeID(V->getType()));
   }
   
   Memo[V] = name;
@@ -108,7 +116,7 @@
 
 
 Mangler::Mangler(Module &m, bool addUnderscorePrefix)
-  : M(m), AddUnderscorePrefix(addUnderscorePrefix), Count(0) {
+  : M(m), AddUnderscorePrefix(addUnderscorePrefix), TypeCounter(0), Count(0) {
   // Calculate which global values have names that will collide when we throw
   // away type information.
   std::map<std::string, GlobalValue*> Names;





More information about the llvm-commits mailing list