aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Target/ARM/ARMAsmPrinter.cpp18
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp27
-rw-r--r--lib/Target/X86/X86AsmPrinter.cpp8
3 files changed, 40 insertions, 13 deletions
diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp
index 7c69aa1..dacc50d 100644
--- a/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -807,6 +807,15 @@ bool ARMAsmPrinter::doInitialization(Module &M) {
return Result;
}
+/// PrintUnmangledNameSafely - Print out the printable characters in the name.
+/// Don't print things like \n or \0.
+static void PrintUnmangledNameSafely(const Value *V, std::ostream &OS) {
+ for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen();
+ Name != E; ++Name)
+ if (isprint(*Name))
+ OS << *Name;
+}
+
bool ARMAsmPrinter::doFinalization(Module &M) {
const TargetData *TD = TM.getTargetData();
@@ -875,7 +884,9 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
if (TAI->getCOMMDirectiveTakesAlignment())
O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
- O << "\t\t" << TAI->getCommentString() << " " << I->getName() << "\n";
+ O << "\t\t" << TAI->getCommentString() << " ";
+ PrintUnmangledNameSafely(I, O);
+ O << "\n";
continue;
}
}
@@ -961,8 +972,9 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
}
EmitAlignment(Align, I);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << " " << I->getName()
- << "\n";
+ O << name << ":\t\t\t\t" << TAI->getCommentString() << " ";
+ PrintUnmangledNameSafely(I, O);
+ O << "\n";
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size " << name << ", " << Size << "\n";
// If the initializer is a extern weak symbol, remember to emit the weak
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 605dc12..acc6570 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -639,6 +639,15 @@ bool LinuxAsmPrinter::doInitialization(Module &M) {
return Result;
}
+/// PrintUnmangledNameSafely - Print out the printable characters in the name.
+/// Don't print things like \n or \0.
+static void PrintUnmangledNameSafely(const Value *V, std::ostream &OS) {
+ for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen();
+ Name != E; ++Name)
+ if (isprint(*Name))
+ OS << *Name;
+}
+
bool LinuxAsmPrinter::doFinalization(Module &M) {
const TargetData *TD = TM.getTargetData();
@@ -680,7 +689,9 @@ bool LinuxAsmPrinter::doFinalization(Module &M) {
SwitchToDataSection("\t.data", I);
O << ".comm " << name << "," << Size;
}
- O << "\t\t" << TAI->getCommentString() << " '" << I->getName() << "'\n";
+ O << "\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(I, O);
+ O << "'\n";
} else {
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
@@ -727,8 +738,9 @@ bool LinuxAsmPrinter::doFinalization(Module &M) {
}
EmitAlignment(Align, I);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << " '"
- << I->getName() << "'\n";
+ O << name << ":\t\t\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(I, O);
+ O << "'\n";
// If the initializer is a extern weak symbol, remember to emit the weak
// reference!
@@ -942,7 +954,9 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
if (Subtarget.isDarwin9())
O << "," << Align;
}
- O << "\t\t" << TAI->getCommentString() << " '" << I->getName() << "'\n";
+ O << "\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(I, O);
+ O << "'\n";
} else {
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
@@ -999,8 +1013,9 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
}
EmitAlignment(Align, I);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << " '"
- << I->getName() << "'\n";
+ O << name << ":\t\t\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(I, O);
+ O << "'\n";
// If the initializer is a extern weak symbol, remember to emit the weak
// reference!
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index e23dd0d..9720100 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -138,9 +138,9 @@ bool X86SharedAsmPrinter::doInitialization(Module &M) {
return Result;
}
-/// PrintUnamedNameSafely - Print out the printable characters in the name.
+/// PrintUnmangledNameSafely - Print out the printable characters in the name.
/// Don't print things like \n or \0.
-static void PrintUnamedNameSafely(const Value *V, std::ostream &OS) {
+static void PrintUnmangledNameSafely(const Value *V, std::ostream &OS) {
for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen();
Name != E; ++Name)
if (isprint(*Name))
@@ -228,7 +228,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
O << "\t\t" << TAI->getCommentString() << " ";
- PrintUnamedNameSafely(I, O);
+ PrintUnmangledNameSafely(I, O);
O << "\n";
continue;
}
@@ -331,7 +331,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
EmitAlignment(Align, I);
O << name << ":\t\t\t\t" << TAI->getCommentString() << " ";
- PrintUnamedNameSafely(I, O);
+ PrintUnmangledNameSafely(I, O);
O << "\n";
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size\t" << name << ", " << Size << "\n";