[PATCH] D107251: [ARM] Allow using '; ' as asm statement separator in MSVC mode

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 2 01:26:56 PDT 2021


mstorsjo created this revision.
mstorsjo added a reviewer: rnk.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

This does the same as D96259 <https://reviews.llvm.org/D96259>, but for ARM, just like AArch64,
using the same comment char as for ELF and MinGW mode.

(I never heard back about any downstream problems from that
change, so I presume it didn't break anything.)

As the assembly input/output of LLVM is GAS style, trying to
match what MS armasm.exe does isn't needed (because the comment
char used is the least concern when it comes to that; all
directives differ too). If a separate armasm compatible mode
is implemented, it can use its own comment style (just like
llvm-ml implements MS ml.exe compatible assembly parsing).

This fixes building compiler-rt assembly files for ARM in MSVC
mode.

The updated testcase literals-comments.s was only intended to
make sure that '#' isn't interpreted as a comment char.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107251

Files:
  llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
  llvm/test/CodeGen/ARM/cfguard-checks.ll
  llvm/test/MC/ARM/Windows/literals-comments.s


Index: llvm/test/MC/ARM/Windows/literals-comments.s
===================================================================
--- llvm/test/MC/ARM/Windows/literals-comments.s
+++ llvm/test/MC/ARM/Windows/literals-comments.s
@@ -1,4 +1,4 @@
-; RUN: llvm-mc -triple armv7-windows-msvc -filetype obj -o - %s
+@ RUN: llvm-mc -triple armv7-windows-msvc -filetype obj -o - %s
 
   .syntax unified
   .thumb
@@ -8,6 +8,6 @@
   .global function
   .thumb_func
 function:
-  ; this is a comment
-  mov r0, #42 ; this # was not
+  @ this is a comment
+  mov r0, #42 @ this # was not
   bx lr
Index: llvm/test/CodeGen/ARM/cfguard-checks.ll
===================================================================
--- llvm/test/CodeGen/ARM/cfguard-checks.ll
+++ llvm/test/CodeGen/ARM/cfguard-checks.ll
@@ -101,8 +101,8 @@
 	; CHECK:       blx r1
   ; CHECK-NEXT:  $Mtmp0:
 	; CHECK-NEXT:  blx r4
-  ; CHECK:       ; %common.ret
-  ; CHECK:       ; %lpad
+  ; CHECK:       @ %common.ret
+  ; CHECK:       @ %lpad
 }
 
 declare void @h()
Index: llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
===================================================================
--- llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
+++ llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
@@ -91,7 +91,7 @@
   ExceptionsType = ExceptionHandling::WinEH;
   PrivateGlobalPrefix = "$M";
   PrivateLabelPrefix = "$M";
-  CommentString = ";";
+  CommentString = "@";
 
   // Conditional Thumb 4-byte instructions can have an implicit IT.
   MaxInstLength = 6;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107251.363392.patch
Type: text/x-patch
Size: 1512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210802/ff866748/attachment.bin>


More information about the llvm-commits mailing list