Skip to content

Commit 2341319

Browse files
committedAug 13, 2017
[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 llvm-svn: 310797
1 parent f1af56c commit 2341319

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed
 

‎llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,17 @@ AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(const Triple &T) {
102102
}
103103

104104
AArch64MCAsmInfoCOFF::AArch64MCAsmInfoCOFF() {
105-
CommentString = ";";
106105
PrivateGlobalPrefix = ".L";
107106
PrivateLabelPrefix = ".L";
108107
AlignmentIsInBytes = false;
109108
SupportsDebugInformation = true;
110109
ExceptionsType = ExceptionHandling::WinEH;
111110
}
111+
112+
AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() {
113+
CommentString = ";";
114+
}
115+
116+
AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() {
117+
CommentString = "//";
118+
}

‎llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h

+8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ struct AArch64MCAsmInfoCOFF : public MCAsmInfoCOFF {
3838
explicit AArch64MCAsmInfoCOFF();
3939
};
4040

41+
struct AArch64MCAsmInfoMicrosoftCOFF : public AArch64MCAsmInfoCOFF {
42+
explicit AArch64MCAsmInfoMicrosoftCOFF();
43+
};
44+
45+
struct AArch64MCAsmInfoGNUCOFF : public AArch64MCAsmInfoCOFF {
46+
explicit AArch64MCAsmInfoGNUCOFF();
47+
};
48+
4149
} // namespace llvm
4250

4351
#endif

‎llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ static MCAsmInfo *createAArch64MCAsmInfo(const MCRegisterInfo &MRI,
6969
MCAsmInfo *MAI;
7070
if (TheTriple.isOSBinFormatMachO())
7171
MAI = new AArch64MCAsmInfoDarwin();
72+
else if (TheTriple.isWindowsMSVCEnvironment())
73+
MAI = new AArch64MCAsmInfoMicrosoftCOFF();
7274
else if (TheTriple.isOSBinFormatCOFF())
73-
MAI = new AArch64MCAsmInfoCOFF();
75+
MAI = new AArch64MCAsmInfoGNUCOFF();
7476
else {
7577
assert(TheTriple.isOSBinFormatELF() && "Invalid target");
7678
MAI = new AArch64MCAsmInfoELF(TheTriple);

‎llvm/test/MC/AArch64/coff-gnu.s

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: llvm-mc -triple aarch64-windows-gnu -filetype obj -o %t.obj %s
2+
// RUN: llvm-objdump -d %t.obj | FileCheck %s
3+
4+
func:
5+
// Check that the nop instruction after the semicolon also is handled
6+
nop; nop
7+
add x0, x0, #42
8+
9+
// CHECK: 0: 1f 20 03 d5 nop
10+
// CHECK: 4: 1f 20 03 d5 nop
11+
// CHECK: 8: 00 a8 00 91 add x0, x0, #42

0 commit comments

Comments
 (0)
Please sign in to comment.