Skip to content

rework the queries for the MIR pipeline #41625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
May 3, 2017
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0e5e2f3
introduce `mir_keys()`
nikomatsakis Apr 25, 2017
11b6b06
rework `MirPass` API to be stateless and extract helper fns
nikomatsakis Apr 25, 2017
46b342f
simplify the MirPass traits and passes dramatically
nikomatsakis Apr 25, 2017
e9e6ccc
introduce `DefIdPass` and remove all impls of `Pass` but `Inline`
nikomatsakis Apr 27, 2017
668886a
rewrite `Passes` to have sets of passes
nikomatsakis Apr 27, 2017
f23a7bc
move to only def-id passes
nikomatsakis Apr 27, 2017
2b32cb9
retool MIR passes completely
nikomatsakis Apr 27, 2017
e89a321
rename `MirPassSet` to `MirSuite`
nikomatsakis Apr 28, 2017
29263fd
introduce idea of "stealable" MIR
nikomatsakis Apr 28, 2017
ecc8ff9
rework macro to prepare for more modifiers than just `[pub]`
nikomatsakis Apr 28, 2017
3d1095c
introduce `IntoKeyValues` trait to prepare for multi-queries
nikomatsakis Apr 28, 2017
1d675ce
adjust the macro to allow for `multi` modifier
nikomatsakis Apr 28, 2017
a26e966
convert the `inline` pass to use the new multi result
nikomatsakis Apr 28, 2017
0d045d7
add comments to `Steal` and use `bug!`
nikomatsakis Apr 29, 2017
d9c8a2b
use `force` to ensure const-qualif has been done, not read
nikomatsakis Apr 29, 2017
532439f
add a README describing the whole design
nikomatsakis Apr 29, 2017
c1ff104
rename `mir_map` to `queries` and remove `build_mir_for_crate`
nikomatsakis May 1, 2017
c2cfdbb
adjust privacy of various types in `build`
nikomatsakis May 1, 2017
69c8f9d
move `build_mir` into `build` directory
nikomatsakis May 2, 2017
c253df5
remove `Pass` and (temporarily) drop `Inline`
nikomatsakis May 1, 2017
9c154a6
rip out everything but `MirPass`, move the logic into suites
nikomatsakis May 1, 2017
669d316
simplify down to one query per pass suite
nikomatsakis May 1, 2017
1dd9c3e
support inlining by asking for optimizer mir for callees
nikomatsakis May 1, 2017
851a880
remove irrelevant comments
nikomatsakis May 1, 2017
2fa1ba3
pacify the mercilous tidy
nikomatsakis May 1, 2017
74b2783
delete dead code
nikomatsakis May 1, 2017
c7023d1
run MIR borrowck on the validated, not optimized, MIR
nikomatsakis May 2, 2017
393fa4f
rename from `item_mir` to `optimized_mir`
nikomatsakis May 2, 2017
b0092e8
move queries code into transform
nikomatsakis May 2, 2017
0afcfce
update comment about heuristics
nikomatsakis May 2, 2017
15bc2f4
remove temporary variable
nikomatsakis May 2, 2017
e6793ac
have borrowck fetch MIR, which will perform some errors
nikomatsakis May 2, 2017
afc5acd
fix librustc_driver
nikomatsakis May 2, 2017
25be798
remove `mir_passes` from `Session` and add a FIXME
nikomatsakis May 2, 2017
488b2a3
add FIXME to `Steal`
nikomatsakis May 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rework macro to prepare for more modifiers than just [pub]
  • Loading branch information
nikomatsakis committed May 2, 2017
commit ecc8ff9199118b88e98c903c9117fa2f0cddf8ab
45 changes: 40 additions & 5 deletions src/librustc/ty/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@ impl<'tcx> QueryDescription for queries::mir_pass<'tcx> {
macro_rules! define_maps {
(<$tcx:tt>
$($(#[$attr:meta])*
[$($pub:tt)*] $name:ident: $node:ident($K:ty) -> $V:ty,)*) => {
pub struct Maps<$tcx> {
providers: IndexVec<CrateNum, Providers<$tcx>>,
query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
$($(#[$attr])* $($pub)* $name: RefCell<DepTrackingMap<queries::$name<$tcx>>>),*
[$($modifiers:tt)*] $name:ident: $node:ident($K:ty) -> $V:ty,)*) => {
define_map_struct! {
tcx: $tcx,
input: ($(([$($attr)*] [$($modifiers)*] $name))*),
output: ()
}

impl<$tcx> Maps<$tcx> {
Expand Down Expand Up @@ -519,6 +519,41 @@ macro_rules! define_maps {
}
}

macro_rules! define_map_struct {
(tcx: $tcx:tt,
input: (),
output: ($($output:tt)*)) => {
pub struct Maps<$tcx> {
providers: IndexVec<CrateNum, Providers<$tcx>>,
query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
$($output)*
}
};

// Detect things with the `pub` modifier
(tcx: $tcx:tt,
input: (([$($attr:meta)*] [pub] $name:ident) $($input:tt)*),
output: ($($output:tt)*)) => {
define_map_struct! {
tcx: $tcx,
input: ($($input)*),
output: ($($output)*
$(#[$attr])* pub $name: RefCell<DepTrackingMap<queries::$name<$tcx>>>,)
}
};

(tcx: $tcx:tt,
input: (([$($attr:meta)*] [$($modifiers:tt)*] $name:ident) $($input:tt)*),
output: ($($output:tt)*)) => {
define_map_struct! {
tcx: $tcx,
input: ($($input)*),
output: ($($output)*
$(#[$attr])* $name: RefCell<DepTrackingMap<queries::$name<$tcx>>>,)
}
};
}

// Each of these maps also corresponds to a method on a
// `Provider` trait for requesting a value of that type,
// and a method on `Maps` itself for doing that in a
Expand Down