From 71c29b4cf3fb2b5610991bfbc12b8bda97d60005 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Mon, 8 Feb 2021 15:24:42 +0200 Subject: [PATCH] [AArch64] Use '//' as comment string for MSVC assembly As the actual MSVC toolset doesn't use the GAS-style assembly that Clang/LLVM produces and consumes, there's no reference for what string to use for e.g. comments when building with a MSVC triple. This frees up the use of semicolon as separator string, just like was done for GNU targets in 23413195649d0cf6f3860ae8b5fb115b35032075. (Previously, both the separator and comment strings were set to the same, a semicolon.) Compiler-rt extensively uses separator chars in its assembly, and that assembly should be buildable with clang-cl for MSVC too. Differential Revision: https://reviews.llvm.org/D96259 --- .../AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp | 2 +- llvm/test/CodeGen/AArch64/cfguard-checks.ll | 4 +- llvm/test/CodeGen/AArch64/landingpad-ifcvt.ll | 2 +- llvm/test/CodeGen/AArch64/reloc-specifiers.mir | 4 +- llvm/test/CodeGen/AArch64/seh_funclet_x1.ll | 2 +- llvm/test/CodeGen/AArch64/win64-no-uwtable.ll | 4 +- llvm/test/CodeGen/AArch64/windows-extern-weak.ll | 2 +- .../test/CodeGen/AArch64/wineh-try-catch-nobase.ll | 6 +- llvm/test/CodeGen/AArch64/wineh-try-catch.ll | 18 ++-- llvm/test/MC/AArch64/coff-relocations.s | 110 ++++++++++----------- .../MC/AArch64/{coff-gnu.s => coff-separator.s} | 2 + 11 files changed, 79 insertions(+), 77 deletions(-) rename llvm/test/MC/AArch64/{coff-gnu.s => coff-separator.s} (74%) diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp index 37c924d..68c721c 100644 --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp @@ -111,7 +111,7 @@ AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() { SupportsDebugInformation = true; CodePointerSize = 8; - CommentString = ";"; + CommentString = "//"; ExceptionsType = ExceptionHandling::WinEH; WinEHEncodingType = WinEH::EncodingType::Itanium; } diff --git a/llvm/test/CodeGen/AArch64/cfguard-checks.ll b/llvm/test/CodeGen/AArch64/cfguard-checks.ll index 66ec4b6..6dc94e2 100644 --- a/llvm/test/CodeGen/AArch64/cfguard-checks.ll +++ b/llvm/test/CodeGen/AArch64/cfguard-checks.ll @@ -96,8 +96,8 @@ lpad: ; preds = %entry ; CHECK: blr x9 ; CHECK-NEXT: .Ltmp0: ; CHECK-NEXT: blr x8 - ; CHECK: ; %invoke.cont - ; CHECK: ; %lpad + ; CHECK: // %invoke.cont + ; CHECK: // %lpad } declare void @h() diff --git a/llvm/test/CodeGen/AArch64/landingpad-ifcvt.ll b/llvm/test/CodeGen/AArch64/landingpad-ifcvt.ll index 4437970..a5497b1 100644 --- a/llvm/test/CodeGen/AArch64/landingpad-ifcvt.ll +++ b/llvm/test/CodeGen/AArch64/landingpad-ifcvt.ll @@ -1,7 +1,7 @@ ; RUN: llc < %s | FileCheck %s ; Make sure this doesn't crash (and the output is sane). -; CHECK: ; %__except.ret +; CHECK: // %__except.ret ; CHECK-NEXT: mov x0, xzr target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128" diff --git a/llvm/test/CodeGen/AArch64/reloc-specifiers.mir b/llvm/test/CodeGen/AArch64/reloc-specifiers.mir index 374a475..3c56874 100644 --- a/llvm/test/CodeGen/AArch64/reloc-specifiers.mir +++ b/llvm/test/CodeGen/AArch64/reloc-specifiers.mir @@ -11,11 +11,11 @@ body: | bb.0: ; CHECK-LABEL: bar - ; CHECK: movz x0, #:abs_g1_s:.Lfoo$frame_escape_0 ; encoding: [0bAAA00000,A,0b101AAAAA,0xd2] + ; CHECK: movz x0, #:abs_g1_s:.Lfoo$frame_escape_0 // encoding: [0bAAA00000,A,0b101AAAAA,0xd2] ; CHECK: fixup A - offset: 0, value: :abs_g1_s:.Lfoo$frame_escape_0, kind: fixup_aarch64_movw renamable $x0 = MOVZXi target-flags(aarch64-g1, aarch64-s) , 16 - ; CHECK: movk x0, #:abs_g0_nc:.Lfoo$frame_escape_0 ; encoding: [0bAAA00000,A,0b100AAAAA,0xf2] + ; CHECK: movk x0, #:abs_g0_nc:.Lfoo$frame_escape_0 // encoding: [0bAAA00000,A,0b100AAAAA,0xf2] ; CHECK: fixup A - offset: 0, value: :abs_g0_nc:.Lfoo$frame_escape_0, kind: fixup_aarch64_movw renamable $x0 = MOVKXi $x0, target-flags(aarch64-g0, aarch64-nc) , 0 ... diff --git a/llvm/test/CodeGen/AArch64/seh_funclet_x1.ll b/llvm/test/CodeGen/AArch64/seh_funclet_x1.ll index 1f52471..7f5a032 100644 --- a/llvm/test/CodeGen/AArch64/seh_funclet_x1.ll +++ b/llvm/test/CodeGen/AArch64/seh_funclet_x1.ll @@ -5,7 +5,7 @@ ; CHECK: ?dtor$3@?0?main@4HA": ; CHECK: .seh_proc "?dtor$3@?0?main@4HA" -; CHECK: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill +; CHECK: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill ; CHECK-NEXT: .seh_save_fplr_x 16 ; CHECK-NEXT: .seh_endprologue ; CHECK-NEXT: mov x29, x1 diff --git a/llvm/test/CodeGen/AArch64/win64-no-uwtable.ll b/llvm/test/CodeGen/AArch64/win64-no-uwtable.ll index f04a47c..789620a 100644 --- a/llvm/test/CodeGen/AArch64/win64-no-uwtable.ll +++ b/llvm/test/CodeGen/AArch64/win64-no-uwtable.ll @@ -13,11 +13,11 @@ define dso_local void @SEHfilter() nounwind "frame-pointer"="all" { ; CHECK-NEXT: mov x29, sp ; CHECK-NEXT: bl g ; CHECK-NEXT: cbz w19, .LBB0_2 -; CHECK-NEXT: ; %bb.1: +; CHECK-NEXT: // %bb.1: ; CHECK-NEXT: ldr x19, [sp, #16] ; CHECK-NEXT: ldp x30, x29, [sp], #32 ; CHECK-NEXT: ret -; CHECK-NEXT: .LBB0_2: ; %if.end.i +; CHECK-NEXT: .LBB0_2: // %if.end.i ; CHECK-NEXT: bl f ; CHECK-NEXT: brk #0x1 %1 = load i32, i32* undef, align 4 diff --git a/llvm/test/CodeGen/AArch64/windows-extern-weak.ll b/llvm/test/CodeGen/AArch64/windows-extern-weak.ll index 18df2dd..dbd17e3 100644 --- a/llvm/test/CodeGen/AArch64/windows-extern-weak.ll +++ b/llvm/test/CodeGen/AArch64/windows-extern-weak.ll @@ -10,7 +10,7 @@ define void @func() { ; CHECK-NEXT: adrp x8, .refptr.weakfunc ; CHECK-NEXT: ldr x8, [x8, :lo12:.refptr.weakfunc] ; CHECK-NEXT: cbz x8, .LBB0_2 -; CHECK-NEXT: ; %bb.1: +; CHECK-NEXT: // %bb.1: ; CHECK-NEXT: blr x8 ; CHECK-NEXT: .LBB0_2: ; CHECK-NEXT: .seh_startepilogue diff --git a/llvm/test/CodeGen/AArch64/wineh-try-catch-nobase.ll b/llvm/test/CodeGen/AArch64/wineh-try-catch-nobase.ll index bf1ebaa..1552a55 100644 --- a/llvm/test/CodeGen/AArch64/wineh-try-catch-nobase.ll +++ b/llvm/test/CodeGen/AArch64/wineh-try-catch-nobase.ll @@ -6,16 +6,16 @@ ; Check that we compute the address relative to fp. ; CHECK-LABEL: "?catch$2@?0??a@@YAXXZ@4HA": -; CHECK: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill +; CHECK: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill ; CHECK-NEXT: .seh_save_fplr_x 16 ; CHECK-NEXT: .seh_endprologue -; CHECK-NEXT: sub x0, x29, #16 ; =16 +; CHECK-NEXT: sub x0, x29, #16 // =16 ; CHECK-NEXT: mov x1, xzr ; CHECK-NEXT: bl "?bb@@YAXPEAHH@Z" ; CHECK-NEXT: adrp x0, .LBB0_1 ; CHECK-NEXT: add x0, x0, .LBB0_1 ; CHECK-NEXT: .seh_startepilogue -; CHECK-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload +; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload ; CHECK-NEXT: .seh_save_fplr_x 16 ; CHECK-NEXT: .seh_endepilogue ; CHECK-NEXT: ret diff --git a/llvm/test/CodeGen/AArch64/wineh-try-catch.ll b/llvm/test/CodeGen/AArch64/wineh-try-catch.ll index 8bf5aa3..7de7d60 100644 --- a/llvm/test/CodeGen/AArch64/wineh-try-catch.ll +++ b/llvm/test/CodeGen/AArch64/wineh-try-catch.ll @@ -41,7 +41,7 @@ ; CHECK-LABEL: .Ltmp0: ; CHECK: bl "?func2@@YAHXZ -; CHECK: [[CATCHRETDEST:.LBB0_[0-9]+]]: ; %catchret.dest +; CHECK: [[CATCHRETDEST:.LBB0_[0-9]+]]: // %catchret.dest ; Check the catch funclet. ; CHECK-LABEL: "?catch$2@?0??func@@YAHXZ@4HA": @@ -74,14 +74,14 @@ ; entry to func is encoded in cppxdata that is passed to __CxxFrameHandler3. As ; computed above, this comes to -16. ; CHECK-LABEL: "$cppxdata$?func@@YAHXZ": -; CHECK-NEXT: .word 429065506 ; MagicNumber -; CHECK-NEXT: .word 2 ; MaxState -; CHECK-NEXT: .word ("$stateUnwindMap$?func@@YAHXZ")@IMGREL ; UnwindMap -; CHECK-NEXT: .word 1 ; NumTryBlocks -; CHECK-NEXT: .word ("$tryMap$?func@@YAHXZ")@IMGREL ; TryBlockMap -; CHECK-NEXT: .word 4 ; IPMapEntries -; CHECK-NEXT: .word ("$ip2state$?func@@YAHXZ")@IMGREL ; IPToStateXData -; CHECK-NEXT: .word -16 ; UnwindHelp +; CHECK-NEXT: .word 429065506 // MagicNumber +; CHECK-NEXT: .word 2 // MaxState +; CHECK-NEXT: .word ("$stateUnwindMap$?func@@YAHXZ")@IMGREL // UnwindMap +; CHECK-NEXT: .word 1 // NumTryBlocks +; CHECK-NEXT: .word ("$tryMap$?func@@YAHXZ")@IMGREL // TryBlockMap +; CHECK-NEXT: .word 4 // IPMapEntries +; CHECK-NEXT: .word ("$ip2state$?func@@YAHXZ")@IMGREL // IPToStateXData +; CHECK-NEXT: .word -16 // UnwindHelp ; UNWIND: Function: ?func@@YAHXZ (0x0) ; UNWIND: Prologue [ diff --git a/llvm/test/MC/AArch64/coff-relocations.s b/llvm/test/MC/AArch64/coff-relocations.s index 54706fd..6433109 100644 --- a/llvm/test/MC/AArch64/coff-relocations.s +++ b/llvm/test/MC/AArch64/coff-relocations.s @@ -1,41 +1,41 @@ -; RUN: llvm-mc -triple aarch64-windows -filetype obj -o %t.obj %s -; RUN: llvm-readobj -r %t.obj | FileCheck %s -; RUN: llvm-objdump -d %t.obj | FileCheck %s --check-prefix=DISASM +// RUN: llvm-mc -triple aarch64-windows -filetype obj -o %t.obj %s +// RUN: llvm-readobj -r %t.obj | FileCheck %s +// RUN: llvm-objdump -d %t.obj | FileCheck %s --check-prefix=DISASM -; IMAGE_REL_ARM64_ADDR32 +// IMAGE_REL_ARM64_ADDR32 .Linfo_foo: .asciz "foo" .long foo -; IMAGE_REL_ARM64_ADDR32NB +// IMAGE_REL_ARM64_ADDR32NB .long func@IMGREL -; IMAGE_REL_ARM64_ADDR64 +// IMAGE_REL_ARM64_ADDR64 .globl struc struc: .quad arr -; IMAGE_REL_ARM64_BRANCH26 +// IMAGE_REL_ARM64_BRANCH26 b target -; IMAGE_REL_ARM64_PAGEBASE_REL21 +// IMAGE_REL_ARM64_PAGEBASE_REL21 adrp x0, foo -; IMAGE_REL_ARM64_PAGEOFFSET_12A +// IMAGE_REL_ARM64_PAGEOFFSET_12A add x0, x0, :lo12:foo -; IMAGE_REL_ARM64_PAGEOFFSET_12L +// IMAGE_REL_ARM64_PAGEOFFSET_12L ldr x0, [x0, :lo12:foo] -; IMAGE_REL_ARM64_PAGEBASE_REL21, even if the symbol offset is known +// IMAGE_REL_ARM64_PAGEBASE_REL21, even if the symbol offset is known adrp x0, bar bar: -; IMAGE_REL_ARM64_SECREL +// IMAGE_REL_ARM64_SECREL .secrel32 .Linfo_bar .Linfo_bar: -; IMAGE_REL_ARM64_SECTION +// IMAGE_REL_ARM64_SECTION .secidx func .align 2 @@ -45,55 +45,55 @@ add x0, x0, :lo12:foo + 0x12345 ldrb w0, [x0, :lo12:foo + 0x12345] ldr x0, [x0, :lo12:foo + 0x12348] -; IMAGE_REL_ARM64_SECREL_LOW12A +// IMAGE_REL_ARM64_SECREL_LOW12A add x0, x0, :secrel_lo12:foo -; IMAGE_REL_ARM64_SECREL_HIGH12A +// IMAGE_REL_ARM64_SECREL_HIGH12A add x0, x0, :secrel_hi12:foo -; IMAGE_REL_ARM64_SECREL_LOW12L +// IMAGE_REL_ARM64_SECREL_LOW12L ldr x0, [x0, :secrel_lo12:foo] -; IMAGE_REL_ARM64_REL21 +// IMAGE_REL_ARM64_REL21 adr x0, foo + 0x12345 -; IMAGE_REL_ARM64_BRANCH19 +// IMAGE_REL_ARM64_BRANCH19 bne target -; IMAGE_REL_ARM64_BRANCH14 +// IMAGE_REL_ARM64_BRANCH14 tbz x0, #0, target -; CHECK: Format: COFF-ARM64 -; CHECK: Arch: aarch64 -; CHECK: AddressSize: 64bit -; CHECK: Relocations [ -; CHECK: Section (1) .text { -; CHECK: 0x4 IMAGE_REL_ARM64_ADDR32 foo -; CHECK: 0x8 IMAGE_REL_ARM64_ADDR32NB func -; CHECK: 0xC IMAGE_REL_ARM64_ADDR64 arr -; CHECK: 0x14 IMAGE_REL_ARM64_BRANCH26 target -; CHECK: 0x18 IMAGE_REL_ARM64_PAGEBASE_REL21 foo -; CHECK: 0x1C IMAGE_REL_ARM64_PAGEOFFSET_12A foo -; CHECK: 0x20 IMAGE_REL_ARM64_PAGEOFFSET_12L foo -; CHECK: 0x24 IMAGE_REL_ARM64_PAGEBASE_REL21 bar -; CHECK: 0x28 IMAGE_REL_ARM64_SECREL .text -; CHECK: 0x2C IMAGE_REL_ARM64_SECTION func -; CHECK: 0x30 IMAGE_REL_ARM64_PAGEBASE_REL21 baz -; CHECK: 0x34 IMAGE_REL_ARM64_PAGEOFFSET_12A foo -; CHECK: 0x38 IMAGE_REL_ARM64_PAGEOFFSET_12L foo -; CHECK: 0x3C IMAGE_REL_ARM64_PAGEOFFSET_12L foo -; CHECK: 0x40 IMAGE_REL_ARM64_SECREL_LOW12A foo -; CHECK: 0x44 IMAGE_REL_ARM64_SECREL_HIGH12A foo -; CHECK: 0x48 IMAGE_REL_ARM64_SECREL_LOW12L foo -; CHECK: 0x4C IMAGE_REL_ARM64_REL21 foo -; CHECK: 0x50 IMAGE_REL_ARM64_BRANCH19 target -; CHECK: 0x54 IMAGE_REL_ARM64_BRANCH14 target -; CHECK: } -; CHECK: ] - -; DISASM: 30: 20 1a 09 b0 adrp x0, 0x12345000 -; DISASM: 34: 00 14 0d 91 add x0, x0, #837 -; DISASM: 38: 00 14 4d 39 ldrb w0, [x0, #837] -; DISASM: 3c: 00 a4 41 f9 ldr x0, [x0, #840] -; DISASM: 40: 00 00 00 91 add x0, x0, #0 -; DISASM: 44: 00 00 40 91 add x0, x0, #0, lsl #12 -; DISASM: 48: 00 00 40 f9 ldr x0, [x0] -; DISASM: 4c: 20 1a 09 30 adr x0, #74565 +// CHECK: Format: COFF-ARM64 +// CHECK: Arch: aarch64 +// CHECK: AddressSize: 64bit +// CHECK: Relocations [ +// CHECK: Section (1) .text { +// CHECK: 0x4 IMAGE_REL_ARM64_ADDR32 foo +// CHECK: 0x8 IMAGE_REL_ARM64_ADDR32NB func +// CHECK: 0xC IMAGE_REL_ARM64_ADDR64 arr +// CHECK: 0x14 IMAGE_REL_ARM64_BRANCH26 target +// CHECK: 0x18 IMAGE_REL_ARM64_PAGEBASE_REL21 foo +// CHECK: 0x1C IMAGE_REL_ARM64_PAGEOFFSET_12A foo +// CHECK: 0x20 IMAGE_REL_ARM64_PAGEOFFSET_12L foo +// CHECK: 0x24 IMAGE_REL_ARM64_PAGEBASE_REL21 bar +// CHECK: 0x28 IMAGE_REL_ARM64_SECREL .text +// CHECK: 0x2C IMAGE_REL_ARM64_SECTION func +// CHECK: 0x30 IMAGE_REL_ARM64_PAGEBASE_REL21 baz +// CHECK: 0x34 IMAGE_REL_ARM64_PAGEOFFSET_12A foo +// CHECK: 0x38 IMAGE_REL_ARM64_PAGEOFFSET_12L foo +// CHECK: 0x3C IMAGE_REL_ARM64_PAGEOFFSET_12L foo +// CHECK: 0x40 IMAGE_REL_ARM64_SECREL_LOW12A foo +// CHECK: 0x44 IMAGE_REL_ARM64_SECREL_HIGH12A foo +// CHECK: 0x48 IMAGE_REL_ARM64_SECREL_LOW12L foo +// CHECK: 0x4C IMAGE_REL_ARM64_REL21 foo +// CHECK: 0x50 IMAGE_REL_ARM64_BRANCH19 target +// CHECK: 0x54 IMAGE_REL_ARM64_BRANCH14 target +// CHECK: } +// CHECK: ] + +// DISASM: 30: 20 1a 09 b0 adrp x0, 0x12345000 +// DISASM: 34: 00 14 0d 91 add x0, x0, #837 +// DISASM: 38: 00 14 4d 39 ldrb w0, [x0, #837] +// DISASM: 3c: 00 a4 41 f9 ldr x0, [x0, #840] +// DISASM: 40: 00 00 00 91 add x0, x0, #0 +// DISASM: 44: 00 00 40 91 add x0, x0, #0, lsl #12 +// DISASM: 48: 00 00 40 f9 ldr x0, [x0] +// DISASM: 4c: 20 1a 09 30 adr x0, #74565 diff --git a/llvm/test/MC/AArch64/coff-gnu.s b/llvm/test/MC/AArch64/coff-separator.s similarity index 74% rename from llvm/test/MC/AArch64/coff-gnu.s rename to llvm/test/MC/AArch64/coff-separator.s index df0dc7d..7535cf0 100644 --- a/llvm/test/MC/AArch64/coff-gnu.s +++ b/llvm/test/MC/AArch64/coff-separator.s @@ -1,5 +1,7 @@ // RUN: llvm-mc -triple aarch64-windows-gnu -filetype obj -o %t.obj %s // RUN: llvm-objdump -d %t.obj | FileCheck %s +// RUN: llvm-mc -triple aarch64-windows-msvc -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 -- 2.7.4