[PATCH] D18036: Enabling multiple letters and digits in constraints

Konstantin Vladimirov via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 03:27:22 PST 2016


Tilir updated this revision to Diff 50413.
Tilir added a comment.

Attached new svn diff against top of trunk (r263219)


http://reviews.llvm.org/D18036

Files:
  docs/LangRef.rst
  lib/IR/InlineAsm.cpp

Index: lib/IR/InlineAsm.cpp
===================================================================
--- lib/IR/InlineAsm.cpp
+++ lib/IR/InlineAsm.cpp
@@ -181,14 +181,24 @@
       pCodes = &multipleAlternatives[multipleAlternativeIndex].Codes;
       ++I;
     } else if (*I == '^') {
-      // Multi-letter constraint
-      // FIXME: For now assuming these are 2-character constraints.
-      pCodes->push_back(std::string(I+1, I+3));
-      I += 3;
+      // Multi-letter constraint: any number of letters and digits
+      ++I;
+      std::string code(I, I+1);
+      ++I;
+      while (isalnum(static_cast<unsigned char>(*I))) {
+        code += *I;
+        ++I;
+      }
+      pCodes->push_back(code);
     } else {
-      // Single letter constraint.
-      pCodes->push_back(std::string(I, I+1));
+      // Single letter constraint, or single letter with trailing digits
+      std::string code(I, I+1);
       ++I;
+      while (isdigit(static_cast<unsigned char>(*I))) {
+        code += *I;
+        ++I;
+      }
+      pCodes->push_back(code);
     }
   }
 
Index: docs/LangRef.rst
===================================================================
--- docs/LangRef.rst
+++ docs/LangRef.rst
@@ -3239,9 +3239,10 @@
 """"""""""""""""
 After a potential prefix comes constraint code, or codes.
 
-A Constraint Code is either a single letter (e.g. "``r``"), a "``^``" character
-followed by two letters (e.g. "``^wc``"), or "``{``" register-name "``}``"
-(e.g. "``{eax}``").
+A Constraint Code is either a single letter (e.g. "``r``"), a single letter,
+followed by arbitrary digits (e.g. "``A32``", a "``^``" character
+followed by any number of letters and digits (e.g. "``^wc4``"), 
+or "``{``" register-name "``}``" (e.g. "``{eax}``").
 
 The one and two letter constraint codes are typically chosen to be the same as
 GCC's constraint codes.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18036.50413.patch
Type: text/x-patch
Size: 1854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160311/688f4192/attachment.bin>


More information about the llvm-commits mailing list