summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-08-17 17:28:37 +0000
committerChris Lattner <sabre@nondot.org>2008-08-17 17:28:37 +0000
commit663d292430a5e9744cb5cf4d5d08ea1f73a7e7c6 (patch)
tree3cb232e34efa8443a98bf817ed5ac6930bc39602 /llvm/lib
parenta204d41ac72bc38e443b4db4e941ec2a6c0ae69e (diff)
downloadbcm5719-llvm-663d292430a5e9744cb5cf4d5d08ea1f73a7e7c6.tar.gz
bcm5719-llvm-663d292430a5e9744cb5cf4d5d08ea1f73a7e7c6.zip
getLLVMName is only used for types now, which always pass in LocalPrefix. Specialize on it.
llvm-svn: 54897
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/AsmWriter.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp
index 87d0da5b8ff..282f47bec15 100644
--- a/llvm/lib/VMCore/AsmWriter.cpp
+++ b/llvm/lib/VMCore/AsmWriter.cpp
@@ -193,25 +193,20 @@ static std::string QuoteNameIfNeeded(const std::string &Name) {
return result;
}
-enum PrefixType {
- GlobalPrefix,
- LabelPrefix,
- LocalPrefix
-};
-
/// getLLVMName - Turn the specified string into an 'LLVM name', which is either
/// prefixed with % (if the string only contains simple characters) or is
/// surrounded with ""'s (if it has special chars in it).
-static std::string getLLVMName(const std::string &Name, PrefixType Prefix) {
+static std::string getLLVMName(const std::string &Name) {
assert(!Name.empty() && "Cannot get empty name!");
- switch (Prefix) {
- default: assert(0 && "Bad prefix!");
- case GlobalPrefix: return '@' + QuoteNameIfNeeded(Name);
- case LabelPrefix: return QuoteNameIfNeeded(Name);
- case LocalPrefix: return '%' + QuoteNameIfNeeded(Name);
- }
+ return '%' + QuoteNameIfNeeded(Name);
}
+enum PrefixType {
+ GlobalPrefix,
+ LabelPrefix,
+ LocalPrefix
+};
+
/// PrintLLVMName - Turn the specified name into an 'LLVM name', which is either
/// prefixed with % (if the string only contains simple characters) or is
/// surrounded with ""'s (if it has special chars in it). Print it out.
@@ -296,7 +291,7 @@ static void fillTypeNameTable(const Module *M,
!cast<PointerType>(Ty)->getElementType()->isPrimitiveType() ||
!cast<PointerType>(Ty)->getElementType()->isInteger() ||
isa<OpaqueType>(cast<PointerType>(Ty)->getElementType()))
- TypeNames.insert(std::make_pair(Ty, getLLVMName(TI->first, LocalPrefix)));
+ TypeNames.insert(std::make_pair(Ty, getLLVMName(TI->first)));
}
}
@@ -1085,7 +1080,7 @@ void AssemblyWriter::printTypeSymbolTable(const TypeSymbolTable &ST) {
// Print the types.
for (TypeSymbolTable::const_iterator TI = ST.begin(), TE = ST.end();
TI != TE; ++TI) {
- Out << "\t" << getLLVMName(TI->first, LocalPrefix) << " = type ";
+ Out << "\t" << getLLVMName(TI->first) << " = type ";
// Make sure we print out at least one level of the type structure, so
// that we do not get %FILE = type %FILE
OpenPOWER on IntegriCloud