about summary refs log tree commit diff
path: root/src/librustc_trans/abi.rs
AgeCommit message (Collapse)AuthorLines
2018-05-17Rename trans to codegen everywhere.Irina Popa-696/+0
2018-05-13Introduce OperandValue::nontemporal_store and use it in the intrinsicsAnthony Ramine-2/+2
We use a new MemFlags bitflags type to merge some store code paths.
2018-05-13Introduce OperandValue::volatile_store and use it in the intrinsicsAnthony Ramine-1/+2
Fixes #50371.
2018-05-01Removed direct field usage of RangeInclusive in rustc itself.kennytm-2/+2
2018-04-26Emit range metadata on calls returning scalars (fixes #50157)Anthony Ramine-2/+20
2018-04-26rustc_target: move in syntax::abi and flip dependency.Irina Popa-1/+1
2018-04-26rustc_target: move in cabi_* from rustc_trans.Irina Popa-312/+72
2018-04-26rustc_trans: generalize cabi_* to any context type.Irina Popa-21/+43
2018-04-26rustc_target: move in type definitions from rustc_trans::abi.Irina Popa-202/+19
2018-03-28Auto merge of #49019 - phil-opp:target-spec, r=pnkfelixbors-1/+1
Introduce a TargetTriple enum to support absolute target paths This PR replaces target triple strings with a `TargetTriple` enum, which represents either a target triple or a path to a JSON target file. The path variant is used if the `--target` argument has a `.json` extension, else the target triple variant is used. The motivation of this PR is support for absolute target paths to avoid the need for setting the `RUST_TARGET_PATH` environment variable (see rust-lang/cargo#4905 for more information). For places where some kind of triple is needed (e.g. in the sysroot folder), we use the file name (without extension). For compatibility, we keep the old behavior of searching for a file named `$(target_triple).json` in `RUST_TARGET_PATH` for non-official target triples.
2018-03-26Introduce a TargetTriple enum to support absolute target pathsPhilipp Oppermann-1/+1
2018-03-25Rollup merge of #49122 - scottmcm:z-align-attr, r=cramertjkennytm-1/+1
Add a -Z flag for LLVM align attributes on arguments LLVM seems to still put the assume calls in when inlining, so this probably isn't in a place where it can be turned on by default, but it's interesting to experiment with. For example, this makes `mem::swap::<u64x8>` be 8x `vmovaps ymm` instead of 16x `vmovups xmm`, on my cpu.
2018-03-17Add a -Z flag for LLVM align attributes on argumentsScott McMurray-1/+1
LLVM seems to still put the assume calls in when inlining, so this probably isn't in a place where it can be turned on by default, but it's interesting to experiment with. For example, this makes `swap::<u64x8>` be 8x `vmovaps ymm` instead of 16x `vmovups xmm`, on my cpu.
2018-03-16Rollup merge of #48959 - alexcrichton:signext, r=eddybkennytm-1/+8
rustc: Start a custom cabi module for wasm32 It actually was already using the `cabi_asmjs` module but that was by accident, so route the new `wasm32-unknown-unknown` target to a new `cabi_wasm32` module. The first entries in this module are to use `signext` and `zeroext` for types that are under 32 bytes in size Closes rust-lang-nursery/rust-wasm#88
2018-03-14remove defaulting to unitAndrew Cann-1/+1
Types will no longer default to `()`, instead always defaulting to `!`. This disables the associated warning and removes the flag from TyTuple
2018-03-13transition various normalization functions to the new methodsNiko Matsakis-1/+1
In particular: - `fully_normalize_monormophic_ty` => `normalize_erasing_regions` - `normalize_associated_type_in_env` => `normalize_erasing_regions` - `fully_normalize_associated_types_in` => `normalize_erasing_regions` - `erase_late_bound_regions_and_normalize` => `normalize_erasing_late_bound_regions`
2018-03-12rustc: Start a custom cabi module for wasm32Alex Crichton-1/+8
It actually was already using the `cabi_asmjs` module but that was by accident, so route the new `wasm32-unknown-unknown` target to a new `cabi_wasm32` module. The first entries in this module are to use `signext` and `zeroext` for types that are under 32 bytes in size Closes rust-lang-nursery/rust-wasm#88
2018-02-14rustc_trans: add chunked prefix fields to CastTargetJames Cowgill-86/+52
2018-02-13rustc_trans: add abi::CastTarget::ChunkedPrefixJames Cowgill-2/+38
2018-01-29rustc: replace "lvalue" terminology with "place" in the code.Eduard-Mihai Burtescu-1/+1
2018-01-29rustc: remove `LvaluePreference` argument from `Ty::builtin_deref`.Eduard-Mihai Burtescu-1/+1
2018-01-25rustc: SIMD types use pointers in Rust's ABIAlex Crichton-0/+25
This commit changes the ABI of SIMD types in the "Rust" ABI to unconditionally be passed via pointers instead of being passed as immediates. This should fix a longstanding issue, #44367, where SIMD-using programs ended up showing very odd behavior at runtime because the ABI between functions was mismatched. As a bit of a recap, this is sort of an LLVM bug and sort of an LLVM feature (today's behavior). LLVM will generate code for a function solely looking at the function it's generating, including calls to other functions. Let's then say you've got something that looks like: ```llvm define void @foo() { ; no target features enabled call void @bar(<i64 x 4> zeroinitializer) ret void } define void @bar(<i64 x 4>) #0 { ; enables the AVX feature ... } ``` LLVM will codegen the call to `bar` *without* using AVX registers becauase `foo` doesn't have access to these registers. Instead it's generated with emulation that uses two 128-bit registers. The `bar` function, on the other hand, will expect its argument in an AVX register (as it has AVX enabled). This means we've got a codegen problem! Comments on #44367 have some more contexutal information but the crux of the issue is that if we want SIMD to work in general we'll need to ensure that whenever a function calls another they ABI of the arguments being passed is in agreement. One possible solution to this would be to insert "shim functions" where whenever a `target_feature` mismatch is detected the compiler inserts a shim function where you pass arguments via memory to the shim and then the shim loads the values and calls the target function (where the shim and the target have the same target features enabled). This unfortunately is quite nontrivial to implement in rustc today (especially when accounting for function pointers and such). This commit takes a different solution, *always* passing SIMD arguments through memory instead of passing as immediates. This strategy solves the problem at the LLVM layer because the ABI between two functions never uses SIMD registers. This also shouldn't be a hit to performance because SIMD performance is thought to often rely on inlining anyway, where a `call` instruction, even if using SIMD registers, would be disastrous to performance regardless. LLVM should then be more than capable of fixing all our memory usage to use registers instead after enough inlining has been performed. Note that there's a few caveats to this commit though: * The "platform intrinsic" ABI is omitted from "always pass via memory". This ABI is used to define intrinsics like `simd_shuffle4` where LLVM and rustc need to have the arguments as an immediate. * Additionally this commit does *not* fix the `extern` ("C") ABI. This means that the bug in #44367 can still happen when using non-Rust-ABI functions. My hope is that before stabilization we can ban and/or warn about SIMD types in these functions (as AFAIK there's not much motivation to belong there anyway), but I'll leave that for a later commit and if this is merged I'll file a follow-up issue. All in all this... Closes #44367
2018-01-16Compute LLVM argument indices correctly in face of paddingRobin Kruppe-3/+0
Closes #47278
2018-01-14rustc_trans: rename bcx to bx.Eduard-Mihai Burtescu-17/+17
2018-01-14rustc_trans: rename ccx to cx.Eduard-Mihai Burtescu-91/+91
2018-01-14rustc_trans: rename CrateContext to CodegenCx.Eduard-Mihai Burtescu-17/+17
2018-01-14rustc_trans: access fields directly on CrateContext.Eduard-Mihai Burtescu-3/+3
2017-12-18Remove duplicated functions from trans::common.rsMaik Klein-2/+2
2017-12-17rustc_trans: always require alignment for load/store/memcpy.Eduard-Mihai Burtescu-4/+5
2017-12-17rustc_trans: always keep track of the Align in LvalueRef.Eduard-Mihai Burtescu-2/+2
2017-12-13rustc: unpack newtyped of #[repr(simd)] vector types.Eduard-Mihai Burtescu-2/+2
2017-12-01MIR: s/lv(al(ue)?)?/place in function/variable/module names.Eduard-Mihai Burtescu-3/+3
2017-12-01MIR: s/Lvalue/Place in type names.Eduard-Mihai Burtescu-3/+3
2017-11-25rustc_trans: don't apply noalias on returned references.Eduard-Mihai Burtescu-1/+2
2017-11-19rustc_trans: remove primitive_align optimization.Eduard-Mihai Burtescu-1/+1
2017-11-19rustc_trans: work around i686-pc-windows-msvc byval align LLVM bug.Eduard-Mihai Burtescu-1/+3
2017-11-19rustc_trans: support scalar pairs directly in the Rust ABI.Eduard-Mihai Burtescu-227/+226
2017-11-19rustc: encode scalar pairs in layout ABI.Eduard-Mihai Burtescu-2/+7
2017-11-19rustc_trans: generate LLVM pointee types based on alignment.Eduard-Mihai Burtescu-70/+24
2017-11-19rustc_trans: compute better align/dereferenceable attributes from pointees.Eduard-Mihai Burtescu-117/+167
2017-11-19rustc: optimize out uninhabited types and variants.Eduard-Mihai Burtescu-0/+3
2017-11-19rustc: track validity ranges for layout::Abi::Scalar values.Eduard-Mihai Burtescu-9/+10
2017-11-19rustc: remove redundant/unused fields from layout::Abi::Vector.Eduard-Mihai Burtescu-2/+2
2017-11-19rustc_trans: check for layout::I1 instead of TyBool.Eduard-Mihai Burtescu-10/+8
2017-11-19rustc: move size, align & primitive_align from Abi::Aggregate to layout.Eduard-Mihai Burtescu-18/+18
2017-11-19rustc_trans: go through layouts uniformly for fat pointers and variants.Eduard-Mihai Burtescu-6/+6
2017-11-19rustc_trans: query LLVM types from a layout instead of a Ty.Eduard-Mihai Burtescu-3/+4
2017-11-19rustc_trans: keep a layout instead of a type in {Lvalue,Operand}Ref.Eduard-Mihai Burtescu-1/+1
2017-11-19rustc_trans: nest abi::ArgType's for fat pointers instead of eagerly flattening.Eduard-Mihai Burtescu-27/+81
2017-11-19rustc: do not pub use Layout::* in layout.Eduard-Mihai Burtescu-1/+1