forked from OSchip/llvm-project
[asm] Make EmitMSInlineAsmStr and EmitGCCInlineAsmStr more alike
https://reviews.llvm.org/D71677 copied a bunch of code from EmitGCCInlineAsmStr() to EmitMSInlineAsmStr() but made a few small (likely unintentional) changes. This makes these pieces look the same. No behavior change. (Why are these functions two copies? No great reason as far as I can tell. https://reviews.llvm.org/rG1778831a3d1d24ab6545635f63da4d9c5f8f0ac7 did the split; we might want to undo them at some point. But PR23933 suggests that a bigger change is planned for this file in the future, so keeping this incremental for now.) Differential Revision: https://reviews.llvm.org/D113924
This commit is contained in:
parent
0be836b7dd
commit
b4e50e5228
|
@ -176,7 +176,7 @@ static void EmitMSInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
|||
// If we have ${:foo}, then this is not a real operand reference, it is a
|
||||
// "magic" string reference, just like in .td files. Arrange to call
|
||||
// PrintSpecial.
|
||||
if (HasCurlyBraces && LastEmitted[0] == ':') {
|
||||
if (HasCurlyBraces && *LastEmitted == ':') {
|
||||
++LastEmitted;
|
||||
const char *StrStart = LastEmitted;
|
||||
const char *StrEnd = strchr(StrStart, '}');
|
||||
|
@ -200,7 +200,7 @@ static void EmitMSInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
|||
Twine(AsmStr) + "'");
|
||||
LastEmitted = IDEnd;
|
||||
|
||||
if (Val >= NumOperands-1)
|
||||
if (Val >= NumOperands - 1)
|
||||
report_fatal_error("Invalid $ operand number in inline asm string: '" +
|
||||
Twine(AsmStr) + "'");
|
||||
|
||||
|
@ -367,6 +367,10 @@ static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
|||
Twine(AsmStr) + "'");
|
||||
LastEmitted = IDEnd;
|
||||
|
||||
if (Val >= NumOperands - 1)
|
||||
report_fatal_error("Invalid $ operand number in inline asm string: '" +
|
||||
Twine(AsmStr) + "'");
|
||||
|
||||
char Modifier[2] = { 0, 0 };
|
||||
|
||||
if (HasCurlyBraces) {
|
||||
|
@ -388,10 +392,6 @@ static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
|||
++LastEmitted; // Consume '}' character.
|
||||
}
|
||||
|
||||
if (Val >= NumOperands-1)
|
||||
report_fatal_error("Invalid $ operand number in inline asm string: '" +
|
||||
Twine(AsmStr) + "'");
|
||||
|
||||
// Okay, we finally have a value number. Ask the target to print this
|
||||
// operand!
|
||||
if (CurVariant == -1 || CurVariant == AsmPrinterVariant) {
|
||||
|
|
Loading…
Reference in New Issue