mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
Summary: Implements a new target features section in assembly and object files that records what features are used, required, and disallowed in WebAssembly objects. The linker uses this information to ensure that all objects participating in a link are feature-compatible and records the set of used features in the output binary for use by optimizers and other tools later in the toolchain. The "atomics" feature is always required or disallowed to prevent linking code with stripped atomics into multithreaded binaries. Other features are marked used if they are enabled globally or on any function in a module. Future CLs will add linker flags for ignoring feature compatibility checks and for specifying the set of allowed features, implement using the presence of the "atomics" feature to control the type of memory and segments in the linked binary, and add front-end flags for relaxing the linkage policy for atomics. Reviewers: aheejin, sbc100, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59173 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356610 91177308-0d34-0410-b5e6-96231b3b80d8
68 lines
1.9 KiB
LLVM
68 lines
1.9 KiB
LLVM
; RUN: llc < %s | FileCheck %s --check-prefixes CHECK,ATTRS
|
|
; RUN: llc < %s -mattr=+simd128 | FileCheck %s --check-prefixes CHECK,SIMD128
|
|
; RUN; llc < %s -mattr=+atomics | FileCheck %s --check-prefixes CHECK,ATOMICS
|
|
; RUN: llc < %s -mcpu=bleeding-edge | FileCheck %s --check-prefixes CHECK,BLEEDING-EDGE
|
|
|
|
; Test that codegen emits target features from the command line or
|
|
; function attributes correctly.
|
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
|
target triple = "wasm32-unknown-unknown"
|
|
|
|
define void @foo() #0 {
|
|
ret void
|
|
}
|
|
|
|
define void @bar() #1 {
|
|
ret void
|
|
}
|
|
|
|
attributes #0 = { "target-features"="+sign-ext" }
|
|
attributes #1 = { "target-features"="+nontrapping-fptoint" }
|
|
|
|
; CHECK-LABEL: .custom_section.target_features,"",@
|
|
|
|
; -atomics, +sign_ext
|
|
; ATTRS-NEXT: .int8 3
|
|
; ATTRS-NEXT: .int8 45
|
|
; ATTRS-NEXT: .int8 7
|
|
; ATTRS-NEXT: .ascii "atomics"
|
|
; ATTRS-NEXT: .int8 43
|
|
; ATTRS-NEXT: .int8 19
|
|
; ATTRS-NEXT: .ascii "nontrapping-fptoint"
|
|
; ATTRS-NEXT: .int8 43
|
|
; ATTRS-NEXT: int8 8
|
|
; ATTRS-NEXT: .ascii "sign-ext"
|
|
|
|
; -atomics, +simd128
|
|
; SIMD128-NEXT: .int8 2
|
|
; SIMD128-NEXT: .int8 45
|
|
; SIMD128-NEXT: .int8 7
|
|
; SIMD128-NEXT: .ascii "atomics"
|
|
; SIMD128-NEXT: .int8 43
|
|
; SIMD128-NEXT: .int8 7
|
|
; SIMD128-NEXT: .ascii "simd128"
|
|
|
|
; =atomics
|
|
; ATOMICS-NEXT: .int8 1
|
|
; ATOMICS-NEXT: .int8 61
|
|
; ATOMICS-NEXT: .int8 7
|
|
; ATOMICS-NEXT: .ascii "atomics"
|
|
|
|
; =atomics, +nontrapping-fptoint, +sign-ext, +simd128
|
|
; BLEEDING-EDGE-NEXT: .int8 4
|
|
; BLEEDING-EDGE-NEXT: .int8 61
|
|
; BLEEDING-EDGE-NEXT: .int8 7
|
|
; BLEEDING-EDGE-NEXT: .ascii "atomics"
|
|
; BLEEDING-EDGE-NEXT: .int8 43
|
|
; BLEEDING-EDGE-NEXT: .int8 19
|
|
; BLEEDING-EDGE-NEXT: .ascii "nontrapping-fptoint"
|
|
; BLEEDING-EDGE-NEXT: .int8 43
|
|
; BLEEDING-EDGE-NEXT: .int8 8
|
|
; BLEEDING-EDGE-NEXT: .ascii "sign-ext"
|
|
; BLEEDING-EDGE-NEXT: .int8 43
|
|
; BLEEDING-EDGE-NEXT: .int8 7
|
|
; BLEEDING-EDGE-NEXT: .ascii "simd128"
|
|
|
|
; CHECK-NEXT: .text
|