mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-12 06:06:32 +00:00
Indent multiline asm strings more nicely
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28132 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bd04aa5796
commit
1c05997bd8
@ -34,8 +34,8 @@ AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm)
|
|||||||
GlobalVarAddrSuffix(""),
|
GlobalVarAddrSuffix(""),
|
||||||
FunctionAddrPrefix(""),
|
FunctionAddrPrefix(""),
|
||||||
FunctionAddrSuffix(""),
|
FunctionAddrSuffix(""),
|
||||||
InlineAsmStart("#APP\n\t"),
|
InlineAsmStart("#APP"),
|
||||||
InlineAsmEnd("\t#NO_APP\n"),
|
InlineAsmEnd("#NO_APP"),
|
||||||
ZeroDirective("\t.zero\t"),
|
ZeroDirective("\t.zero\t"),
|
||||||
ZeroDirectiveSuffix(0),
|
ZeroDirectiveSuffix(0),
|
||||||
AsciiDirective("\t.ascii\t"),
|
AsciiDirective("\t.ascii\t"),
|
||||||
@ -558,7 +558,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
|
|||||||
/// printInlineAsm - This method formats and prints the specified machine
|
/// printInlineAsm - This method formats and prints the specified machine
|
||||||
/// instruction that is an inline asm.
|
/// instruction that is an inline asm.
|
||||||
void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
|
void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
|
||||||
O << InlineAsmStart;
|
O << InlineAsmStart << "\n\t";
|
||||||
unsigned NumOperands = MI->getNumOperands();
|
unsigned NumOperands = MI->getNumOperands();
|
||||||
|
|
||||||
// Count the number of register definitions.
|
// 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.
|
// Not a special case, emit the string section literally.
|
||||||
const char *LiteralEnd = LastEmitted+1;
|
const char *LiteralEnd = LastEmitted+1;
|
||||||
while (*LiteralEnd && *LiteralEnd != '{' && *LiteralEnd != '|' &&
|
while (*LiteralEnd && *LiteralEnd != '{' && *LiteralEnd != '|' &&
|
||||||
*LiteralEnd != '}' && *LiteralEnd != '$')
|
*LiteralEnd != '}' && *LiteralEnd != '$' && *LiteralEnd != '\n')
|
||||||
++LiteralEnd;
|
++LiteralEnd;
|
||||||
if (CurVariant == -1 || CurVariant == AsmPrinterVariant)
|
if (CurVariant == -1 || CurVariant == AsmPrinterVariant)
|
||||||
O.write(LastEmitted, LiteralEnd-LastEmitted);
|
O.write(LastEmitted, LiteralEnd-LastEmitted);
|
||||||
LastEmitted = LiteralEnd;
|
LastEmitted = LiteralEnd;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case '\n':
|
||||||
|
++LastEmitted; // Consume newline character.
|
||||||
|
O << "\n\t"; // Indent code with newline.
|
||||||
|
break;
|
||||||
case '$': {
|
case '$': {
|
||||||
++LastEmitted; // Consume '$' character.
|
++LastEmitted; // Consume '$' character.
|
||||||
if (*LastEmitted == '$') { // $$ -> $
|
if (*LastEmitted == '$') { // $$ -> $
|
||||||
@ -707,7 +711,7 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
O << "\n" << InlineAsmEnd;
|
O << "\n\t" << InlineAsmEnd << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
|
/// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
|
||||||
|
Loading…
Reference in New Issue
Block a user