about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2018-12-14rustc: Add an unstable `simd_select_bitmask` intrinsicAlex Crichton-1/+2
This is going to be required for binding a number of AVX-512 intrinsics in the `stdsimd` repository, and this intrinsic is the same as `simd_select` except that it takes a bitmask as the first argument instead of a SIMD vector. This bitmask is then transmuted into a `<NN x i8>` argument, depending on how many bits it is. cc rust-lang-nursery/stdsimd#310
2018-12-14Rollup merge of #56789 - alexcrichton:simd_select_bitmask, r=rkruppekennytm-0/+21
rustc: Add an unstable `simd_select_bitmask` intrinsic This is going to be required for binding a number of AVX-512 intrinsics in the `stdsimd` repository, and this intrinsic is the same as `simd_select` except that it takes a bitmask as the first argument instead of a SIMD vector. This bitmask is then transmuted into a `<NN x i8>` argument, depending on how many bits it is. cc rust-lang-nursery/stdsimd#310
2018-12-14Rollup merge of #56749 - alexcrichton:adx, r=gnzlbgkennytm-0/+1
x86: Add the `adx` target feature to whitelist Requested in rust-lang-nursery/stdsimd#322 this is hopefully the first step!
2018-12-14Rollup merge of #56609 - michaelwoerister:unconditional-target-cpu-attr, ↵kennytm-7/+3
r=alexcrichton Unconditionally emit the target-cpu LLVM attribute. This PR makes `rustc` always emit the `target-cpu` LLVM attribute for functions. The goal is to allow for cross-language inlining of functions defined in `libstd`. So far `libstd` functions were the only function without a `target-cpu` attribute, so in whole-crate-graph cross-lang LTO scenarios they were not eligible for inlining into foreign code. r? @alexcrichton
2018-12-13rustc: Add an unstable `simd_select_bitmask` intrinsicAlex Crichton-0/+21
This is going to be required for binding a number of AVX-512 intrinsics in the `stdsimd` repository, and this intrinsic is the same as `simd_select` except that it takes a bitmask as the first argument instead of a SIMD vector. This bitmask is then transmuted into a `<NN x i8>` argument, depending on how many bits it is. cc rust-lang-nursery/stdsimd#310
2018-12-13Auto merge of #56461 - oli-obk:alloc_ids, r=RalfJungbors-6/+6
Some cleanups around `AllocId` management r? @eddyb cc @RalfJung
2018-12-13Auto merge of #56090 - nnethercote:filesearch, r=eddybbors-13/+8
Overhaul `FileSearch` and `SearchPaths` `FileSearch::search()` traverses one or more directories. For each directory it generates a `Vec<PathBuf>` containing one element per file in that directory. In some benchmarks this occurs enough that the allocations done for the `PathBuf`s are significant, and in practice a small number of directories are being traversed over and over again. For example, when compiling the `tokio-webpush-simple` benchmark, two directories are traversed 58 times each. Each of these directories have more than 100 files. We can do all the necessary traversals up front, when `Session` is created, and get the `Vec<PathBuf>`s then. This reduces instruction counts on several benchmarks by 1--5%. r? @alexcrichton CC @eddyb, @michaelwoerister, @nikomatsakis
2018-12-12x86: Add the `adx` target feature to whitelistAlex Crichton-0/+1
Requested in rust-lang-nursery/stdsimd#322 this is hopefully the first step!
2018-12-12rustc: Switch `extern` functions to abort by default on panicAlex Crichton-37/+43
This was intended to land way back in 1.24, but it was backed out due to breakage which has long since been fixed. An unstable `#[unwind]` attribute can be used to tweak the behavior here, but this is currently simply switching rustc's internal default to abort-by-default if an `extern` function panics, making our codegen sound primarily (as currently you can produce UB with safe code) Closes #52652
2018-12-12Replace `FileSearch::for_each_lib_search_path` with `search_paths`.Nicholas Nethercote-8/+4
Returning an iterator leads to nicer code all around.
2018-12-12Introduce `SearchPath` and replace `SearchPaths` with `Vec<SearchPath>`.Nicholas Nethercote-6/+6
It's more idiomatic, makes the code shorter, and will help with the next commit.
2018-12-12Remove `Session::sysroot()`.Nicholas Nethercote-2/+1
Instead of maybe storing its own sysroot and maybe deferring to the one in `Session::opts`, just clone the latter when necessary so one is always directly available. This removes the need for the getter.
2018-12-11Remove env_alloca hackNikita Popov-5/+0
This is no longer necessary for LLVM >= 6.
2018-12-09Bump minimum required LLVM version to 6.0Nikita Popov-10/+4
2018-12-08Rollup merge of #56599 - dlrobertson:fix_va_arg, r=eddybMazdak Farrokhzad-10/+26
codegen: Fix va_list - aarch64 iOS/Windows ## Summary Fix code generated for `VaList` on Aarch64 iOS/Windows. ## Details According to the [Apple - ARM64 Function Calling Conventions]: > ... the type va_list is an alias for char * rather than for the struct > type specified in the generic PCS. The current implementation uses the generic Aarch64 structure for `VaList` for Aarch64 iOS. Switch to using the `char *` variant of the `VaList` and use the corresponding `emit_ptr_va_arg` for the `va_arg` intrinsic. Windows always uses the `char *` variant of the `VaList`. Update the `va_arg` intrinsic to use `emit_ptr_va_arg`. [Apple - ARM64 Function Calling Conventions]: https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-29/+29
2018-12-07codegen: Fix va_list - aaarch64 iOS/WindowsDan Robertson-10/+26
According to the Apple developer docs: > The type va_list is an alias for char * rather than for the struct > type specified in the generic PCS. The current implementation uses the generic Aarch64 structure for VaList for Aarch64 iOS. Windows always uses the char * variant of the va_list.
2018-12-07Auto merge of #56502 - Zoxc:hir-func, r=eddybbors-4/+4
Use a function to access the Hir map to be able to turn it into a query later r? @eddyb
2018-12-07Unconditionally emit the target-cpu LLVM attribute.Michael Woerister-7/+3
2018-12-06Use a function to access the Hir map to be able to turn it into a query laterJohn Kåre Alsaker-4/+4
2018-12-04Serialize modules into ThinBuffer after initial optimizationNikita Popov-33/+40
Instead of keeping all modules in memory until thin LTO and only serializing them then, serialize the module immediately after it finishes optimizing.
2018-12-04Remove unnecessary parts of run_fat_lto signatureNikita Popov-15/+7
Fat LTO merges into one module, so only return one module.
2018-12-04Separate out methods for running thin and fat LTONikita Popov-39/+60
2018-12-04Auto merge of #55871 - ljedrz:llvm_back_allocations, r=nagisabors-18/+19
codegen_llvm_back: improve allocations This commit was split out from https://github.com/rust-lang/rust/pull/54864. Last time it was causing an LLVM OOM, which was most probably caused by not collecting the globals. - preallocate vectors of known length - `extend` instead of `append` where the argument is consumable - turn 2 `push` loops into `extend`s - create a vector from a function producing one instead of using `extend_from_slice` on it - consume `modules` when no longer needed - ~~return an `impl Iterator` from `generate_lto_work`~~ - ~~don't `collect` `globals`, as they are iterated over and consumed right afterwards~~ While I'm hoping it won't cause an OOM anymore, I would still consider this a "high-risk" PR and not roll it up.
2018-12-04s/alloc_type/alloc_kind/Oliver Scherer-2/+2
2018-12-03s/AllocType/AllocKind/Oliver Scherer-4/+4
2018-12-03Auto merge of #55010 - tromey:Bug-9224-generic-parameters, r=michaelwoeristerbors-8/+65
Add template parameter debuginfo to generic types This changes debuginfo generation to add template parameters to generic types. With this change the DWARF now has DW_TAG_template_type_param for types, not just for functions, like: <2><40d>: Abbrev Number: 6 (DW_TAG_structure_type) <40e> DW_AT_name : (indirect string, offset: 0x375): Generic<i32> <412> DW_AT_byte_size : 4 <413> DW_AT_alignment : 4 ... <3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param) <420> DW_AT_type : <0x42a> <424> DW_AT_name : (indirect string, offset: 0xa65e): T Closes #9224
2018-12-03codegen_llvm_back: improve allocationsljedrz-18/+19
2018-12-03Auto merge of #56358 - nikic:mergefunc-aliases, r=rkruppebors-4/+9
Enable -mergefunc-use-aliases If the Rust LLVM fork is used, enable the -mergefunc-use-aliases flag, which will create aliases for merged functions, rather than inserting a call from one to the other. A number of codegen tests needed to be adjusted, because functions that previously fell below the thunk limit are now being merged. Merging is prevented in various ways now. I expect that this is going to break something, somewhere, because it isn't able to deal with aliases properly, but we won't find out until we try :) This fixes #52651. r? @rkruppe
2018-12-02Auto merge of #56198 - bjorn3:cg_ssa_refactor, r=eddybbors-246/+349
Refactor rustc_codegen_ssa cc #56108 (not all things are done yet) This removes an unsafe method from cg_ssa. r? @eddyb cc @sunfishcode
2018-12-02Run name-anon-globals after all other passesNikita Popov-4/+5
name-anon-globals should always be run at the very end of the pass pipeline, as optimization passes (in particular mergefunc) may introduce new anonymous globals. I believe we did not run into this earlier because it requires the rather specific combination of a) mergefunc merging two weak functions b) compilation not using thinlto.
2018-12-01Rollup merge of #56341 - frewsxcv:frewsxcv-util-cstr, r=Mark-Simulacrumkennytm-23/+11
Rename conversion util; remove duplicate util in librustc_codegen_llvm.
2018-11-30Enable -mergefunc-use-aliasesNikita Popov-0/+4
If the Rust LLVM fork is used, enable the -mergefunc-use-aliases flag, which will create aliases for merged functions, rather than inserting a call from one to the other. A number of codegen tests needed to be adjusted, because functions that previously fell below the thunk limit are now being merged. Merging is prevented either using -C no-prepopulate-passes, or by making the functions non-identical. I expect that this is going to break something, somewhere, because it isn't able to deal with aliases properly, but we won't find out until we try :) This fixes #52651.
2018-11-29Add template parameter debuginfo to generic typesTom Tromey-8/+65
This changes debuginfo generation to add template parameters to generic types. With this change the DWARF now has DW_TAG_template_type_param for types, not just for functions, like: <2><40d>: Abbrev Number: 6 (DW_TAG_structure_type) <40e> DW_AT_name : (indirect string, offset: 0x375): Generic<i32> <412> DW_AT_byte_size : 4 <413> DW_AT_alignment : 4 ... <3><41f>: Abbrev Number: 8 (DW_TAG_template_type_param) <420> DW_AT_type : <0x42a> <424> DW_AT_name : (indirect string, offset: 0xa65e): T Closes #9224
2018-11-29Auto merge of #49878 - dlrobertson:va_list_pt0, r=eddybbors-13/+215
libcore: Add VaList and variadic arg handling intrinsics ## Summary - Add intrinsics for `va_start`, `va_end`, `va_copy`, and `va_arg`. - Add `core::va_list::VaList` to `libcore`. Part 1 of (at least) 3 for #44930 Comments and critiques are very much welcomed 😄
2018-11-29Move get_static from CodegenCx to Builderbjorn3-29/+36
2018-11-29Use implicit deref instead of BuilderMethods::cx()bjorn3-166/+166
2018-11-29Require Deref to CodegenCx for HasCodegenbjorn3-1/+8
2018-11-29Rename static_bitcast to const_bitcastbjorn3-6/+6
2018-11-29Remove static_addr_of_mut from cg_ssabjorn3-3/+3
2018-11-29Rename StaticMethods::static_ptrcast to ConstMethods::const_ptrcastbjorn3-5/+5
2018-11-29Remove static_bitcast from cg_ssabjorn3-7/+8
2018-11-29Remove an unnecessary referencebjorn3-1/+1
2018-11-29Move IntrinsicCallMethods::call_overflow_intrinsics to ↵bjorn3-74/+74
BuilderMethods::checked_binop
2018-11-29Remove call_lifetime_intrinsic from cg_ssabjorn3-16/+18
2018-11-29Don't use llvm intrinsic names in cg_ssabjorn3-2/+91
2018-11-29Remove static_replace_all_uses and statics_to_rauw from cg_ssabjorn3-10/+7
2018-11-29Make ConstMethods and StaticMethods require BackendTypes instead of Backendbjorn3-1/+1
2018-11-29Some refactoringsbjorn3-16/+16
2018-11-29Rename conversion util; remove duplicate util in librustc_codegen_llvm.Corey Farwell-23/+11