about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back
AgeCommit message (Collapse)AuthorLines
2020-02-27use char instead of &str for single char patternsMatthias Krüger-1/+1
2020-02-13add selfprofiling for new llvm passmanagerAndreas Jonson-2/+79
2020-02-12Add support for new pass managerNikita Popov-18/+121
The new pass manager can be enabled using -Z new-llvm-pass-manager=on.
2020-02-10self-profile: Support arguments for generic_activities.Michael Woerister-57/+69
2020-01-09Change -Z time event naming scheme and make them generic activitiesJohn Kåre Alsaker-9/+25
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-2/+2
2020-01-05Use self profile infrastructure for -Z time and -Z time-passesJohn Kåre Alsaker-111/+96
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-1/+1
2019-12-24x.py fmt after previous deignoreMark Rousskov-242/+251
2019-12-22Format the worldMark Rousskov-301/+266
2019-12-20save LTO import information and check it when trying to reuse build products.Felix S. Klock II-10/+114
adopts simple strategy devised with assistance from mw: Instead of accumulating (and acting upon) LTO import information over an unbounded number of prior compilations, just see if the current import set matches the previous import set. if they don't match, then you cannot reuse the PostLTO build product for that module. In either case (of a match or a non-match), we can (and must) unconditionally emit the current import set as the recorded information in the incremental compilation cache, ready to be loaded during the next compiler run for use in the same check described above. resolves issue 59535.
2019-12-11rustc: Link LLVM directly into rustc againAlex Crichton-4/+8
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-07Rollup merge of #67033 - cuviper:ValueName2, r=rkruppeYuki Okushi-4/+4
Migrate to LLVM{Get,Set}ValueName2 The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated strings, but the `2` variants use explicit lengths, which fits better with Rust strings and slices. We now use these in new helper functions `llvm::{get,set}_value_name` that convert to/from `&[u8]`. Closes #64223. r? @rkruppe
2019-12-05Auto merge of #66952 - 0dvictor:print, r=rkruppebors-8/+5
Use Module::print() instead of a PrintModulePass llvm::Module has a print() method. It is unnecessary to create a pass just for the purpose of printing LLVM IR.
2019-12-04Migrate to LLVM{Get,Set}ValueName2Josh Stone-4/+4
The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated strings, but the `2` variants use explicit lengths, which fits better with Rust strings and slices. We now use these in new helper functions `llvm::{get,set}_value_name` that convert to/from `&[u8]`.
2019-12-03Rollup merge of #66957 - parthsane:pvs/ftx_lld_linker, r=alexcrichtonMazdak Farrokhzad-1/+2
Change Linker for x86_64-fortanix-unknown-sgx target to rust-lld Changed linker for `x86_64-fortanix-unknown-sgx` target to `rust-lld` This change needed the RelaxELFRelocations flag to be set for it to work correctly r? @jethrogb
2019-12-03Move cgu_reuse_tracker to librustc_sessionMark Rousskov-1/+1
2019-12-03Change linker for x86_64-fortanix-unknown-sgx to rust-lldParth Sane-1/+2
For SGX, the relocation using the relocation table is done by the code in rust/src/libstd/sys/sgx/abi/reloc.rs and this code should not require relocation. Setting RelaxELFRelocations flag if allows this to happen, hence adding a Target Option for it.
2019-12-02Use Module::print() instead of a PrintModulePassVictor Ding-8/+5
llvm::Module has a print() method. It is unnecessary to create a pass just for the purpose of printing LLVM IR.
2019-12-01rustc_plugin: Remove support for plugins adding LLVM passesVadim Petrochenkov-14/+0
2019-11-29Use LLVMAddAnalysisPasses instead of Rust's wrapperVictor Ding-4/+4
LLVM exposes a C API `LLVMAddAnalysisPasses` and hence Rust's own wrapper `LLVMRustAddAnalysisPasses` is not needed anymore.
2019-11-22Create sanitizer passes in a separate functionTomasz Miąsko-20/+26
2019-11-22Add support for tracking origins of uninitialized memoryTomasz Miąsko-2/+2
2019-11-22Add support for sanitizer recoveryTomasz Miąsko-2/+1
2019-11-22Move sanitizer passes creation from ssa to llvmTomasz Miąsko-4/+25
2019-11-13Revert "Auto merge of #65134 - ↵Robin Kruppe-1/+3
davidtwco:issue-19834-improper-ctypes-in-extern-C-fn, r=rkruppe" This reverts commit 3f0e16473de5ec010f44290a8c3ea1d90e0ad7a2, reversing changes made to 61a551b4939ec1d5596e585351038b8fbd0124ba.
2019-11-06Auto merge of #65134 - davidtwco:issue-19834-improper-ctypes-in-extern-C-fn, ↵bors-3/+1
r=rkruppe improper_ctypes: `extern "C"` fns cc #19834. Fixes #65867. This pull request implements the change [described in this comment](https://github.com/rust-lang/rust/issues/19834#issuecomment-466671572). cc @rkruppe @varkor @shepmaster
2019-11-05codegen_llvm: remove unnecessary "extern C"David Wood-4/+1
Signed-off-by: David Wood <david@davidtw.co>
2019-11-05improper_ctypes: `extern "C"` fnsDavid Wood-0/+1
2019-10-29Allow specifying key "llvm-abiname" in target specificationGui Andrade-1/+2
This addresses #65024, as it allows RISC-V target specification files to set "llvm-abiname": "lp64d". In general, it is useful for the programmer to be able to set this codegen parameter, which other languages usually expose under a compiler argument like "-mabi=<XYZ>".
2019-10-29Auto merge of #65435 - michaelwoerister:fix-issue-64153, r=alexcrichtonbors-2/+4
Fix #64153 This PR changes how the compiler detects if an object file from an upstream crate is a Rust object file or not. Instead of checking if the name starts with the crate name and ends with `.o` (which is not always the case, as described in #64153), it now just checks if the filename ends with `.rcgu.o`. This fixes #64153. However, ideally we'd clean up the code around filename generation some more. Then this check could be made more robust. r? @alexcrichton
2019-10-22Fix issue #64153 by checking for .rcgu.o suffix when trying to identify Rust ↵Michael Woerister-2/+4
generated object files.
2019-10-18Avoid realloc in `CString::new`Shotaro Yamada-3/+1
2019-10-08Rollup merge of #65081 - Mark-Simulacrum:remove-profile-queries, ↵Mazdak Farrokhzad-6/+4
r=michaelwoerister Remove -Zprofile-queries r? @michaelwoerister Per [zulip thread](https://zulip-archive.rust-lang.org/131828tcompiler/57361RemoveZprofilequeries.html).
2019-10-05Replaces some instances of `as *[const | mut] _` with `.cast()`memoryruins-10/+10
2019-10-03Remove -Zprofile-queriesMark Rousskov-6/+4
2019-09-30Self-Profiling: Make names of existing events more consistent and use new API.Michael Woerister-54/+76
2019-09-11Use `Symbol` in `Linker`.Nicholas Nethercote-1/+2
2019-08-27rustc: Handle modules in "fat" LTO more robustlyAlex Crichton-45/+41
When performing a "fat" LTO the compiler has a whole mess of codegen units that it links together. To do this it needs to select one module as a "base" module and then link everything else into this module. Previously LTO passes assume that there's at least one module in-memory to link into, but nowadays that's not always true! With incremental compilation modules may actually largely be cached and it may be possible that there's no in-memory modules to work with. This commit updates the logic of the LTO backend to handle modules a bit more uniformly during a fat LTO. This commit immediately splits them into two lists, one serialized and one in-memory. The in-memory list is then searched for the largest module and failing that we simply deserialize the first serialized module and link into that. This refactoring avoids juggling three lists, two of which are serialized modules and one of which is half serialized and half in-memory. Closes #63349
2019-08-08Explain why we're sorting the modules.Joel Galenson-0/+1
2019-08-08Sort fat LTO modules later and add a test.Joel Galenson-2/+4
2019-07-15Don't add extra passes into the function pass managerNikita Popov-39/+49
Exception for specific cases like linting, additional passes should be going into the module pass manager (even if they are function passes). The separate function pass manager is only used for very early optimization passes. Rather than apparending passes to the MPM, use the OptimizerLast and EnabledOnOptLevel0 pass manager builder extension hooks, which allow adding passes directly before finalization (alias canonicalization and name-anon-globals). The main effect and purpose of this change is to add sanitizer passes at the end of the pipeline, which is where they belong. In LLVM 9 the address sanitizer can't be used as a pass in the early function pass manager, because it has a dependence on a module-level analysis pass.
2019-07-07Rollup merge of #62286 - petrhosek:rustc-no-duplicate-archives, r=cramertjMazdak Farrokhzad-3/+16
Check if the archive has already been added to avoid duplicates This avoids adding archives multiple times, which results in duplicate objects in the resulting rlib, leading to symbol collision and link failures. This could happen when crate contains multiple link attributes that all reference the same archive.
2019-07-04Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, ↵Mazdak Farrokhzad-2/+2
r=dtolnay,Centril Use mem::take instead of mem::replace with default
2019-07-03Remove needless lifetimesJeremy Stucki-3/+3
2019-07-02Check if the archive has already been added to avoid duplicatesPetr Hosek-3/+16
This avoids adding archives multiple times, which results in duplicate objects in the resulting rlib, leading to symbol collision and link failures. This could happen when crate contains multiple link attributes that all reference the same archive.
2019-07-01Convert more usages overChris Gregory-2/+2
2019-06-15Remove unnecessary `.clone()`Shotaro Yamada-1/+1
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-1/+1
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-1/+1