about summary refs log tree commit diff
path: root/src/librustc_trans/builder.rs
AgeCommit message (Collapse)AuthorLines
2018-05-17Rename trans to codegen everywhere.Irina Popa-1425/+0
2018-05-13Introduce OperandValue::nontemporal_store and use it in the intrinsicsAnthony Ramine-37/+30
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-03-26properly handle the case when LLVM does not have min/maxnumgnzlbg-2/+6
2018-03-26require llvm 6gnzlbg-2/+6
2018-03-26implement minmax intrinsicsgnzlbg-0/+13
2018-03-23Introduce unsafe offset_from on pointersScott McMurray-0/+7
Adds intrinsics::exact_div to take advantage of the unsafe, which reduces the implementation from ```asm sub rcx, rdx mov rax, rcx sar rax, 63 shr rax, 62 lea rax, [rax + rcx] sar rax, 2 ret ``` down to ```asm sub rcx, rdx sar rcx, 2 mov rax, rcx ret ``` (for `*const i32`)
2018-03-21fix vector fmin/fmax non-fast/fast intrinsics NaN handlinggnzlbg-4/+4
2018-03-15error via bug! instead of stderr+terminategnzlbg-9/+57
2018-03-14expose ordered/unordered/nanless intirnsicsgnzlbg-0/+18
2018-03-13add intrinsics for portable packed simd vector reductionsgnzlbg-0/+75
2018-02-17fix more typos found by codespell.Matthias Krüger-1/+1
2018-01-14rustc_trans: rename bcx to bx.Eduard-Mihai Burtescu-6/+6
2018-01-14rustc_trans: rename ccx to cx.Eduard-Mihai Burtescu-30/+30
2018-01-14rustc_trans: rename CrateContext to CodegenCx.Eduard-Mihai Burtescu-3/+3
2018-01-14rustc_trans: access fields directly on CrateContext.Eduard-Mihai Burtescu-9/+9
2018-01-04Remove outdated LLVMRustBuildLandingPad() wrapperBjörn Steinbrink-4/+3
The function was added as a wrapper to handle compatibility with older LLVM versions that we no longer support, so it can be removed. Refs #46437
2017-12-17rustc_trans: always require alignment for load/store/memcpy.Eduard-Mihai Burtescu-8/+4
2017-11-25rustc: Add support for some more x86 SIMD opsAlex Crichton-0/+23
This commit adds compiler support for two basic operations needed for binding SIMD on x86 platforms: * First, a `nontemporal_store` intrinsic was added for the `_mm_stream_ps`, seen in rust-lang-nursery/stdsimd#114. This was relatively straightforward and is quite similar to the volatile store intrinsic. * Next, and much more intrusively, a new type to the backend was added. The `x86_mmx` type is used in LLVM for a 64-bit vector register and is used in various intrinsics like `_mm_abs_pi8` as seen in rust-lang-nursery/stdsimd#74. This new type was added as a new layout option as well as having support added to the trans backend. The type is enabled with the `#[repr(x86_mmx)]` attribute which is intended to just be an implementation detail of SIMD in Rust. I'm not 100% certain about how the `x86_mmx` type was added, so any extra eyes or thoughts on that would be greatly appreciated!
2017-11-19rustc_trans: remove primitive_align optimization.Eduard-Mihai Burtescu-5/+3
2017-11-19rustc_trans: (hack) use preferred alignment for atomic loads/stores.Eduard-Mihai Burtescu-2/+7
2017-11-19rustc: support u128 discriminant ranges.Eduard-Mihai Burtescu-18/+10
2017-11-19rustc_trans: use more of the trans::mir and ty::layout APIs throughout.Eduard-Mihai Burtescu-22/+6
2017-11-19rustc_trans: use a predictable layout for constant ADTs.Eduard-Mihai Burtescu-2/+0
2017-11-19rustc_trans: avoid working with sizes/offsets and alignments as integers.Eduard-Mihai Burtescu-20/+51
2017-10-26Avoid unnecessary copies of arguments that are simple bindingsBjörn Steinbrink-0/+7
Initially MIR differentiated between arguments and locals, which introduced a need to add extra copies assigning the argument to a local, even for simple bindings. This differentiation no longer exists, but we're still creating those copies, bloating the MIR and LLVM IR we emit. Additionally, the current approach means that we create debug info for both the incoming argument (marking it as an argument), and then immediately shadow it a local that goes by the same name. This can be confusing when using e.g. "info args" in gdb, or when e.g. a debugger with a GUI displays the function arguments separately from the local variables, especially when the binding is mutable, because the argument doesn't change, while the local variable does.
2017-09-17rustc: Move codegen to a queryAlex Crichton-3/+6
This commit moves the actual code generation in the compiler behind a query keyed by a codegen unit's name. This ended up entailing quite a few internal refactorings to enable this, along with a few cut corners: * The `OutputFilenames` structure is now tracked in the `TyCtxt` as it affects a whole bunch of trans and such. This is now behind a query and threaded into the construction of the `TyCtxt`. * The `TyCtxt` now has a channel "out the back" intended to send data to worker threads in rustc_trans. This is used as a sort of side effect of the codegen query but morally what's happening here is the return value of the query (currently unit but morally a path) is only valid once the background threads have all finished. * Dispatching work items to the codegen threads was refactored to only rely on data in `TyCtxt`, which mostly just involved refactoring where data was stored, moving it from the translation thread to the controller thread's `CodegenContext` or the like. * A new thread locals was introduced in trans to work around the query system. This is used in the implementation of `assert_module_sources` which looks like an artifact of the old query system and will presumably go away once red/green is up and running.
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2017-04-21Implementation of repr struct alignment RFC 1358.Cameron Hart-4/+8
The main changes around rustc::ty::Layout::struct and rustc_trans:adt: * Added primitive_align field which stores alignment before repr align * Always emit field padding when generating the LLVM struct fields * Added methods for adjusting field indexes from the layout index to the LLVM struct field index The main user of this information is rustc_trans::adt::struct_llfields which determines the LLVM fields to be used by LLVM, including padding fields.
2017-03-27Fix various useless derefs and slicingsOliver Schneider-3/+3
2017-02-25Rollup merge of #40025 - est31:master, r=eddybEduard-Mihai Burtescu-1/+1
Implement non-capturing closure to fn coercion Implements non capturing closure coercion ([RFC 1558](https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md)). cc tracking issue #39817
2017-02-23Implement non-capturing closure to fn coercionest31-1/+1
2017-02-21Set metadata for vtable-related loadsJames Miller-0/+7
Give LLVM much more information about vtable pointers. Without the extra information, LLVM has to be rather pessimistic about vtables, preventing a number of obvious optimisations. * Makes the vtable pointer argument noalias and readonly. * Marks loads of the vtable pointer as nonnull. * Marks load from the vtable with `!invariant.load` metadata. Fixes #39992
2017-02-10Fix intcast, use it where appropriateSimonas Kazlauskas-2/+2
2017-02-08emit "align 1" metadata on loads/stores of packed structsAriel Ben-Yehuda-13/+12
According to the LLVM reference: > A value of 0 or an omitted align argument means that the operation has the ABI alignment for the target. So loads/stores of fields of packed structs need to have their align set to 1. Implement that by tracking the alignment of `LvalueRef`s. Fixes #39376.
2017-01-26Remove unnecessary LLVMRustPersonalityFn bindingSimonas Kazlauskas-1/+1
LLVM Core C bindings provide this function for all the versions back to what we support (3.7), and helps to avoid this unnecessary builder->function transition every time. Also a negative diff.
2017-01-04Inline and remove Builder::entry_blockMark Simulacrum-4/+0
2017-01-04Builder.build_new_block -> Builder.build_sibling_blockMark Simulacrum-12/+2
2017-01-04Add Builder::sess and Builder::tcx methodsMark Simulacrum-1/+10
2017-01-04Purge FunctionContextMark Simulacrum-0/+4
2017-01-04Replace BlockAndBuilder with Builder.Mark Simulacrum-0/+57
2016-12-31Fix transmute::<T, U> where T requires a bigger alignment than UBjörn Steinbrink-2/+6
For transmute::<T, U> we simply pointercast the destination from a U pointer to a T pointer, without providing any alignment information, thus LLVM assumes that the destination is aligned to hold a value of type T, which is not necessarily true. This can lead to LLVM emitting machine instructions that assume said alignment, and thus cause aborts. To fix this, we need to provide the actual alignment to store_operand() and in turn to store() so they can set the proper alignment information on the stores and LLVM can emit the proper machine instructions. Fixes #32947
2016-12-20Rename 'blk and 'bcx to 'aMark Simulacrum-1/+1
2016-12-20Remove unused importsMark-Simulacrum-2/+0
2016-12-20Cleanup instruction countingMark-Simulacrum-42/+5
2016-12-20Merge OwnedBuilder and BuilderMark-Simulacrum-2/+14
2016-12-20Rename Builder::alloca to dynamic_allocaMark-Simulacrum-1/+1
2016-12-20Remove *_builderMark-Simulacrum-2/+2
2016-12-20Replace build.rs with calling functions on builder directlyMark-Simulacrum-0/+14
2016-11-08Replace FnvHasher use with FxHasher.Nicholas Nethercote-2/+2
This speeds up compilation by 3--6% across most of rustc-benchmarks.