about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/llvm_util.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-368/+0
2020-08-12Change registered "program name" for -Cllvm-args usage messagesRich Kadel-1/+2
While debugging a codegen issue, I tried adding LLVM options with the rustc -Cllvm-args option, and was confused by the error and usage messaging. The LLVM "program name" argument is set to "rustc", and command line error messages make it look like invalid arguments are "rustc" arguments, not LLVM. I changed this argument so error messages and the "-help" usage feedback is easier to understand and react to. (Clang does something similar.)
2020-07-10Avoid "whitelist"Tamir Duberstein-29/+28
Other terms are more inclusive and precise.
2020-07-02Check for feature with pre-interned symbolChristopher Serr-1/+1
2020-07-02Use WASM's saturating casts if they are availableChristopher Serr-2/+5
WebAssembly supports saturating floating point to integer casts behind a target feature. The feature is already available on many browsers. Beginning with 1.45 Rust will start defining the behavior of floating point to integer casts to be saturating as well. For this Rust constructs additional checks on top of the `fptoui` / `fptosi` instructions it emits. Here we introduce the possibility for the codegen backend to construct saturating casts itself and only fall back to constructing the checks ourselves if that is not possible.
2020-06-21Fix handling of reserved registers for ARM inline asmAmanieu d'Antras-0/+4
2020-05-21Enable ARM TME (Transactional Memory Extensions)Mahmut Bulut-0/+1
2020-05-18Add RISC-V target featuresAmanieu d'Antras-0/+11
2020-04-26codegen_llvm: Simplify logic for relaxing PIC into PIEVadim Petrochenkov-2/+2
2020-04-14Update the minimum external LLVM to 8Josh Stone-11/+9
LLVM 8 was released on March 20, 2019, over a year ago.
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-1/+1
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-1/+1
2020-03-24Invert `-Z generate-arange-section`.Nicholas Nethercote-2/+1
Because it uses `parse_bool` and defaults to true, it is actually impossible to set it to false. Inverting its sense to `-Z no-generate-arange-section` makes it usable.
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-2/+2
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-1/+1
2020-02-01Add support for enabling the LLVM time-trace featureWesley Wiser-0/+18
I found this helpful while investigating an LLVM performance issue. Passing `-Z llvm-time-trace` causes a `llvm_timings.json` file to be created. This file can be inspected in either the Chrome Profiler tools or with any other compatible tool like SpeedScope. More information on the LLVM feature: - https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/ - https://reviews.llvm.org/rL357340
2020-01-17Actually pass target LLVM args to LLVMJethro Beekman-2/+3
2020-01-10Allow specifying LLVM args in target specificationsJethro Beekman-9/+6
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-1/+1
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-1/+1
2019-12-22Format the worldMark Rousskov-43/+42
2019-12-20Remove rarely used -Zdisable_instrumentation_preinliner flag.Michael Woerister-3/+1
The same effect can be achieved by `-Cllvm-args=-disable-preinline`.
2019-12-20Allow -Cllvm-args to override rustc's default LLVM args.Michael Woerister-13/+33
2019-12-11rustc: Link LLVM directly into rustc againAlex Crichton-0/+1
This commit builds on #65501 continue to simplify the build system and compiler now that we no longer have multiple LLVM backends to ship by default. Here this switches the compiler back to what it once was long long ago, which is linking LLVM directly to the compiler rather than dynamically loading it at runtime. The `codegen-backends` directory of the sysroot no longer exists and all relevant support in the build system is removed. Note that `rustc` still supports a dynamically loaded codegen backend as it did previously, it just no longer supports dynamically loaded codegen backends in its own sysroot. Additionally as part of this the `librustc_codegen_llvm` crate now once again explicitly depends on all of its crates instead of implicitly loading them through the sysroot. This involved filling out its `Cargo.toml` and deleting all the now-unnecessary `extern crate` annotations in the header of the crate. (this in turn required adding a number of imports for names of macros too). The end results of this change are: * Rustbuild's build process for the compiler as all the "oh don't forget the codegen backend" checks can be easily removed. * Building `rustc_codegen_llvm` is much simpler since it's simply another compiler crate. * Managing the dependencies of `rustc_codegen_llvm` is much simpler since it's "just another `Cargo.toml` to edit" * The build process should be a smidge faster because there's more parallelism in the main rustc build step rather than splitting `librustc_codegen_llvm` out to its own step. * The compiler is expected to be slightly faster by default because the codegen backend does not need to be dynamically loaded. * Disabling LLVM as part of rustbuild is still supported, supporting multiple codegen backends is still supported, and dynamic loading of a codegen backend is still supported.
2019-12-02Rollup merge of #66918 - makotokato:aarch32-crc-crypto, r=petrochenkovMazdak Farrokhzad-0/+2
Add crc and crypto to target feature whitelist on arm aarch32 (ARMv8 32-bit) supports crc and crypto.
2019-11-30Add crc and crypto to target feature whitelist on armMakoto Kato-0/+2
2019-11-30move UnstableFeatures -> rustc_featureMazdak Farrokhzad-1/+1
2019-11-18Generate DWARF address ranges for faster lookupsJosh Stone-0/+3
This adds a new option `-Zgenerate-arange-section`, enabled by default, corresponding to LLVM's `-generate-arange-section`. This creates a `.debug_aranges` section with DWARF address ranges, which some tools depend on to optimize address lookups (elfutils [22288], [25173]). This only has effect when debuginfo is enabled, and the additional data is small compared to the other debug sections. For example, libstd.so with full debuginfo is about 11MB, with just 61kB in aranges. [22288]: https://sourceware.org/bugzilla/show_bug.cgi?id=22288 [25173]: https://sourceware.org/bugzilla/show_bug.cgi?id=25173 Closes #45246.
2019-10-25FormattingThomas Lively-1/+2
2019-10-25Re-enable Emscripten's exception handling supportThomas Lively-1/+5
Passes LLVM codegen and Emscripten link-time flags for exception handling if and only if the panic strategy is `unwind`. Sets the default panic strategy for Emscripten targets to `unwind`. Re-enables tests that depend on unwinding support for Emscripten, including `should_panic` tests.
2019-10-16Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-2/+1
- Compatible with Emscripten 1.38.46-upstream or later upstream. - Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the old incorrect wasm32 C call ABI with the correct one, preserving the old one as wasm32_bindgen_compat for wasm-bindgen compatibility. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-05Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, ↵Tyler Mandry-1/+2
r=alexcrichton" This reverts commit 7870050796e5904a0fc85ecbe6fa6dde1cfe0c91, reversing changes made to 2e7244807a7878f6eca3eb7d97ae9b413aa49014.
2019-10-04Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-2/+1
- Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the incorrect wasm32 C call ABI with the old asmjs version, which is correct for both wasm32 and JS. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Temporarily makes Emscripten targets use panic=abort by default because supporting unwinding will require an LLVM patch.
2019-07-22add support for hexagon-unknown-linux-muslBrian Cain-1/+1
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-67/+68
2019-04-23Add f16c target_featuregnzlbg-0/+1
2019-04-19Rollup merge of #60097 - cuviper:llvm8-mergefunc-use-aliases, r=rkruppeMazdak Farrokhzad-1/+1
Use -mergefunc-use-aliases for any LLVM >= 8 This functionality is not specific to Rust's LLVM, but any starting in LLVM 8.0, as noted in <https://github.com/rust-lang/rust/pull/56358#discussion_r237702197>. cc @nikic r? @rkruppe
2019-04-18Use -mergefunc-use-aliases for any LLVM >= 8Josh Stone-1/+1
2019-04-17whitelist rtm x86 cpu featuretyler-0/+1
2019-02-18librustc_codegen_llvm => 2018Taiki Endo-2/+2
2019-02-14Whitelist the ARM v8 target-featuregnzlbg-0/+1
2019-02-13Whitelist the ARM v6 target-featuregnzlbg-0/+1
2019-01-30Add MOVBE featureJethro Beekman-0/+1
2019-01-24Implement optimize(size) and optimize(speed)Simonas Kazlauskas-3/+3
2019-01-05Add a target option "merge-functions" taking values in ("disabled",Peter Jin-1/+9
"trampolines", or "aliases (the default)) to allow targets to opt out of the MergeFunctions LLVM pass. Also add a corresponding -Z option with the same name and values. This works around: https://github.com/rust-lang/rust/issues/57356 Motivation: Basically, the problem is that the MergeFunctions pass, which rustc currently enables by default at -O2 and -O3, and `extern "ptx-kernel"` functions (specific to the NVPTX target) are currently not compatible with each other. If the MergeFunctions pass is allowed to run, rustc can generate invalid PTX assembly (i.e. a PTX file that is not accepted by the native PTX assembler ptxas). Therefore we would like a way to opt out of the MergeFunctions pass, which is what our target option does. Related work: The current behavior of rustc is to enable MergeFunctions at -O2 and -O3, and also to enable the use of function aliases within MergeFunctions. MergeFunctions both with and without function aliases is incompatible with the NVPTX target. clang's "solution" is to have a "-fmerge-functions" flag that opts in to the MergeFunctions pass, but it is not enabled by default.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-21Enable emission of alignment attrs for pointer paramsNikita Popov-0/+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-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-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-11-30Enable -mergefunc-use-aliasesNikita Popov-0/+3
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.