[PATCH] D36366: [COFF, ARM64] Use '//' as comment character in assembly files in GNU environments

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 6 04:06:24 PDT 2017


mstorsjo updated this revision to Diff 109913.
mstorsjo retitled this revision from "[COFF, ARM64] Use '//' as comment character in assembly files" to "[COFF, ARM64] Use '//' as comment character in assembly files in GNU environments".
mstorsjo added a comment.

Limited the change to GNU environments.


https://reviews.llvm.org/D36366

Files:
  lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
  lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h
  lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
  test/MC/AArch64/coff-gnu.s


Index: test/MC/AArch64/coff-gnu.s
===================================================================
--- /dev/null
+++ test/MC/AArch64/coff-gnu.s
@@ -0,0 +1,11 @@
+// RUN: llvm-mc -triple aarch64-windows-gnu -filetype obj -o %t.obj %s
+// RUN: llvm-objdump -d %t.obj | FileCheck %s
+
+func:
+// Check that the nop instruction after the semicolon also is handled
+nop; nop
+add x0, x0, #42
+
+// CHECK:  0:       1f 20 03 d5     nop
+// CHECK:  4:       1f 20 03 d5     nop
+// CHECK:  8:       00 a8 00 91     add x0, x0, #42
Index: lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
===================================================================
--- lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
+++ lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
@@ -69,6 +69,8 @@
   MCAsmInfo *MAI;
   if (TheTriple.isOSBinFormatMachO())
     MAI = new AArch64MCAsmInfoDarwin();
+  else if (TheTriple.isOSBinFormatCOFF() && TheTriple.isGNUEnvironment())
+    MAI = new AArch64MCAsmInfoCOFFGNU();
   else if (TheTriple.isOSBinFormatCOFF())
     MAI = new AArch64MCAsmInfoCOFF();
   else {
Index: lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h
===================================================================
--- lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h
+++ lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h
@@ -38,6 +38,10 @@
   explicit AArch64MCAsmInfoCOFF();
 };
 
+struct AArch64MCAsmInfoCOFFGNU : public AArch64MCAsmInfoCOFF {
+  explicit AArch64MCAsmInfoCOFFGNU();
+};
+
 } // namespace llvm
 
 #endif
Index: lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
===================================================================
--- lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
+++ lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
@@ -109,3 +109,7 @@
   SupportsDebugInformation = true;
   ExceptionsType = ExceptionHandling::WinEH;
 }
+
+AArch64MCAsmInfoCOFFGNU::AArch64MCAsmInfoCOFFGNU() {
+  CommentString = "//";
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36366.109913.patch
Type: text/x-patch
Size: 1972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170806/a16e8a28/attachment.bin>


More information about the llvm-commits mailing list