diff options
author | Chris Lattner <sabre@nondot.org> | 2008-02-15 19:04:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-02-15 19:04:54 +0000 |
commit | 7b1431785bbf9eceeeff4544f5f08133afd0b537 (patch) | |
tree | 6a07f0bf16c7c9727010e3b92954b3fce366a4f7 /llvm/lib/Target/ARM/ARMAsmPrinter.cpp | |
parent | 318c41f9e8a4bb4aad9d48e1386881c73b872d17 (diff) | |
download | bcm5719-llvm-7b1431785bbf9eceeeff4544f5f08133afd0b537.tar.gz bcm5719-llvm-7b1431785bbf9eceeeff4544f5f08133afd0b537.zip |
Handle \n's in value names for more targets. The asm printers
really really really need refactoring :(
llvm-svn: 47171
Diffstat (limited to 'llvm/lib/Target/ARM/ARMAsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMAsmPrinter.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp index 7c69aa192b3..dacc50d71c9 100644 --- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/llvm/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 |