[PATCH] D82862: [ThinLTO] Always parse module level inline asm with At&t dialect

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 01:03:04 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa8e582c8307b: [ThinLTO] Always parse module level inline asm with At&t dialect (PR46503) (authored by hans).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82862

Files:
  clang/test/CodeGen/thinlto-inline-asm.c
  llvm/lib/Object/ModuleSymbolTable.cpp


Index: llvm/lib/Object/ModuleSymbolTable.cpp
===================================================================
--- llvm/lib/Object/ModuleSymbolTable.cpp
+++ llvm/lib/Object/ModuleSymbolTable.cpp
@@ -23,6 +23,7 @@
 #include "llvm/IR/GlobalAlias.h"
 #include "llvm/IR/GlobalValue.h"
 #include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/InlineAsm.h"
 #include "llvm/IR/Module.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
@@ -116,6 +117,10 @@
   if (!TAP)
     return;
 
+  // Module-level inline asm is assumed to use At&t syntax (see
+  // AsmPrinter::doInitialization()).
+  Parser->setAssemblerDialect(InlineAsm::AD_ATT);
+
   Parser->setTargetParser(*TAP);
   if (Parser->Run(false))
     return;
Index: clang/test/CodeGen/thinlto-inline-asm.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/thinlto-inline-asm.c
@@ -0,0 +1,21 @@
+// REQUIRES: x86-registered-target
+
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc19.11.0 -emit-llvm-bc \
+// RUN:   -flto=thin -mllvm -x86-asm-syntax=intel -v \
+// RUN:   -o %t.obj %s 2>&1 | FileCheck --check-prefix=CLANG %s
+//
+// RUN: llvm-lto2 dump-symtab %t.obj | FileCheck --check-prefix=SYMTAB %s
+
+// Module-level inline asm is parsed with At&t syntax. Test that the
+// -x86-asm-syntax flag does not affect this.
+
+// CLANG-NOT: unknown token in expression
+// SYMTAB: D------X foo
+// SYMTAB: D------X bar
+
+void foo() {}
+
+asm(".globl bar      \n"
+    "bar:            \n"
+    "  xor %eax, %eax\n"
+    "  ret           \n");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82862.274709.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200701/b4d3a226/attachment.bin>


More information about the llvm-commits mailing list