summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-08 22:09:34 +0000
committerChris Lattner <sabre@nondot.org>2004-07-08 22:09:34 +0000
commit3a9fd4c421c0beb34e64fa4d1e6248e6a9d242e2 (patch)
tree0bcc485184a03964bd584b25c0847765b85dde37 /llvm/lib/Support
parenta6302c9059c2edd03c006802d05ce41964cdf57a (diff)
downloadbcm5719-llvm-3a9fd4c421c0beb34e64fa4d1e6248e6a9d242e2.tar.gz
bcm5719-llvm-3a9fd4c421c0beb34e64fa4d1e6248e6a9d242e2.zip
Do not call Type::getUniqueID
llvm-svn: 14706
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Mangler.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/Support/Mangler.cpp b/llvm/lib/Support/Mangler.cpp
index 4b346871166..bf989b41ce8 100644
--- a/llvm/lib/Support/Mangler.cpp
+++ b/llvm/lib/Support/Mangler.cpp
@@ -46,6 +46,15 @@ std::string Mangler::makeNameProper(const std::string &X) {
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 @@ std::string Mangler::getValueName(const Value *V) {
} 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 @@ void Mangler::InsertName(GlobalValue *GV,
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;
OpenPOWER on IntegriCloud