[PATCH] D113924: [asm] Make EmitMSInlineAsmStr and EmitGCCInlineAsmStr more alike

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 12:47:46 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb4e50e52280b: [asm] Make EmitMSInlineAsmStr and EmitGCCInlineAsmStr more alike (authored by thakis).

Changed prior to commit:
  https://reviews.llvm.org/D113924?vs=387330&id=387364#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113924/new/

https://reviews.llvm.org/D113924

Files:
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp


Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -176,7 +176,7 @@
       // 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 @@
                            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 @@
                            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 @@
         ++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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113924.387364.patch
Type: text/x-patch
Size: 1720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211115/3b00fd88/attachment.bin>


More information about the llvm-commits mailing list