about summary refs log tree commit diff
path: root/src/librustc_driver
AgeCommit message (Collapse)AuthorLines
2017-05-02retool MIR passes completelyNiko Matsakis-19/+0
The new setup is as follows. There is a pipeline of MIR passes that each run **per def-id** to optimize a particular function. You are intended to request MIR at whatever stage you need it. At the moment, there is only one stage you can request: - `optimized_mir(def_id)` This yields the final product. Internally, it pulls the MIR for the given def-id through a series of steps. Right now, these are still using an "interned ref-cell" but they are intended to "steal" from one another: - `mir_build` -- performs the initial construction for local MIR - `mir_pass_set` -- performs a suite of optimizations and transformations - `mir_pass` -- an individual optimization within a suite So, to construct the optimized MIR, we invoke: mir_pass_set((MIR_OPTIMIZED, def_id)) which will build up the final MIR.
2017-05-02move to only def-id passesNiko Matsakis-1/+1
this temporary disables `inline`
2017-05-02rewrite `Passes` to have sets of passesNiko Matsakis-36/+38
Also, store the completed set of passes in the tcx.
2017-05-02introduce `DefIdPass` and remove all impls of `Pass` but `Inline`Niko Matsakis-22/+22
2017-05-02simplify the MirPass traits and passes dramaticallyNiko Matsakis-2/+1
Overall goal: reduce the amount of context a mir pass needs so that it resembles a query. - The hooks are no longer "threaded down" to the pass, but rather run automatically from the top-level (we also thread down the current pass number, so that the files are sorted better). - The hook now receives a *single* callback, rather than a callback per-MIR. - The traits are no longer lifetime parameters, which moved to the methods -- given that we required `for<'tcx>` objecs, there wasn't much point to that. - Several passes now store a `String` instead of a `&'l str` (again, no point).
2017-05-02rework `MirPass` API to be stateless and extract helper fnsNiko Matsakis-1/+1
2017-05-02introduce `mir_keys()`Niko Matsakis-13/+4
Each MIR key is a DefId that has MIR associated with it
2017-05-02Rollup merge of #41693 - est31:anon_params_removal, r=eddybCorey Farwell-1/+1
Removal pass for anonymous parameters Removes occurences of anonymous parameters from the rustc codebase, as they are to be deprecated. See issue #41686 and RFC 1685. r? @frewsxcv
2017-05-02Removal pass for anonymous parametersest31-1/+1
Removes occurences of anonymous parameters from the rustc codebase, as they are to be deprecated. See issue #41686 and RFC 1685.
2017-05-01patch the `librustc_driver` unit testsNiko Matsakis-28/+25
2017-05-01Add profiling support, through the rustc -Z profile flag.whitequark-3/+5
When -Z profile is passed, the GCDAProfiling LLVM pass is added to the pipeline, which uses debug information to instrument the IR. After compiling with -Z profile, the $(OUT_DIR)/$(CRATE_NAME).gcno file is created, containing initial profiling information. After running the program built, the $(OUT_DIR)/$(CRATE_NAME).gcda file is created, containing branch counters. The created *.gcno and *.gcda files can be processed using the "llvm-cov gcov" and "lcov" tools. The profiling data LLVM generates does not faithfully follow the GCC's format for *.gcno and *.gcda files, and so it will probably not work with other tools (such as gcov itself) that consume these files.
2017-04-30introduce per-fn RegionMapsTaylor Cramer-5/+2
Instead of requesting the region maps for the entire crate, request for a given item etc. Several bits of code were modified to take `&RegionMaps` as input (e.g., the `resolve_regions_and_report_errors()` function). I am not totally happy with this setup -- I *think* I'd rather have the region maps be part of typeck tables -- but at least the `RegionMaps` works in a "parallel" way to `FreeRegionMap`, so it's not too bad. Given that I expect a lot of this code to go away with NLL, I didn't want to invest *too* much energy tweaking it.
2017-04-30intern CodeExtentsNiko Matsakis-4/+4
Make a `CodeExtent<'tcx>` be something allocated in an arena instead of an index into the `RegionMaps`.
2017-04-30On-demandify region mappingTaylor Cramer-5/+6
2017-04-28Auto merge of #41508 - michaelwoerister:generic-path-remapping, r=alexcrichtonbors-3/+3
Implement a file-path remapping feature in support of debuginfo and reproducible builds This PR adds the `-Zremap-path-prefix-from`/`-Zremap-path-prefix-to` commandline option pair and is a more general implementation of #41419. As opposed to the previous attempt, this implementation should enable reproducible builds regardless of the working directory of the compiler. This implementation of the feature is more general in the sense that the re-mapping will affect *all* paths the compiler emits, including the ones in error messages. r? @alexcrichton
2017-04-26cache symbol names in ty::mapsAriel Ben-Yehuda-2/+2
this fixes a performance regression introduced in commit 39a58c38a0b9ac9e822a1732f073abe8ddf65cfb.
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-3/+3
reproducible builds.
2017-04-22cache attributes of items from foreign cratesAriel Ben-Yehuda-0/+2
this avoids parsing item attributes on each call to `item_attrs`, which takes off 33% (!) of translation time and 50% (!) of trans-item collection time.
2017-04-22avoid calling `mk_region` unnecessarilyAriel Ben-Yehuda-2/+2
this improves typeck & trans performance by 1%. This looked hotter on callgrind than it is on a CPU.
2017-04-21sort `provide`Niko Matsakis-1/+2
2017-04-21make `reachable_set` ref-countedNiko Matsakis-1/+1
Once it is computed, no need to deep clone the set.
2017-04-19propagate other obligations that were left outNiko Matsakis-3/+3
cc #32730 -- I left exactly one instance where I wasn't sure of the right behavior.
2017-04-18kill a bunch of one off tasksNiko Matsakis-2/+0
2017-04-16rustc: use monomorphic const_eval for cross-crate enum discriminants.Eduard-Mihai Burtescu-0/+2
2017-04-16rustc: expose monomorphic const_eval through on-demand.Eduard-Mihai Burtescu-1/+2
2017-04-15rustc: provide adt_sized_constraint as an on-demand query.Eduard-Mihai Burtescu-0/+1
2017-04-14Rollup merge of #40702 - mrhota:global_asm, r=nagisaCorey Farwell-0/+1
Implement global_asm!() (RFC 1548) This is a first attempt. ~~One (potential) problem I haven't solved is how to handle multiple usages of `global_asm!` in a module/crate. It looks like `LLVMSetModuleInlineAsm` overwrites module asm, and `LLVMAppendModuleInlineAsm` is not provided in LLVM C headers 😦~~ I can provide more detail as needed, but honestly, there's not a lot going on here. r? @eddyb CC @Amanieu @jackpot51 Tracking issue: #35119
2017-04-13use `tcx.crate_name(LOCAL_CRATE)` rather than `LinkMeta::crate_name`Niko Matsakis-1/+1
2017-04-12Add global_asm testsA.J. Gardner-0/+1
2017-04-12Rollup merge of #41232 - arielb1:mir-rvalues, r=eddybTim Neumann-6/+2
move rvalue checking to MIR
2017-04-12Rollup merge of #41141 - michaelwoerister:direct-metadata-ich-final, ↵Tim Neumann-0/+1
r=nikomatsakis ICH: Replace old, transitive metadata hashing with direct hashing approach. This PR replaces the old crate metadata hashing strategy with a new one that directly (but stably) hashes all values we encode into the metadata. Previously we would track what data got accessed during metadata encoding and then hash the input nodes (HIR and upstream metadata) that were transitively reachable from the accessed data. While this strategy was sound, it had two major downsides: 1. It was susceptible to generating false positives, i.e. some input node might have changed without actually affecting the content of the metadata. That metadata entry would still show up as changed. 2. It was susceptible to quadratic blow-up when many metadata nodes shared the same input nodes, which would then get hashed over and over again. The new method does not have these disadvantages and it's also a first step towards caching more intermediate results in the compiler. Metadata hashing/cross-crate incremental compilation is still kept behind the `-Zincremental-cc` flag even after this PR. Once the new method has proven itself with more tests, we can remove the flag and enable cross-crate support by default again. r? @nikomatsakis cc @rust-lang/compiler
2017-04-12Rollup merge of #41063 - nikomatsakis:issue-40746-always-exec-loops, r=eddybTim Neumann-0/+1
remove unnecessary tasks Remove various unnecessary tasks. All of these are "always execute" tasks that don't do any writes to tracked state (or else an assert would trigger, anyhow). In some cases, they issue lints or errors, but we''ll deal with that -- and anyway side-effects outside of a task don't cause problems for anything that I can see. The one non-trivial refactoring here is the borrowck conversion, which adds the requirement to go from a `DefId` to a `BodyId`. I tried to make a useful helper here. r? @eddyb cc #40746 cc @cramertj @michaelwoerister
2017-04-12ICH: Replace old, transitive metadata hashing with direct hashing approach.Michael Woerister-0/+1
Instead of collecting all potential inputs to some metadata entry and hashing those, we directly hash the values we are storing in metadata. This is more accurate and doesn't suffer from quadratic blow-up when many entries have the same dependencies.
2017-04-11Move rvalue checking to MIRAriel Ben-Yehuda-6/+2
Fixes #41139.
2017-04-11Fix some nitsSimonas Kazlauskas-1/+3
2017-04-11Initial attempt at implementing optimization fuel and re-enabling struct ↵Austin Hicks-0/+8
field reordering.
2017-04-07Rollup merge of #41056 - michaelwoerister:central-defpath-hashes, r=nikomatsakisCorey Farwell-2/+6
Handle DefPath hashing centrally as part of DefPathTable (+ save work during SVH calculation) In almost all cases where we construct a `DefPath`, we just hash it and throw it away again immediately. With this PR, the compiler will immediately compute and store the hash for each `DefPath` as it is allocated. This way we + can get rid of any subsequent `DefPath` hash caching (e.g. the `DefPathHashes`), + don't need to allocate a transient `Vec` for holding the `DefPath` (although I'm always surprised how little these small, dynamic allocations seem to hurt performance), and + we don't hash `DefPath` prefixes over and over again. That last part is because we construct the hash for `prefix::foo` by hashing `(hash(prefix), foo)` instead of hashing every component of prefix. The last commit of this PR is pretty neat, I think: ``` The SVH (Strict Version Hash) of a crate is currently computed by hashing the ICHes (Incremental Computation Hashes) of the crate's HIR. This is fine, expect that for incr. comp. we compute two ICH values for each HIR item, one for the complete item and one that just includes the item's interface. The two hashes are are needed for dependency tracking but if we are compiling non-incrementally and just need the ICH values for the SVH, one of them is enough, giving us the opportunity to save some work in this case. ``` r? @nikomatsakis This PR depends on https://github.com/rust-lang/rust/pull/40878 to be merged first (you can ignore the first commit for reviewing, that's just https://github.com/rust-lang/rust/pull/40878).
2017-04-07ICH: Centrally compute and cache DefPath hashes as part of DefPathTable.Michael Woerister-2/+6
2017-04-07Auto merge of #40873 - cramertj:on-demandify-queries, r=nikomatsakisbors-0/+1
On demandify reachability cc https://github.com/rust-lang/rust/issues/40746 I tried following this guidance from #40746: > The following tasks currently execute before a tcx is built, but they could be easily converted into queries that are requested after tcx is built. The main reason they are the way they are was to avoid a gratuitious refcell (but using the refcell map seems fine)... but the result of moving `region_maps` out of `TyCtxt` and into a query caused a lot of churn, and seems like it could potentially result in a rather large performance hit, since it means a dep-graph lookup on every use of `region_maps` (rather than just a field access). Possibly `TyCtxt` could store a `RefCell<Option<RegionMap>>` internally and use that to prevent repeat lookups, but that feels like it's duplicating the work of the dep-graph. @nikomatsakis What did you have in mind for this?
2017-04-05Properly adjust filenames when multiple emissionsSimonas Kazlauskas-4/+3
Fixes #40993
2017-04-04push `borrowck` into its own taskNiko Matsakis-0/+1
2017-04-04On-demandify reachabilityTaylor Cramer-0/+1
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-2/+2
2017-03-27Rollup merge of #40751 - nrc:save-callback, r=eddybAlex Crichton-6/+5
save-analysis: allow clients to get data directly without writing to a file.
2017-03-27Fix various useless derefs and slicingsOliver Schneider-9/+9
2017-03-26Auto merge of #40826 - frewsxcv:rollup, r=frewsxcvbors-14/+10
Rollup of 7 pull requests - Successful merges: #40642, #40734, #40740, #40771, #40807, #40820, #40821 - Failed merges:
2017-03-26Auto merge of #40347 - alexcrichton:rm-liblog, r=brsonbors-3/+6
Remove internal liblog This commit deletes the internal liblog in favor of the implementation that lives on crates.io. Similarly it's also setting a convention for adding crates to the compiler. The main restriction right now is that we want compiler implementation details to be unreachable from normal Rust code (e.g. requires a feature), and by default everything in the sysroot is reachable via `extern crate`. The proposal here is to require that crates pulled in have these lines in their `src/lib.rs`: #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] This'll mean that by default they're not using these attributes but when compiled as part of the compiler they do a few things: * Mark themselves as entirely unstable via the `staged_api` feature and the `#![unstable]` attribute. * Allow usage of other unstable crates via `feature(rustc_private)` which is required if the crate relies on any other crates to compile (other than std).
2017-03-23convert privacy access levels into a queryNiko Matsakis-12/+8
2017-03-23Remove internal liblogAlex Crichton-3/+6
This commit deletes the internal liblog in favor of the implementation that lives on crates.io. Similarly it's also setting a convention for adding crates to the compiler. The main restriction right now is that we want compiler implementation details to be unreachable from normal Rust code (e.g. requires a feature), and by default everything in the sysroot is reachable via `extern crate`. The proposal here is to require that crates pulled in have these lines in their `src/lib.rs`: #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] This'll mean that by default they're not using these attributes but when compiled as part of the compiler they do a few things: * Mark themselves as entirely unstable via the `staged_api` feature and the `#![unstable]` attribute. * Allow usage of other unstable crates via `feature(rustc_private)` which is required if the crate relies on any other crates to compile (other than std).
2017-03-23move `export_map` into the tcxNiko Matsakis-3/+3