[llvm] r310797 - [COFF, ARM64] Use '//' as comment character in assembly files in GNU environments
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 13 12:42:05 PDT 2017
Author: mstorsjo
Date: Sun Aug 13 12:42:05 2017
New Revision: 310797
URL: http://llvm.org/viewvc/llvm-project?rev=310797&view=rev
Log:
[COFF, ARM64] Use '//' as comment character in assembly files in GNU environments
This allows using semicolons for bundling up more than one
statement per line. This is used within the mingw-w64 project in some
assembly files that contain code for multiple architectures.
Differential Revision: https://reviews.llvm.org/D36366
Added:
llvm/trunk/test/MC/AArch64/coff-gnu.s
Modified:
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp?rev=310797&r1=310796&r2=310797&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp Sun Aug 13 12:42:05 2017
@@ -102,10 +102,17 @@ AArch64MCAsmInfoELF::AArch64MCAsmInfoELF
}
AArch64MCAsmInfoCOFF::AArch64MCAsmInfoCOFF() {
- CommentString = ";";
PrivateGlobalPrefix = ".L";
PrivateLabelPrefix = ".L";
AlignmentIsInBytes = false;
SupportsDebugInformation = true;
ExceptionsType = ExceptionHandling::WinEH;
}
+
+AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() {
+ CommentString = ";";
+}
+
+AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() {
+ CommentString = "//";
+}
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h?rev=310797&r1=310796&r2=310797&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h Sun Aug 13 12:42:05 2017
@@ -38,6 +38,14 @@ struct AArch64MCAsmInfoCOFF : public MCA
explicit AArch64MCAsmInfoCOFF();
};
+struct AArch64MCAsmInfoMicrosoftCOFF : public AArch64MCAsmInfoCOFF {
+ explicit AArch64MCAsmInfoMicrosoftCOFF();
+};
+
+struct AArch64MCAsmInfoGNUCOFF : public AArch64MCAsmInfoCOFF {
+ explicit AArch64MCAsmInfoGNUCOFF();
+};
+
} // namespace llvm
#endif
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp?rev=310797&r1=310796&r2=310797&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp Sun Aug 13 12:42:05 2017
@@ -69,8 +69,10 @@ static MCAsmInfo *createAArch64MCAsmInfo
MCAsmInfo *MAI;
if (TheTriple.isOSBinFormatMachO())
MAI = new AArch64MCAsmInfoDarwin();
+ else if (TheTriple.isWindowsMSVCEnvironment())
+ MAI = new AArch64MCAsmInfoMicrosoftCOFF();
else if (TheTriple.isOSBinFormatCOFF())
- MAI = new AArch64MCAsmInfoCOFF();
+ MAI = new AArch64MCAsmInfoGNUCOFF();
else {
assert(TheTriple.isOSBinFormatELF() && "Invalid target");
MAI = new AArch64MCAsmInfoELF(TheTriple);
Added: llvm/trunk/test/MC/AArch64/coff-gnu.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/coff-gnu.s?rev=310797&view=auto
==============================================================================
--- llvm/trunk/test/MC/AArch64/coff-gnu.s (added)
+++ llvm/trunk/test/MC/AArch64/coff-gnu.s Sun Aug 13 12:42:05 2017
@@ -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
More information about the llvm-commits
mailing list