From 4d3b657b4e3cafd8ce186c142d18882d94e8bed6 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 23 Jan 2018 23:03:47 +0000 Subject: [PATCH] [WebAssembly] MC: Use inline triple in test bitcode files This matches the CodeGen tests and makes it a little easy to run these from the command line manually. Differential Revision: https://reviews.llvm.org/D42440 llvm-svn: 323275 --- test/MC/WebAssembly/bss.ll | 4 +++- test/MC/WebAssembly/comdat.ll | 4 +++- test/MC/WebAssembly/custom-code-section.ll | 4 +++- test/MC/WebAssembly/debug-info.ll | 4 +++- test/MC/WebAssembly/explicit-sections.ll | 4 +++- test/MC/WebAssembly/external-data.ll | 5 ++++- test/MC/WebAssembly/external-func-address.ll | 5 ++++- test/MC/WebAssembly/func-address.ll | 4 +++- test/MC/WebAssembly/global-ctor-dtor.ll | 4 +++- test/MC/WebAssembly/reloc-code.ll | 4 +++- test/MC/WebAssembly/reloc-data.ll | 5 ++++- test/MC/WebAssembly/sections.ll | 5 +++-- test/MC/WebAssembly/stack-ptr.ll | 4 +++- test/MC/WebAssembly/unnamed-data.ll | 4 +++- test/MC/WebAssembly/visibility.ll | 4 +++- test/MC/WebAssembly/weak-alias.ll | 4 +++- test/MC/WebAssembly/weak.ll | 4 +++- 17 files changed, 54 insertions(+), 18 deletions(-) diff --git a/test/MC/WebAssembly/bss.ll b/test/MC/WebAssembly/bss.ll index b9b868a2fd4..ce1ae5abf05 100644 --- a/test/MC/WebAssembly/bss.ll +++ b/test/MC/WebAssembly/bss.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" @g0 = global i8* null, align 4 @g1 = global i32 0, align 4 diff --git a/test/MC/WebAssembly/comdat.ll b/test/MC/WebAssembly/comdat.ll index ba5d57d24d3..db30aeac837 100644 --- a/test/MC/WebAssembly/comdat.ll +++ b/test/MC/WebAssembly/comdat.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" ; Import a function just so we can check the index arithmetic for ; WASM_COMDAT_FUNCTION entries is performed correctly diff --git a/test/MC/WebAssembly/custom-code-section.ll b/test/MC/WebAssembly/custom-code-section.ll index d528d426e5b..7d0a5bede8c 100644 --- a/test/MC/WebAssembly/custom-code-section.ll +++ b/test/MC/WebAssembly/custom-code-section.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -O2 -filetype=obj %s -o %t.o +; RUN: llc -O2 -filetype=obj %s -o %t.o + +target triple = "wasm32-unknown-unknown-wasm" ; Wasm silently ignores custom sections for code. ; We had a bug where this cause a crash diff --git a/test/MC/WebAssembly/debug-info.ll b/test/MC/WebAssembly/debug-info.ll index 9318402836d..9d8ce20b565 100644 --- a/test/MC/WebAssembly/debug-info.ll +++ b/test/MC/WebAssembly/debug-info.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | llvm-readobj -r -s -expand-relocs +; RUN: llc -filetype=obj %s -o - | llvm-readobj -r -s -expand-relocs + +target triple = "wasm32-unknown-unknown-wasm" ; Debug information is currently not supported. This test simply verifies that ; a valid object generated. diff --git a/test/MC/WebAssembly/explicit-sections.ll b/test/MC/WebAssembly/explicit-sections.ll index 91f2f7bd28c..b190c1f7c6a 100644 --- a/test/MC/WebAssembly/explicit-sections.ll +++ b/test/MC/WebAssembly/explicit-sections.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" %struct.bd = type { i32, i8 } diff --git a/test/MC/WebAssembly/external-data.ll b/test/MC/WebAssembly/external-data.ll index 73bb915b5fc..c67a77b183d 100644 --- a/test/MC/WebAssembly/external-data.ll +++ b/test/MC/WebAssembly/external-data.ll @@ -1,4 +1,7 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" + ; Verify relocations are correctly generated for addresses of externals ; in the data section. diff --git a/test/MC/WebAssembly/external-func-address.ll b/test/MC/WebAssembly/external-func-address.ll index 2918152fb3a..940f54cb077 100644 --- a/test/MC/WebAssembly/external-func-address.ll +++ b/test/MC/WebAssembly/external-func-address.ll @@ -1,4 +1,7 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" + ; Verify that addresses of external functions generate correctly typed ; imports and relocations or type R_TABLE_INDEX_I32. diff --git a/test/MC/WebAssembly/func-address.ll b/test/MC/WebAssembly/func-address.ll index 39a968b15e0..4c0cc28c5cd 100644 --- a/test/MC/WebAssembly/func-address.ll +++ b/test/MC/WebAssembly/func-address.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -O2 -filetype=obj %s -o - | llvm-readobj -r -s -expand-relocs | FileCheck %s +; RUN: llc -O2 -filetype=obj %s -o - | llvm-readobj -r -s -expand-relocs | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" declare i32 @import1() declare i32 @import2() diff --git a/test/MC/WebAssembly/global-ctor-dtor.ll b/test/MC/WebAssembly/global-ctor-dtor.ll index 7fc9c9cefb1..6724911959f 100644 --- a/test/MC/WebAssembly/global-ctor-dtor.ll +++ b/test/MC/WebAssembly/global-ctor-dtor.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" @global1 = global i32 1025, align 8 diff --git a/test/MC/WebAssembly/reloc-code.ll b/test/MC/WebAssembly/reloc-code.ll index e9aff890cff..757a733d963 100644 --- a/test/MC/WebAssembly/reloc-code.ll +++ b/test/MC/WebAssembly/reloc-code.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | llvm-readobj -r -expand-relocs | FileCheck %s +; RUN: llc -filetype=obj %s -o - | llvm-readobj -r -expand-relocs | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" ; Pointers to functions of two different types @a = global i64 ()* inttoptr (i64 5 to i64 ()*), align 8 diff --git a/test/MC/WebAssembly/reloc-data.ll b/test/MC/WebAssembly/reloc-data.ll index ca78d8b158f..4debf091eee 100644 --- a/test/MC/WebAssembly/reloc-data.ll +++ b/test/MC/WebAssembly/reloc-data.ll @@ -1,7 +1,10 @@ -; RUN: llc -O0 -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | llvm-readobj -r -expand-relocs | FileCheck %s +; RUN: llc -O0 -filetype=obj %s -o - | llvm-readobj -r -expand-relocs | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" ; foo and bar are external and internal symbols. a and b are pointers ; initialized to these locations offset by 2 and -2 elements respecitively. + @foo = external global i32, align 4 @bar = global i64 7, align 4 @a = global i32* getelementptr (i32, i32* @foo, i32 2), align 8 diff --git a/test/MC/WebAssembly/sections.ll b/test/MC/WebAssembly/sections.ll index c2f66bd1178..fa38555bcf6 100644 --- a/test/MC/WebAssembly/sections.ll +++ b/test/MC/WebAssembly/sections.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | llvm-readobj -s | FileCheck %s +; RUN: llc -filetype=obj %s -o - | llvm-readobj -s | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" ; external function declare i32 @a() @@ -13,7 +15,6 @@ entry: ret i32 %tmp1 } - ; CHECK: Format: WASM ; CHECK: Arch: wasm32 ; CHECK: AddressSize: 32bit diff --git a/test/MC/WebAssembly/stack-ptr.ll b/test/MC/WebAssembly/stack-ptr.ll index 585d906790e..1592e8f6d4a 100644 --- a/test/MC/WebAssembly/stack-ptr.ll +++ b/test/MC/WebAssembly/stack-ptr.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" ; Function that uses explict stack, and should generate a reference to ; __stack_pointer, along with the corresponding reloction entry. diff --git a/test/MC/WebAssembly/unnamed-data.ll b/test/MC/WebAssembly/unnamed-data.ll index 27d4a587fba..cc924648fd0 100644 --- a/test/MC/WebAssembly/unnamed-data.ll +++ b/test/MC/WebAssembly/unnamed-data.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" @.str1 = private unnamed_addr constant [6 x i8] c"hello\00", align 1 @.str2 = private unnamed_addr constant [6 x i8] c"world\00", align 1 diff --git a/test/MC/WebAssembly/visibility.ll b/test/MC/WebAssembly/visibility.ll index 83c5a33d3f0..8c26ef05f0d 100644 --- a/test/MC/WebAssembly/visibility.ll +++ b/test/MC/WebAssembly/visibility.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" ; Function with __attribute__((visibility("default"))) define void @defaultVis() #0 { diff --git a/test/MC/WebAssembly/weak-alias.ll b/test/MC/WebAssembly/weak-alias.ll index 82431d5468d..2d2415991a0 100644 --- a/test/MC/WebAssembly/weak-alias.ll +++ b/test/MC/WebAssembly/weak-alias.ll @@ -1,7 +1,9 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o %t.o +; RUN: llc -filetype=obj %s -o %t.o ; RUN: obj2yaml %t.o | FileCheck %s ; RUN: llvm-objdump -t %t.o | FileCheck --check-prefix=CHECK-SYMS %s +target triple = "wasm32-unknown-unknown-wasm" + ; 'foo_alias()' is weak alias of function 'foo()' ; 'bar_alias' is weak alias of global variable 'bar' ; Generates two exports of the same function, one of them weak diff --git a/test/MC/WebAssembly/weak.ll b/test/MC/WebAssembly/weak.ll index bcffc512077..e23f3ccf68c 100644 --- a/test/MC/WebAssembly/weak.ll +++ b/test/MC/WebAssembly/weak.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" ; Weak external data reference @weak_external_data = extern_weak global i32, align 4