[PATCH] D59810: Always support masm syntax when intel dialect is active

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 02:31:47 PDT 2019


serge-sans-paille created this revision.
serge-sans-paille added reviewers: rnk, mcrosier.
Herald added subscribers: llvm-commits, eraman.
Herald added a project: LLVM.
serge-sans-paille retitled this revision from "Always support masm syntax when inte dialect is active" to "Always support masm syntax when intel dialect is active".

Instead of activating masm syntax by hand, better couple this activation to the syntax dialect choice.
This also fixes https://bugzilla.redhat.com/show_bug.cgi?id=1692486.


Repository:
  rL LLVM

https://reviews.llvm.org/D59810

Files:
  lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  lib/MC/MCParser/AsmParser.cpp
  test/MC/X86/intel-syntax-2.s


Index: test/MC/X86/intel-syntax-2.s
===================================================================
--- test/MC/X86/intel-syntax-2.s
+++ test/MC/X86/intel-syntax-2.s
@@ -29,3 +29,8 @@
 // CHECK: fdivp %st, %st(1)
 fdivr
 // CHECK: fdivrp %st, %st(1)
+
+_test4:
+.intel_syntax
+// CHECK: movl $26, -4(%rsp)
+	mov	DWORD PTR [RSP - 4], 1ah
Index: lib/MC/MCParser/AsmParser.cpp
===================================================================
--- lib/MC/MCParser/AsmParser.cpp
+++ lib/MC/MCParser/AsmParser.cpp
@@ -22,6 +22,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/IR/InlineAsm.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCCodeView.h"
 #include "llvm/MC/MCContext.h"
@@ -219,6 +220,9 @@
   }
   void setAssemblerDialect(unsigned i) override {
     AssemblerDialect = i;
+    // Enable lexing Masm binary and hex integer literals in intel inline
+    // assembly.
+    getLexer().setLexMasmIntegers(i == InlineAsm::AD_Intel);
   }
 
   void Note(SMLoc L, const Twine &Msg, SMRange Range = None) override;
Index: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -153,10 +153,6 @@
                        " we don't have an asm parser for this target\n");
   Parser->setAssemblerDialect(Dialect);
   Parser->setTargetParser(*TAP.get());
-  // Enable lexing Masm binary and hex integer literals in intel inline
-  // assembly.
-  if (Dialect == InlineAsm::AD_Intel)
-    Parser->getLexer().setLexMasmIntegers(true);
 
   emitInlineAsmStart();
   // Don't implicitly switch to the text section before the asm.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59810.192250.patch
Type: text/x-patch
Size: 1770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190326/71bc5bdc/attachment.bin>


More information about the llvm-commits mailing list