Use $( $| $) to represent alternatives in asm blocks instead of {|}. This

is needed to support targets where {|} aren't special symbols.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30712 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-10-03 23:27:09 +00:00
parent bf497a3a68
commit faf1daeb92

View File

@ -694,12 +694,45 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
break;
case '$': {
++LastEmitted; // Consume '$' character.
if (*LastEmitted == '$') { // $$ -> $
bool Done = true;
// Handle escapes.
switch (*LastEmitted) {
default: Done = false; break;
case '$': // $$ -> $
if (CurVariant == -1 || CurVariant == AsmPrinterVariant)
O << '$';
++LastEmitted; // Consume second '$' character.
break;
case '(': // $( -> same as GCC's { character.
++LastEmitted; // Consume '(' character.
if (CurVariant != -1) {
std::cerr << "Nested variants found in inline asm string: '"
<< AsmStr << "'\n";
exit(1);
}
CurVariant = 0; // We're in the first variant now.
break;
case '|':
++LastEmitted; // consume '|' character.
if (CurVariant == -1) {
std::cerr << "Found '|' character outside of variant in inline asm "
<< "string: '" << AsmStr << "'\n";
exit(1);
}
++CurVariant; // We're in the next variant.
break;
case ')': // $) -> same as GCC's } char.
++LastEmitted; // consume ')' character.
if (CurVariant == -1) {
std::cerr << "Found '}' character outside of variant in inline asm "
<< "string: '" << AsmStr << "'\n";
exit(1);
}
CurVariant = -1;
break;
}
if (Done) break;
bool HasCurlyBraces = false;
if (*LastEmitted == '{') { // ${variable}
@ -786,33 +819,6 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
}
break;
}
case '{':
++LastEmitted; // Consume '{' character.
if (CurVariant != -1) {
std::cerr << "Nested variants found in inline asm string: '"
<< AsmStr << "'\n";
exit(1);
}
CurVariant = 0; // We're in the first variant now.
break;
case '|':
++LastEmitted; // consume '|' character.
if (CurVariant == -1) {
std::cerr << "Found '|' character outside of variant in inline asm "
<< "string: '" << AsmStr << "'\n";
exit(1);
}
++CurVariant; // We're in the next variant.
break;
case '}':
++LastEmitted; // consume '}' character.
if (CurVariant == -1) {
std::cerr << "Found '}' character outside of variant in inline asm "
<< "string: '" << AsmStr << "'\n";
exit(1);
}
CurVariant = -1;
break;
}
}
O << "\n\t" << TAI->getInlineAsmEnd() << "\n";