- // Always mangle local names.
- Name = "ltmp_" + utostr(Count++) + "_" + utostr(getTypeID(V->getType()));
- return Name;
-}
-
-
-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())
- return Name; // Return the already-computed name for V.
-
- // Name mangling occurs as follows:
- // - If V is an intrinsic function, do not change name at all
- // - Otherwise, mangling occurs if global collides with existing name.
- if (isa<Function>(GV) && cast<Function>(GV)->isIntrinsic()) {
- 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 unsigned GlobalID = 0;
- Name = "__unnamed_" + utostr(TypeUniqueID) + "_" + utostr(GlobalID++);
- } else {
- if (GV->hasPrivateLinkage())
- Name = makeNameProper(GV->getName() + Suffix, Prefix, PrivatePrefix);
- else
- Name = makeNameProper(GV->getName() + Suffix, Prefix);
- }
-
- return Name;