about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-10-15 02:48:24 +0000
committerbors <bors@rust-lang.org>2018-10-15 02:48:24 +0000
commitc40e2ac2b61e7302de37f54574df987053c15cb2 (patch)
treebf0eda89d899651b8aa756c37f2e35fcc6c01747 /src/librustc_codegen_llvm
parentf02768b68505b706f1a89f33f875c6b061dc020f (diff)
parent9562b69b4f270a824b9f54203ed69427f8833fe9 (diff)
downloadrust-c40e2ac2b61e7302de37f54574df987053c15cb2.tar.gz
rust-c40e2ac2b61e7302de37f54574df987053c15cb2.zip
Auto merge of #55024 - alexcrichton:wasm-simd-by-val, r=estebank
rustc: Allow targets to specify SIMD args are by-val

The upcoming SIMD support in the wasm target is unique from the other
platforms where it's either unconditionally available or not available,
there's no halfway where a subsection of the program can use it but no
other parts of the program can use it. In this world it's valid for wasm
SIMD args to always be passed by value and there's no need to pass them
by reference.

This commit adds a new custom target specification option
`simd_types_indirect` which defaults to `true`, but the wasm backend
disables this and sets it to `false`.
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/abi.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs
index c8e8d0dc84e..7b93d3e795e 100644
--- a/src/librustc_codegen_llvm/abi.rs
+++ b/src/librustc_codegen_llvm/abi.rs
@@ -536,7 +536,10 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
                     // Note that the platform intrinsic ABI is exempt here as
                     // that's how we connect up to LLVM and it's unstable
                     // anyway, we control all calls to it in libstd.
-                    layout::Abi::Vector { .. } if abi != Abi::PlatformIntrinsic => {
+                    layout::Abi::Vector { .. }
+                        if abi != Abi::PlatformIntrinsic &&
+                            cx.sess().target.target.options.simd_types_indirect =>
+                    {
                         arg.make_indirect();
                         return
                     }