Commit f820da5e by Jan Voung

Emit .local before .comm for bss to make llvm-mc happy.

Otherwise llvm-mc asserts. This is also the order that llc emits the directives. Change a couple of RUIN -> RUN in lit tests. BUG=none R=stichnot@chromium.org Review URL: https://codereview.chromium.org/469973002
parent c8e87812
......@@ -4207,8 +4207,8 @@ void TargetGlobalInitX8632::lower(const IceString &Name, SizeT Align,
// zeroinitializer (non-constant):
// (.section or .data as above)
// .comm NAME, SIZE, ALIGN
// .local NAME
// .comm NAME, SIZE, ALIGN
IceString MangledName = Ctx->mangleName(Name);
// Start a new section.
......@@ -4218,6 +4218,8 @@ void TargetGlobalInitX8632::lower(const IceString &Name, SizeT Align,
Str << "\t.type\t" << MangledName << ",@object\n";
Str << "\t.data\n";
}
Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName
<< "\n";
if (IsZeroInitializer) {
if (IsConst) {
Str << "\t.align\t" << Align << "\n";
......@@ -4238,8 +4240,6 @@ void TargetGlobalInitX8632::lower(const IceString &Name, SizeT Align,
}
Str << "\t.size\t" << MangledName << ", " << Size << "\n";
}
Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName
<< "\n";
}
} // end of namespace Ice
......@@ -2,10 +2,10 @@
; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
; RUIN: %llvm2ice -O2 --verbose none %s \
; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUIN: %llvm2ice -Om1 --verbose none %s \
; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice -O2 --verbose none %s \
; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice -Om1 --verbose none %s \
; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
......
; Test of global initializers.
; RUN: %llvm2ice --verbose inst %s | FileCheck %s
; RUIN: %llvm2ice --verbose none %s \
; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice --verbose none %s \
; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
@PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4
; CHECK: .data
; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: PrimitiveInit:
; CHECK-NEXT: .byte
......@@ -15,6 +16,7 @@
@PrimitiveInitConst = internal constant [4 x i8] c"\0D\00\00\00", align 4
; CHECK: .section .rodata,"a",@progbits
; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: PrimitiveInitConst:
; CHECK-NEXT: .byte
......@@ -22,6 +24,7 @@
@ArrayInit = internal global [20 x i8] c"\0A\00\00\00\14\00\00\00\1E\00\00\00(\00\00\002\00\00\00", align 4
; CHECK: .data
; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: ArrayInit:
; CHECK-NEXT: .byte
......@@ -29,6 +32,7 @@
@ArrayInitPartial = internal global [40 x i8] c"<\00\00\00F\00\00\00P\00\00\00Z\00\00\00d\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", align 4
; CHECK: .data
; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: ArrayInitPartial:
; CHECK-NEXT: .byte
......@@ -36,21 +40,22 @@
@PrimitiveInitStatic = internal global [4 x i8] zeroinitializer, align 4
; CHECK: .data
; CHECK-NEXT: .comm PrimitiveInitStatic, 4, 4
; CHECK-NEXT: .local PrimitiveInitStatic
; CHECK-NEXT: .comm PrimitiveInitStatic, 4, 4
@PrimitiveUninit = internal global [4 x i8] zeroinitializer, align 4
; CHECK: .data
; CHECK-NEXT: .comm PrimitiveUninit, 4, 4
; CHECK-NEXT: .local PrimitiveUninit
; CHECK-NEXT: .comm PrimitiveUninit, 4, 4
@ArrayUninit = internal global [20 x i8] zeroinitializer, align 4
; CHECK: .data
; CHECK-NEXT: .comm ArrayUninit, 20, 4
; CHECK-NEXT: .local ArrayUninit
; CHECK-NEXT: .comm ArrayUninit, 20, 4
@ArrayUninitConstDouble = internal constant [200 x i8] zeroinitializer, align 8
; CHECK: .section .rodata,"a",@progbits
; CHECK-NEXT: .local
; CHECK-NEXT: .align 8
; CHECK-NEXT: ArrayUninitConstDouble:
; CHECK-NEXT: .zero 200
......@@ -58,6 +63,7 @@
@ArrayUninitConstInt = internal constant [20 x i8] zeroinitializer, align 4
; CHECK: .section .rodata,"a",@progbits
; CHECK-NEXT: .local
; CHECK-NEXT: .align 4
; CHECK-NEXT: ArrayUninitConstInt:
; CHECK-NEXT: .zero 20
......
......@@ -4,8 +4,8 @@
; applies to atomic load/stores).
;
; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
; RUIN: %llvm2ice -O2 --verbose none %s \
; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice -O2 --verbose none %s \
; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
declare void @llvm.nacl.atomic.fence.all()
declare i32 @llvm.nacl.atomic.load.i32(i32*, i32)
......
......@@ -3,10 +3,10 @@
; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
; RUIN: %llvm2ice -O2 --verbose none %s \
; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUIN: %llvm2ice -Om1 --verbose none %s \
; RUIN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice -O2 --verbose none %s \
; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice -Om1 --verbose none %s \
; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment