[llvm] r276859 - [ARM] Set a non-conflicting comment character for assembly in MSVC mode
Renato Golin via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 27 05:31:59 PDT 2016
Author: rengolin
Date: Wed Jul 27 07:31:58 2016
New Revision: 276859
URL: http://llvm.org/viewvc/llvm-project?rev=276859&view=rev
Log:
[ARM] Set a non-conflicting comment character for assembly in MSVC mode
Currently, for ARMCOFFMCAsmInfoMicrosoft, no comment character is set, thus the
idefault, '#', is used.
The hash character doesn't work as comment character in ARM assembly, since '#'
is used for immediate values.
The comment character is set to ';', which is the comment character used by MS
armasm.exe. (The microsoft armasm.exe uses a different directive syntax than
what LLVM currently supports though, similar to ARM's armasm.)
This allows inline assembly with immediate constants to be built (and brings the
assembly output from clang -S closer to being possible to assemble).
A test is added that verifies that ';' is correctly interpreted as comments in
this mode, and verifies that assembling code that includes literal constants
with a '#' works.
Patch by Martin Storsjö.
Added:
llvm/trunk/test/MC/ARM/Windows/literals-comments.s
Modified:
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp?rev=276859&r1=276858&r2=276859&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp Wed Jul 27 07:31:58 2016
@@ -90,6 +90,7 @@ ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmI
PrivateGlobalPrefix = "$M";
PrivateLabelPrefix = "$M";
+ CommentString = ";";
}
void ARMCOFFMCAsmInfoGNU::anchor() { }
Added: llvm/trunk/test/MC/ARM/Windows/literals-comments.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/Windows/literals-comments.s?rev=276859&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/Windows/literals-comments.s (added)
+++ llvm/trunk/test/MC/ARM/Windows/literals-comments.s Wed Jul 27 07:31:58 2016
@@ -0,0 +1,13 @@
+; RUN: llvm-mc -triple armv7-windows-msvc -filetype obj -o - %s
+
+ .syntax unified
+ .thumb
+
+ .text
+
+ .global function
+ .thumb_func
+function:
+ ; this is a comment
+ mov r0, #42 ; this # was not
+ bx lr
More information about the llvm-commits
mailing list