summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
AgeCommit message (Collapse)AuthorLines
2019-01-24Simplify the version checkTom Tromey-4/+3
Address the review comments by simplifying the version check to just "< 8".
2019-01-24Fix issue 57762Tom Tromey-1/+5
Issue 57762 points out a compiler crash when the compiler was built using a stock LLVM 7. LLVM 7 was released without a necessary fix for a bug in the DWARF discriminant code. This patch changes rustc to use the fallback mode on (non-Rust) LLVM 7. Closes #57762
2019-01-14rustc: Remove platform intrinsics crateAlex Crichton-138/+1
This was originally attempted in #57048 but it was realized that we could fully remove the crate via the `"unadjusted"` ABI on intrinsics. This means that all intrinsics in stdsimd are implemented directly against LLVM rather than using the abstraction layer provided here. That ends up meaning that this crate is no longer used at all. This crate developed long ago to implement the SIMD intrinsics, but we didn't end up using it in the long run. In that case let's remove it!
2019-01-12Use `ptr::eq` where applicableIgor Matuszewski-3/+5
2019-01-04add support for principal-less trait object typesAriel Ben-Yehuda-9/+15
should be a pure refactoring.
2018-12-30Add `-Z instrument-mcount`Jun Wu-0/+13
This flag inserts `mcount` function call to the beginning of every function after inline processing. So tracing tools like uftrace [1] (or ftrace for Linux kernel modules) have a chance to examine function calls. It is similar to the `-pg` flag provided by gcc or clang, but without generating a `__gmon_start__` function for executables. If a program runs without being traced, no `gmon.out` will be written to disk. Under the hood, it simply adds `"instrument-function-entry-inlined"="mcount"` attribute to every function. The `post-inline-ee-instrument` LLVM pass does the actual job. [1]: https://github.com/namhyung/uftrace
2018-12-26Store `Ident` rather than just `Name` in HIR types `Item` and `ForeignItem`.Alexander Regueiro-7/+7
2018-12-25Remove licensesMark Rousskov-418/+0
2018-12-25Auto merge of #56962 - nivkner:fixme_fixup4, r=pnkfelixbors-26/+6
address some FIXME whose associated issues were marked as closed part of #44366
2018-12-24Rollup merge of #57085 - glaubitz:sparc64-abi-fix, r=nagisaMazdak Farrokhzad-2/+6
librustc_codegen_llvm: Don't eliminate empty structs in C ABI on linux-sparc64 This is in accordance with the SPARC Compliance Definition 2.4.1, Page 3P-12. It says that structs of up to 8 bytes (which applies to empty structs as well) are to be passed in one register.
2018-12-23librustc_codegen_llvm: Don't eliminate empty structs in C ABI on linux-sparc64Michael Karcher-2/+6
This is in accordance with the SPARC Compliance Definition 2.4.1, Page 3P-12. It says that structs of up to 8 bytes (which applies to empty structs as well) are to be passed in one register.
2018-12-21Enable emission of alignment attrs for pointer paramsNikita Popov-6/+4
Instead disable creation of assumptions during inlining using an LLVM opt flag. The -Z arg-align-attributes option which previously controlled this behavior is removed.
2018-12-19FIXME(52456) remove fixme and combine all extern items in one blockNiv Kaminer-26/+6
2018-12-19Auto merge of #56397 - petrhosek:file-search, r=cramertjbors-5/+19
Search other library paths when loking for link objects Support the case when link objects are not located in Rust sysroot but in other locations which could be specify through library paths.
2018-12-18Search other library paths when loking for link objectsPetr Hosek-5/+19
Support the case when link objects are not located in Rust sysroot but in other locations which could be specify through library paths.
2018-12-17Auto merge of #56642 - nikic:llvm-6, r=alexcrichtonbors-15/+4
Bump minimum required LLVM version to 6.0 Based on the discussion in #55842, while the overall position of Rust wrt LLVM continues to be contentious, there does seem to be a consensus that there is no need for continued support of LLVM 5. This PR bumps our version requirement to LLVM 6.0 and makes Travis run against that. I hope that this is going to unblock #52694. If I understand correctly, while this issue still exists in LLVM 6, Ubuntu has backported the relevant patch. r? @alexcrichton
2018-12-16Rollup merge of #56826 - alexcrichton:atomic-u128, r=gnzlbgMazdak Farrokhzad-0/+2
rustc: Add the `cmpxchg16b` target feature on x86/x86_64 This appears to be called `cx16` in LLVM and a few other locations, but the Intel Intrinsic Guide doesn't have a name for this and the CPU manual from Intel only mentions `cmpxchg16b`, so that's the name chosen here.
2018-12-14rustc: Add the `cmpxchg16b` target feature on x86/x86_64Alex Crichton-0/+2
This appears to be called `cx16` in LLVM and a few other locations, but the Intel Intrinsic Guide doesn't have a name for this and the CPU manual from Intel only mentions `cmpxchg16b`, so that's the name chosen here.
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.