about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/context.rs
AgeCommit message (Collapse)AuthorLines
2018-11-16Great separation of librustc_codegen_llvm: librustc_codegen_ssa compilesDenis Merigoux-0/+4
2018-11-16Preparing the generalization of base:compile_coodegen_unitDenis Merigoux-0/+31
2018-11-16Renamed lifetimes for better understandingDenis Merigoux-14/+13
2018-11-16Move doc to trait declarationsDenis Merigoux-1/+0
2018-11-16Generalized base:maybe_create_entry_wrapperDenis Merigoux-0/+8
2018-11-16Generalized mono_item.rs and base.rs:codegen_instanceDenis Merigoux-0/+8
2018-11-16Generalized mir::codegen_mir (and all subsequent functions)Denis Merigoux-87/+97
2018-11-16Generalized base::unsize_thin_ptrDenis Merigoux-26/+0
2018-11-16Generalized base::unsized_infoDenis Merigoux-2/+13
2018-11-16[eddyb/rebase cleanup] s/&self./self.Eduard-Mihai Burtescu-29/+29
2018-11-16Traitified IntrinsicCallMethodsDenis Merigoux-7/+2
2018-11-16Generalized memset and memcpyDenis Merigoux-316/+322
2018-11-16Prefixed type methods & removed trait impl for write::CodegenContextDenis Merigoux-26/+26
2018-11-16Traitification of type_ methodsDenis Merigoux-26/+27
The methods are now attached to CodegenCx instead of Type
2018-11-16Removed genericity over Value in various functionsDenis Merigoux-21/+21
Prelude to using associated types in traits rather than type parameters
2018-11-16Generalized base.rs#call_memcpy and everything that it usesDenis Merigoux-18/+23
Generalized operand.rs#nontemporal_store and fixed tidy issues Generalized operand.rs#nontemporal_store's implem even more With a BuilderMethod trait implemented by Builder for LLVM Cleaned builder.rs : no more code duplication, no more ValueTrait Full traitification of builder.rs
2018-11-16Reduced line length to pass tidyDenis Merigoux-13/+12
Generalized FunctionCx Added ValueTrait and first change Generalize CondegenCx Generalized the Builder struct defined in librustc_codegen_llvm/builder.rs
2018-11-12Use type safe `VariantIdx` instead of `usize` everywhereOliver Scherer-2/+2
2018-11-10Auto merge of #55650 - nikic:funnel-shift, r=nagisabors-0/+12
Implement rotate using funnel shift on LLVM >= 7 Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore. Fixes #52457.
2018-11-08Rollup merge of #55633 - nikic:memcpy-align, r=nagisaMark Rousskov-6/+0
Support memcpy/memmove with differing src/dst alignment If LLVM 7 is used, generate memcpy/memmove with differing src/dst alignment. I've added new FFI functions to construct these through the builder API, which is more convenient than dealing with differing intrinsic signatures depending on the LLVM version. Fixes #49740.
2018-11-04rustc_target: pass contexts by reference, not value.Eduard-Mihai Burtescu-6/+6
2018-11-04Support memcpy/memmove with differing src/dst alignmentNikita Popov-6/+0
If LLVM 7 is used, generate memcpy/memmove with differing src/dst alignment. I've added new FFI functions to construct these through the builder API, which is more convenient than dealing with differing intrinsic signatures depending on the LLVM version.
2018-11-03Implement rotate using funnel shift on LLVM >= 7Nikita Popov-0/+12
Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore.
2018-10-24Make declare_fn accept PolyFnSig instead of Ty.Masaki Hara-3/+3
2018-10-24Make declare_fn aware of vtable shims.Masaki Hara-1/+1
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-9/+9
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-9/+9
2018-10-13Check the invariant for `principal` inside the methodOliver Scherer-1/+1
2018-10-11Auto merge of #54592 - GabrielMajeri:no-plt, r=nagisabors-0/+7
Support for disabling PLT for better function call performance This PR gives `rustc` the ability to skip the PLT when generating function calls into shared libraries. This can improve performance by reducing branch indirection. AFAIK, the only advantage of using the PLT is to allow for ELF lazy binding. However, since Rust already [enables full relro for security](https://github.com/rust-lang/rust/pull/43170), lazy binding was disabled anyway. This is a little known feature which is supported by [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html) and [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fplt) as `-fno-plt` (some Linux distros [enable it by default](https://git.archlinux.org/svntogit/packages.git/tree/trunk/makepkg.conf?h=packages/pacman#n40) for all builds). Implementation inspired by [this patch](https://reviews.llvm.org/D39079#change-YvkpNDlMs_LT) which adds `-fno-plt` support to Clang. ## Performance I didn't run a lot of benchmarks, but these are the results on my machine for a `clap` [benchmark](https://github.com/clap-rs/clap/blob/master/benches/05_ripgrep.rs): ``` name control ns/iter no-plt ns/iter diff ns/iter diff % speedup build_app_long 11,097 10,733 -364 -3.28% x 1.03 build_app_short 11,089 10,742 -347 -3.13% x 1.03 build_help_long 186,835 182,713 -4,122 -2.21% x 1.02 build_help_short 80,949 78,455 -2,494 -3.08% x 1.03 parse_clean 12,385 12,044 -341 -2.75% x 1.03 parse_complex 19,438 19,017 -421 -2.17% x 1.02 parse_lots 431,493 421,421 -10,072 -2.33% x 1.02 ``` A small performance improvement across the board, with no downsides. It's likely binaries which make a lot of function calls into dynamic libraries could see even more improvements. [This comment](https://patchwork.ozlabs.org/patch/468993/#1028255) suggests that, in some cases, `-fno-plt` could improve PIC/PIE code performance by 10%. ## Security benefits **Bonus**: some of the speculative execution attacks rely on the PLT, by disabling it we reduce a big attack surface and reduce the need for [`retpoline`](https://reviews.llvm.org/D41723). ## Remaining PLT calls The compiled binaries still have plenty of PLT calls, coming from C/C++ libraries. Building dependencies with `CFLAGS=-fno-plt CXXFLAGS=-fno-plt` removes them.
2018-10-11Support for disabling the PLT on ELF targetsGabriel Majeri-0/+7
Disable the PLT where possible to improve performance for indirect calls into shared libraries. This optimization is enabled by default where possible. - Add the `NonLazyBind` attribute to `rustllvm`: This attribute informs LLVM to skip PLT calls in codegen. - Disable PLT unconditionally: Apply the `NonLazyBind` attribute on every function. - Only enable no-plt when full relro is enabled: Ensures we only enable it when we have linker support. - Add `-Z plt` as a compiler option
2018-10-08codegen_llvm: remove explicit returnsljedrz-1/+2
2018-10-08codegen_llvm: improve common patternsljedrz-7/+6
2018-10-08codegen_llvm: whitespace & formatting improvementsljedrz-7/+7
2018-08-22Remove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str}varkor-1/+1
2018-08-22Remove Ty prefix from Ty{Foreign|Param}varkor-1/+1
2018-08-22Remove Ty prefix from ↵varkor-1/+1
Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
2018-08-14Rollup merge of #53274 - bjorn3:remove_statics_field, r=nagisakennytm-5/+0
Remove statics field from CodegenCx It doesnt seem to be used anywhere.
2018-08-11Remove statics field from CodegenCxbjorn3-5/+0
2018-08-10Introduce SmallCStr and use it where applicable.Michael Woerister-5/+5
2018-08-07Annotate functions in LLVM with target-cpu, same as Clang does.Michael Woerister-0/+3
2018-08-04Normalize DebugInfoLevel to standard styleMark Rousskov-3/+3
2018-08-04Normalize variants of CrateType to standard styleMark Rousskov-1/+1
This is a clippy-breaking change.
2018-07-30rustc_codegen_llvm: fix tidy errors.Irina Popa-1/+5
2018-07-30rustc_codegen_llvm: use safe references for Value.Irina Popa-21/+21
2018-07-30rustc_codegen_llvm: use safe references for Type.Irina Popa-18/+18
2018-07-30rustc_codegen_llvm: use safe references for Context and Module.Irina Popa-59/+51
2018-07-30rustc_codegen_llvm: move from empty enums to extern types.Irina Popa-6/+5
2018-07-16Revert "Clean up LLVM module naming (just use CodegenUnit names)."Michael Woerister-2/+3
This reverts commit f6894ebe664d111259a91a2b5fcc1236ca413436.
2018-07-11Clean up LLVM module naming (just use CodegenUnit names).Michael Woerister-3/+2
2018-05-24add simd float intrinsics and gather/scattergnzlbg-0/+117