about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/base.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-959/+0
2020-08-24hir: consistent use and naming of lang itemsDavid Wood-2/+2
This commit adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module. Signed-off-by: David Wood <david@davidtw.co>
2020-07-10Avoid "whitelist"Tamir Duberstein-3/+2
Other terms are more inclusive and precise.
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-1/+1
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-1/+1
2020-05-20Factor out `NativeLibKind::Dylib` from `NativeLibKind::Unspecified`Vadim Petrochenkov-1/+1
2020-05-20Rename some types describing native librariesVadim Petrochenkov-1/+2
NativeLibrary(Kind) -> NativeLib(Kind) NativeStatic -> StaticBundle NativeStaticNobundle -> StaticNoBundle NativeFramework -> Framework NativeRawDylib -> RawDylib NativeUnknown -> Unspecified
2020-05-09Fix disagreeement about CGU reuse and LTOAlex Crichton-5/+15
This commit fixes an issue where the codegen backend's selection of LTO disagreed with what the codegen later thought was being done. Discovered in #72006 we have a longstanding issue where if `-Clinker-plugin-lto` in optimized mode is compiled incrementally it will always panic on the second compilation. The underlying issue turned out to be that the production of the original artifact determined that LTO should not be done (because it's being postponed to the linker) but the CGU reuse selection thought that LTO was done so it was trying to load pre-LTO artifacts which were never generated. The fix here is to ensure that the logic when generating code which determines what kind of LTO is being done is shared amongst the CGU reuse decision and the backend actually doing LTO. This means that they'll both be in agreement about whether the previous compilation did indeed produce incremental pre-LTO artifacts. Closes #72006
2020-05-01Mark query function as must_use.Camille GILLOT-1/+1
2020-04-28Use the query system to allocate.Camille GILLOT-1/+1
2020-04-27Change return type of `entry_fn` query to return a `LocalDefId`marmeladema-3/+3
2020-04-22Rollup merge of #70970 - eddyb:trait-vs-impl-mismatch, r=oli-obkDylan DPC-0/+1
Detect mistyped associated consts in `Instance::resolve`. *Based on #71049 to prevent redundant/misleading downstream errors.* Fixes #70942 by refusing to resolve an associated `const` if it doesn't have the same type in the `impl` that it does in the `trait` (which we assume had errored, and `delay_span_bug` guards against bugs).
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-5/+2
2020-04-18Detect mistyped associated consts in `Instance::resolve`.Eduard-Mihai Burtescu-0/+1
2020-04-11Auto merge of #70161 - cjgillot:query-arena, r=nikomatsakisbors-3/+2
Allocate some query results on an arena This avoids a cloning few `Lrc` and `Vec`s in the queries.
2020-04-07Use assoc integer constants in librustc_*Linus Färnstrand-1/+1
2020-04-05Remove Arcs in queries.Camille GILLOT-3/+2
2020-04-02direct imports for langitem stuffMazdak Farrokhzad-1/+1
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-3/+4
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-11/+11
2020-03-27Rename TyLayout to TyAndLayout.Ana-Maria Mihalache-3/+3
2020-03-21Rollup merge of #69965 - mark-i-m:codegen-utils, r=eddybMazdak Farrokhzad-3/+1
Refactorings to get rid of rustc_codegen_utils r? @eddyb cc #45276 After this, the only modules left in `rustc_codegen_utils` are - `link`: a bunch of linking-related functions (many dealing with file names). These are mostly consumed by save analysis, rustc_driver, rustc_interface, and of course codegen. I assume they live here because we don't want a dependency of save analysis on codegen... Perhaps they can be moved to librustc? - ~`symbol_names` and `symbol_names_test`: honestly it seems odd that `symbol_names_test` is not a submodule of `symbol_names`. It seems like these could honestly live in their own crate or move to librustc. Already name mangling is exported as the `symbol_name` query.~ (move it to its own crate) I don't mind doing either of the above as part of this PR or a followup if you want.
2020-03-20remove redundant returns (clippy::needless_return)Matthias Krüger-2/+2
2020-03-19Refactorings to begin getting rid of rustc_codegen_utilsMark Mansi-3/+1
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-2/+2
2020-02-23Fail on multiple declarations of `main`.jumbatm-2/+2
Previously, when inserting the entry function, we only checked for duplicate _definitions_ of `main`. However, it's possible to cause problems even only having a duplicate _declaration_. For example, shadowing `main` using an extern block isn't caught by the current check, and causes an assertion failure down the line in in LLVM code.
2020-02-11Merge rustc::middle::*lang_items.Camille GILLOT-6/+3
2020-02-05Apply LLVM sanitize attributes to generated entry wrapperTomasz Miąsko-10/+12
2020-02-01Move builtin attribute logic to new rustc_attr crate.Mazdak Farrokhzad-1/+1
For now, this is all the crate contains, but more attribute logic & types will be moved there over time.
2020-01-11Rollup merge of #67889 - Zoxc:parallel-cgus, r=michaelwoeristerMazdak Farrokhzad-9/+77
Compile some CGUs in parallel at the start of codegen This brings the compilation time for `syntex_syntax` from 11.542s to 10.453s with 6 threads in non-incremental debug mode. Just compiling `n` CGUs in parallel at the beginning of codegen seems sufficient to get rid of the staircase effect, at least for `syntex_syntax`. Based on https://github.com/rust-lang/rust/pull/67777. r? @michaelwoerister cc @alexcrichton @Mark-Simulacrum
2020-01-10Auto merge of #65241 - tmiasko:no-std-san, r=alexcrichtonbors-4/+0
build-std compatible sanitizer support ### Motivation When using `-Z sanitizer=*` feature it is essential that both user code and standard library is instrumented. Otherwise the utility of sanitizer will be limited, or its use will be impractical like in the case of memory sanitizer. The recently introduced cargo feature build-std makes it possible to rebuild standard library with arbitrary rustc flags. Unfortunately, those changes alone do not make it easy to rebuild standard library with sanitizers, since runtimes are dependencies of std that have to be build in specific environment, generally not available outside rustbuild process. Additionally rebuilding them requires presence of llvm-config and compiler-rt sources. The goal of changes proposed here is to make it possible to avoid rebuilding sanitizer runtimes when rebuilding the std, thus making it possible to instrument standard library for use with sanitizer with simple, although verbose command: ``` env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Zsanitizer=thread cargo test -Zbuild-std --target x86_64-unknown-linux-gnu ``` ### Implementation * Sanitizer runtimes are no long packed into crates. Instead, libraries build from compiler-rt are used as is, after renaming them into `librusc_rt.*`. * rustc obtains runtimes from target libdir for default sysroot, so that they are not required in custom build sysroots created with build-std. * The runtimes are only linked-in into executables to address issue #64629. (in previous design it was hard to avoid linking runtimes into static libraries produced by rustc as demonstrated by sanitizer-staticlib-link test, which still passes despite changes made in #64780). cc @kennytm, @japaric, @firstyear, @choller
2020-01-10Fix some rebasing fallout.Michael Woerister-10/+2
2020-01-10Initial support for recording query keys in self-profiling data.Michael Woerister-3/+3
2020-01-10self-profile: Switch to new approach for event_id generation that enables ↵Michael Woerister-8/+23
query-invocation-specific event_ids.
2020-01-09Precompile CGUs while the main thread has the implicit job server tokenJohn Kåre Alsaker-38/+63
2020-01-09Compile some CGUs in parallel at the start of codegenJohn Kåre Alsaker-8/+51
2020-01-09Remove sanitizer_runtime attributeTomasz Miąsko-4/+0
2020-01-09Change -Z time event naming scheme and make them generic activitiesJohn Kåre Alsaker-5/+5
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-10/+6
2020-01-04canonicalize FxHash{Map,Set} importsMazdak Farrokhzad-1/+1
2020-01-04extract rustc::middle::codegen_fn_attrsMazdak Farrokhzad-1/+2
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-1/+1
2019-12-24x.py fmt after previous deignoreMark Rousskov-133/+143
2019-12-04Auto merge of #65947 - eddyb:fn-abi, r=oli-obk,nagisabors-7/+1
rustc: split FnAbi's into definitions/direct calls ("of_instance") and indirect calls ("of_fn_ptr"). After this PR: * `InstanceDef::Virtual` is only used for "direct" virtual calls, and shims around those calls use `InstanceDef::ReifyShim` (i.e. for `<dyn Trait as Trait>::f as fn(_)`) * this could easily be done for intrinsics as well, to allow their reification, but I didn't do it * `FnAbi::of_instance` is **always** used for declaring/defining an `fn`, and for direct calls to an `fn` * this is great for e.g. https://github.com/rust-lang/rust/pull/65881 (`#[track_caller]`), which can introduce the "caller location" argument into "codegen signatures" by only changing `FnAbi::of_instance`, after this PR * `FnAbi::of_fn_ptr` is used primarily for indirect calls, i.e. to `fn` pointers * *not* virtual calls (which use `FnAbi::of_instance` with `InstanceDef::Virtual`) * there's also a couple uses where the `rustc_codegen_llvm` needs to declare (i.e. FFI-import) an LLVM function that has no Rust declaration available at all * at least one of them could probably be a "weak lang item" instead As there are many steps, this PR is best reviewed commit by commit - some of which arguably should be in their own PRs, I may have gotten carried away a bit. cc @nagisa @rkruppe @oli-obk @anp
2019-12-03Move cgu_reuse_tracker to librustc_sessionMark Rousskov-1/+1
2019-12-03rustc_codegen_ssa: make codegen_instance a simple wrapper for codegen_mir.Eduard-Mihai Burtescu-7/+1
2019-12-02Simplify BodyCache impl and fix all remaining type errors in librustc_mir ↵Paul Daniel Faria-3/+0
(lifetime errors still exist)
2019-12-02Remove Body from FunctionCx, pass it along during librustc_codegen_ssaPaul Daniel Faria-2/+2
2019-12-02Simplify Cache wrapper to single type, impl Deref on it, fix all compilation ↵Paul Daniel Faria-1/+4
errors in librustc_codegen_ssa