#include "llvm/Support/Mangler.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
-#include "llvm/System/Atomic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
}
-std::string Mangler::getValueName(const GlobalValue *GV, const char * Suffix) {
+std::string Mangler::getValueName(const GlobalValue *GV, const char *Suffix) {
// Check to see whether we've already named V.
std::string &Name = Memo[GV];
if (!Name.empty())
Name = GV->getNameStart(); // Is an intrinsic function
} else if (!GV->hasName()) {
// Must mangle the global into a unique ID.
- unsigned TypeUniqueID = getTypeID(GV->getType());
- static uint32_t GlobalID = 0;
-
- unsigned OldID = GlobalID;
- sys::AtomicIncrement(&GlobalID);
-
- Name = "__unnamed_" + utostr(TypeUniqueID) + "_" + utostr(OldID);
+ Name = "__unnamed_" + utostr(Count++);
} else {
if (GV->hasPrivateLinkage())
Name = makeNameProper(GV->getName() + Suffix, Prefix, PrivatePrefix);
-; RUN: llvm-as < %s | llc | grep unnamed_1_0.eh
-; ModuleID = '<stdin>'
+; RUN: llvm-as < %s | llc | grep unnamed_0.eh
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin8"