diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-05 21:47:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-05 21:47:05 +0000 |
commit | 1c05997bd8d8b3e97c9a5384f8197d0348e237a3 (patch) | |
tree | 0cacf79886ee915a8b9c1361c73ec26aaaf9bd8b /lib/CodeGen/AsmPrinter.cpp | |
parent | bd04aa57964a37d8e7bfd51a168e27ca4dd666af (diff) |
Indent multiline asm strings more nicely
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index e1a4cf68a7..4f72a750ea 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -34,8 +34,8 @@ AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm) GlobalVarAddrSuffix(""), FunctionAddrPrefix(""), FunctionAddrSuffix(""), - InlineAsmStart("#APP\n\t"), - InlineAsmEnd("\t#NO_APP\n"), + InlineAsmStart("#APP"), + InlineAsmEnd("#NO_APP"), ZeroDirective("\t.zero\t"), ZeroDirectiveSuffix(0), AsciiDirective("\t.ascii\t"), @@ -558,7 +558,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) { /// printInlineAsm - This method formats and prints the specified machine /// instruction that is an inline asm. void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { - O << InlineAsmStart; + O << InlineAsmStart << "\n\t"; unsigned NumOperands = MI->getNumOperands(); // Count the number of register definitions. @@ -583,13 +583,17 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { // Not a special case, emit the string section literally. const char *LiteralEnd = LastEmitted+1; while (*LiteralEnd && *LiteralEnd != '{' && *LiteralEnd != '|' && - *LiteralEnd != '}' && *LiteralEnd != '$') + *LiteralEnd != '}' && *LiteralEnd != '$' && *LiteralEnd != '\n') ++LiteralEnd; if (CurVariant == -1 || CurVariant == AsmPrinterVariant) O.write(LastEmitted, LiteralEnd-LastEmitted); LastEmitted = LiteralEnd; break; } + case '\n': + ++LastEmitted; // Consume newline character. + O << "\n\t"; // Indent code with newline. + break; case '$': { ++LastEmitted; // Consume '$' character. if (*LastEmitted == '$') { // $$ -> $ @@ -707,7 +711,7 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { break; } } - O << "\n" << InlineAsmEnd; + O << "\n\t" << InlineAsmEnd << "\n"; } /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM |