summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/base.rs
AgeCommit message (Collapse)AuthorLines
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
2019-11-21Aggregation of drive-by cosmetic changes.Alexander Regueiro-35/+38
2019-11-11Move allocator_kind to CrateStoreMark Rousskov-1/+1
Similarly to the previous commit, there's no need for this to be in Session and have a Once around it.
2019-11-02Convert `x.as_str().to_string()` to `x.to_string()` where possible.Nicholas Nethercote-4/+2
2019-10-28self-profiling: Record something more useful for crate metadata generation ↵Michael Woerister-2/+0
event. Before this commit, we had an event that would only track the compression step for proc-macros and Rust dylibs. After the commit we measure the time for acutally generating the crate metadata bytes.
2019-10-23Rollup merge of #65657 - nnethercote:rm-InternedString-properly, r=eddybMazdak Farrokhzad-2/+2
Remove `InternedString` This PR removes `InternedString` by converting all occurrences to `Symbol`. There are a handful of places that need to use the symbol chars instead of the symbol index, e.g. for stable sorting; local conversions `LocalInternedString` is used in those places. r? @eddyb
2019-10-21Code cleanups following up on #65576.Dan Gohman-13/+24
This makes a few code cleanups to follow up on the review comments in https://github.com/rust-lang/rust/pull/65576.
2019-10-21Use `Symbol` for codegen unit names.Nicholas Nethercote-2/+2
This is a straightforward replacement except for two places where we have to convert to `LocalInternedString` to get a stable sort.
2019-10-19Rollup merge of #65448 - eddyb:codegen-box-less-special, r=oli-obkMazdak Farrokhzad-27/+19
rustc_codegen_ssa: remove some unnecessary Box special-casing. Could help simplify #60900. r? @nikomatsakis
2019-10-17Don't add `argc` and `argv` arguments to `main` on WASI.Dan Gohman-7/+18
Add a target setting to allow targets to specify whether the generated `main` function should be passed `argc` and `argv` arguments. Set it to false on wasm32-wasi, since WASI's `args::args()` calls into the WASI APIs itself. This will allow the WASI toolchain to avoid linking and running command-line argument initialization code when the arguments aren't actually needed.
2019-10-15rustc_codegen_ssa: remove some unnecessary Box special-casing.Eduard-Mihai Burtescu-27/+19
2019-10-13Remove MiscMethods::instancesbjorn3-4/+3
2019-10-13Inline functions from cg_ssa::callee and remove the modbjorn3-5/+7
Fixes #65271
2019-10-01Rollup merge of #64840 - michaelwoerister:self-profiling-raii-refactor, ↵Tyler Mandry-4/+1
r=wesleywiser SelfProfiler API refactoring and part one of event review This PR refactors the `SelfProfiler` a little bit so that most profiling methods are RAII-based. The codegen backend code already had something similar, this refactoring pulls this functionality up into `SelfProfiler` itself, for general use. The second commit of this PR is a review and update of the existing events we are already recording. Names have been made more consistent. CGU names have been removed from event names. They will be added back in when function parameter recording is implemented. There is still some work to be done for adding new events, especially around trait resolution and the incremental system. r? @wesleywiser
2019-09-30Self-Profiling: Make names of existing events more consistent and use new API.Michael Woerister-4/+1
2019-09-29remove indexed_vec re-export from rustc_data_structurescsmoe-1/+1
2019-09-26Rollup merge of #64772 - Mark-Simulacrum:no-tyctxt-tx, r=eddybMazdak Farrokhzad-18/+7
Remove tx_to_llvm_workers from TyCtxt This can be kept within the codegen backend crates entirely -- there's no reason for us to create it outside and attempt to hold it in the (global) context. Changes here aren't really too easily reviewable I suspect -- not sure if they can be cleaned up by splitting into more commits though, it's just hard to reason about `Box<Any>` in general. If there are thoughts though I'd be happy to hear them. The primary goal of this PR is to get rid of the field on `rustc_interface::Queries`.
2019-09-25Remove tx_to_llvm_workers from TyCtxtMark Rousskov-18/+7
This can be kept within the codegen backend crates entirely
2019-09-25Rename `sty` to `kind`varkor-4/+4
2019-09-23rustc: Convert `dependency_formats` to a queryAlex Crichton-1/+2
This commit converts a field of `Session`, `dependency_formats`, into a query of `TyCtxt`. This information then also needed to be threaded through to other remaining portions of the linker, but it's relatively straightforward. The only change here is that instead of `HashMap<CrateType, T>` the data structure changed to `Vec<(CrateType, T)>` to make it easier to deal with in queries.
2019-08-28Add Option<Span> to `require_lang_item`Yuki Okushi-1/+1
2019-08-05Fiddle param env through to `try_eval_bits` in most placesOliver Scherer-1/+1
2019-08-05Don't abort on unevaluated constants without at least tryting to eval themOliver Scherer-1/+1
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-6/+0
rustbuild Remove some random unnecessary lint `allow`s
2019-07-12Replace `struct_tail` and `struct_lockstep_tails` with variants handling ↵Felix S. Klock II-1/+2
normalization. The old struct tail functions did not deal with `<T as Trait>::A` and `impl Trait`, at least not explicitly. (We didn't notice this bug before because it is only exposed when the tail (post deep normalization) is not `Sized`, so it was a rare case to deal with.) For post type-checking (i.e. during codegen), there is now `struct_tail_erasing_lifetimes` and `struct_lockstep_tails_erasing_lifetimes`, which each take an additional `ParamEnv` argument to drive normalization. For pre type-checking cases where normalization is not needed, there is `struct_tail_without_normalization`. (Currently, the only instance of this is `Expectation::rvalue_hint`.) All of these new entrypoints work by calling out to common helper routines. The helpers are parameterized over a closure that handles the normalization.
2019-07-08normalize use of backticks for compiler messages in librustc_codegenSamy Kacimi-1/+1
https://github.com/rust-lang/rust/issues/60532
2019-07-05Add a "total" measurement to -Ztime-passes.Nicholas Nethercote-1/+4
This is useful for getting the total compilation time at the end. To do this, the patch changes `print_time_passes_entry` to not increment the depth, which means that `print_time_passes_entry_internal` is no longer needed.
2019-07-03Remove needless lifetimesJeremy Stucki-1/+1
2019-06-18Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-9/+7
2019-06-18rustc: reintroduce lifetime bounds where necessary.Eduard-Mihai Burtescu-1/+1
2019-06-18rustc: remove 'x: 'y bounds (except from comments/strings).Eduard-Mihai Burtescu-12/+12
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-5/+5
2019-06-12Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-6/+3
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-5/+5
2019-06-12Fix fallout from `deny(unused_lifetimes)`.Eduard-Mihai Burtescu-2/+2
2019-06-12rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.Eduard-Mihai Burtescu-3/+3
2019-06-02move codegenunitext to rustc::mir::monoMark Mansi-1/+0
2019-06-02move monoitemext to inherent methodsMark Mansi-3/+1
2019-06-02move DefPathBasedNames to ty::print::obsoleteMark Mansi-0/+1
2019-06-02remove reexports of mir::mono::{MonoItem,CodegenUnit}Mark Mansi-2/+2
2019-06-02remove reexport of rustc::ty::InstanceMark Mansi-2/+1
2019-05-29rustc_codegen_llvm: remove LLVM instruction count stats.Eduard-Mihai Burtescu-62/+2
2019-05-29rustc_codegen_ssa: remove obsolete codegen stats.Eduard-Mihai Burtescu-10/+0
2019-05-23Update foreign_modules and dllimport_foreign_itemsJohn Kåre Alsaker-2/+1
2019-04-30Move metadata encoding earlier.Nicholas Nethercote-27/+21
This commit separates metadata encoding (`tcx.encode_metadata`) from the creation of the metadata module (which is now handled by `write_compressed_metadata`, formerly `write_metadata`). The metadata encoding now occurs slightly earlier in the pipeline, at the very start of code generation within `start_codegen`. Metadata *writing* still occurs near the end of compilation; that will be moved forward in subsequent commits.