[llvm] 039b469 - [ARM] Allow using '; ' as asm statement separator in MSVC mode

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 24 01:02:18 PDT 2021


Author: Martin Storsjö
Date: 2021-08-24T11:01:49+03:00
New Revision: 039b469b85814ba14bee224785f19527cc25ecf1

URL: https://github.com/llvm/llvm-project/commit/039b469b85814ba14bee224785f19527cc25ecf1
DIFF: https://github.com/llvm/llvm-project/commit/039b469b85814ba14bee224785f19527cc25ecf1.diff

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

This does the same as D96259, but for ARM, just like AArch64,
using the same comment char as for ELF and MinGW mode.

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.

Differential Revision: https://reviews.llvm.org/D107251

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
index 40e8e244e312e..77c0e3522911a 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
@@ -91,7 +91,7 @@ ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
   ExceptionsType = ExceptionHandling::WinEH;
   PrivateGlobalPrefix = "$M";
   PrivateLabelPrefix = "$M";
-  CommentString = ";";
+  CommentString = "@";
 
   // Conditional Thumb 4-byte instructions can have an implicit IT.
   MaxInstLength = 6;

diff  --git a/llvm/test/CodeGen/ARM/cfguard-checks.ll b/llvm/test/CodeGen/ARM/cfguard-checks.ll
index a601d979dc35e..17928f0b8378e 100644
--- a/llvm/test/CodeGen/ARM/cfguard-checks.ll
+++ b/llvm/test/CodeGen/ARM/cfguard-checks.ll
@@ -101,8 +101,8 @@ lpad:                                             ; preds = %entry
 	; CHECK:       blx r1
   ; CHECK-NEXT:  $Mtmp0:
 	; CHECK-NEXT:  blx r4
-  ; CHECK:       ; %common.ret
-  ; CHECK:       ; %lpad
+  ; CHECK:       @ %common.ret
+  ; CHECK:       @ %lpad
 }
 
 declare void @h()

diff  --git a/llvm/test/MC/ARM/Windows/literals-comments.s b/llvm/test/MC/ARM/Windows/literals-comments.s
index be988742dbab4..031fa9750cb05 100644
--- a/llvm/test/MC/ARM/Windows/literals-comments.s
+++ b/llvm/test/MC/ARM/Windows/literals-comments.s
@@ -1,4 +1,7 @@
-; RUN: llvm-mc -triple armv7-windows-msvc -filetype obj -o - %s
+@ RUN: llvm-mc -triple armv7-windows-gnu -filetype obj -o %t.obj %s
+@ RUN: llvm-objdump -d %t.obj | FileCheck %s
+@ RUN: llvm-mc -triple armv7-windows-msvc -filetype obj -o %t.obj %s
+@ RUN: llvm-objdump -d %t.obj | FileCheck %s
 
   .syntax unified
   .thumb
@@ -8,6 +11,12 @@
   .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
+  nop; nop @ This retains both instructions
   bx lr
+
+@ CHECK:  0: 4f f0 2a 00   mov.w   r0, #42
+@ CHECK:  4: 00 bf         nop
+@ CHECK:  6: 00 bf         nop
+@ CHECK:  8: 70 47         bx      lr


        


More information about the llvm-commits mailing list