[WebAssembly] Remove uses of ThreadModel
Summary:
In the clang UI, replaces -mthread-model posix with -matomics as the
source of truth on threading. In the backend, replaces
-thread-model=posix with the atomics target feature, which is now
collected on the WebAssemblyTargetMachine along with all other used
features. These collected features will also be used to emit the
target features section in the future.
The default configuration for the backend is thread-model=posix and no
atomics, which was previously an invalid configuration. This change
makes the default valid because the thread model is ignored.
A side effect of this change is that objects are never emitted with
passive segments. It will instead be up to the linker to decide
whether sections should be active or passive based on whether atomics
are used in the final link.
Reviewers: aheejin, sbc100, dschuff
Subscribers: mehdi_amini, jgravelle-google, hiraditya, sunfish, steven_wu, dexonsmith, rupprecht, jfb, jdoerfert, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D58742
llvm-svn: 355112
2019-02-28 19:39:08 +01:00
|
|
|
; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s
|
2018-01-24 00:03:47 +01:00
|
|
|
|
2018-05-10 19:49:11 +02:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
2018-01-10 00:43:14 +01:00
|
|
|
|
|
|
|
; Import a function just so we can check the index arithmetic for
|
|
|
|
; WASM_COMDAT_FUNCTION entries is performed correctly
|
|
|
|
declare i32 @funcImport()
|
|
|
|
define i32 @callImport() {
|
|
|
|
entry:
|
|
|
|
%call = call i32 @funcImport()
|
|
|
|
ret i32 %call
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function in its own COMDAT
|
|
|
|
$basicInlineFn = comdat any
|
|
|
|
define linkonce_odr i32 @basicInlineFn() #1 comdat {
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
; Global, data, and function in same COMDAT
|
|
|
|
$sharedComdat = comdat any
|
|
|
|
@constantData = weak_odr constant [3 x i8] c"abc", comdat($sharedComdat)
|
|
|
|
define linkonce_odr i32 @sharedFn() #1 comdat($sharedComdat) {
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2019-03-06 03:00:22 +01:00
|
|
|
; CHECK: Sections:
|
2018-01-11 21:35:17 +01:00
|
|
|
; CHECK-NEXT: - Type: TYPE
|
2019-03-06 03:00:22 +01:00
|
|
|
; CHECK-NEXT: Signatures:
|
2018-01-11 21:35:17 +01:00
|
|
|
; CHECK-NEXT: - Index: 0
|
2019-10-18 22:27:30 +02:00
|
|
|
; CHECK-NEXT: ParamTypes: []
|
|
|
|
; CHECK-NEXT: ReturnTypes:
|
|
|
|
; CHECK-NEXT: - I32
|
2018-01-11 21:35:17 +01:00
|
|
|
; CHECK-NEXT: - Type: IMPORT
|
2019-03-06 03:00:22 +01:00
|
|
|
; CHECK-NEXT: Imports:
|
2018-01-11 21:35:17 +01:00
|
|
|
; CHECK-NEXT: - Module: env
|
|
|
|
; CHECK-NEXT: Field: __linear_memory
|
|
|
|
; CHECK-NEXT: Kind: MEMORY
|
2019-03-06 03:00:22 +01:00
|
|
|
; CHECK-NEXT: Memory:
|
2018-01-11 21:35:17 +01:00
|
|
|
; CHECK-NEXT: Initial: 0x00000001
|
|
|
|
; CHECK-NEXT: - Module: env
|
|
|
|
; CHECK-NEXT: Field: __indirect_function_table
|
|
|
|
; CHECK-NEXT: Kind: TABLE
|
2019-03-06 03:00:22 +01:00
|
|
|
; CHECK-NEXT: Table:
|
2019-01-08 07:25:55 +01:00
|
|
|
; CHECK-NEXT: ElemType: FUNCREF
|
2019-03-06 03:00:22 +01:00
|
|
|
; CHECK-NEXT: Limits:
|
2018-01-11 21:35:17 +01:00
|
|
|
; CHECK-NEXT: Initial: 0x00000000
|
|
|
|
; CHECK-NEXT: - Module: env
|
|
|
|
; CHECK-NEXT: Field: funcImport
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: SigIndex: 0
|
|
|
|
; CHECK-NEXT: - Type: FUNCTION
|
|
|
|
; CHECK-NEXT: FunctionTypes: [ 0, 0, 0 ]
|
2019-04-13 00:27:48 +02:00
|
|
|
; CHECK-NEXT: - Type: DATACOUNT
|
|
|
|
; CHECK-NEXT: Count: 1
|
2018-01-10 00:43:14 +01:00
|
|
|
; CHECK-NEXT: - Type: CODE
|
|
|
|
; CHECK-NEXT: Relocations:
|
2019-02-04 18:28:46 +01:00
|
|
|
; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
|
2018-02-28 18:19:48 +01:00
|
|
|
; CHECK-NEXT: Index: 1
|
2018-01-10 00:43:14 +01:00
|
|
|
; CHECK-NEXT: Offset: 0x00000004
|
|
|
|
; CHECK-NEXT: Functions:
|
|
|
|
; CHECK-NEXT: - Index: 1
|
|
|
|
; CHECK-NEXT: Locals:
|
|
|
|
; CHECK-NEXT: Body: 1080808080000B
|
|
|
|
; CHECK-NEXT: - Index: 2
|
|
|
|
; CHECK-NEXT: Locals:
|
|
|
|
; CHECK-NEXT: Body: 41000B
|
|
|
|
; CHECK-NEXT: - Index: 3
|
|
|
|
; CHECK-NEXT: Locals:
|
|
|
|
; CHECK-NEXT: Body: 41000B
|
|
|
|
; CHECK-NEXT: - Type: DATA
|
|
|
|
; CHECK-NEXT: Segments:
|
|
|
|
; CHECK-NEXT: - SectionOffset: 6
|
2019-02-19 23:56:19 +01:00
|
|
|
; CHECK-NEXT: InitFlags: 0
|
2018-01-10 00:43:14 +01:00
|
|
|
; CHECK-NEXT: Offset:
|
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
|
|
|
; CHECK-NEXT: Value: 0
|
|
|
|
; CHECK-NEXT: Content: '616263'
|
|
|
|
; CHECK-NEXT: - Type: CUSTOM
|
|
|
|
; CHECK-NEXT: Name: linking
|
2019-01-16 02:34:48 +01:00
|
|
|
; CHECK-NEXT: Version: 2
|
2018-02-23 06:08:34 +01:00
|
|
|
; CHECK-NEXT: SymbolTable:
|
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Name: callImport
|
|
|
|
; CHECK-NEXT: Flags: [ ]
|
|
|
|
; CHECK-NEXT: Function: 1
|
2018-02-28 18:19:48 +01:00
|
|
|
; CHECK-NEXT: - Index: 1
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Name: funcImport
|
|
|
|
; CHECK-NEXT: Flags: [ UNDEFINED ]
|
|
|
|
; CHECK-NEXT: Function: 0
|
2018-02-23 06:08:34 +01:00
|
|
|
; CHECK-NEXT: - Index: 2
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Name: basicInlineFn
|
|
|
|
; CHECK-NEXT: Flags: [ BINDING_WEAK ]
|
|
|
|
; CHECK-NEXT: Function: 2
|
|
|
|
; CHECK-NEXT: - Index: 3
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Name: sharedFn
|
|
|
|
; CHECK-NEXT: Flags: [ BINDING_WEAK ]
|
|
|
|
; CHECK-NEXT: Function: 3
|
|
|
|
; CHECK-NEXT: - Index: 4
|
|
|
|
; CHECK-NEXT: Kind: DATA
|
|
|
|
; CHECK-NEXT: Name: constantData
|
|
|
|
; CHECK-NEXT: Flags: [ BINDING_WEAK ]
|
|
|
|
; CHECK-NEXT: Segment: 0
|
|
|
|
; CHECK-NEXT: Size: 3
|
2018-01-10 00:43:14 +01:00
|
|
|
; CHECK-NEXT: SegmentInfo:
|
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: Name: .rodata.constantData
|
2019-01-16 02:34:48 +01:00
|
|
|
; CHECK-NEXT: Alignment: 0
|
2018-01-10 00:43:14 +01:00
|
|
|
; CHECK-NEXT: Flags: [ ]
|
|
|
|
; CHECK-NEXT: Comdats:
|
2018-02-23 06:08:34 +01:00
|
|
|
; CHECK-NEXT: Name: basicInlineFn
|
2018-01-10 00:43:14 +01:00
|
|
|
; CHECK-NEXT: Entries:
|
|
|
|
; CHECK-NEXT: - Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Index: 2
|
2018-02-23 06:08:34 +01:00
|
|
|
; CHECK-NEXT: Name: sharedComdat
|
2018-01-10 00:43:14 +01:00
|
|
|
; CHECK-NEXT: Entries:
|
|
|
|
; CHECK-NEXT: - Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Index: 3
|
|
|
|
; CHECK-NEXT: - Kind: DATA
|
|
|
|
; CHECK-NEXT: Index: 0
|
|
|
|
; CHECK-NEXT: ...
|