about summary refs log tree commit diff
path: root/src/librustc/query
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2019-03-20 16:06:09 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2019-03-20 16:06:09 +0100
commit72f8d4e2220cc48061288b57d716f194567b4307 (patch)
tree38f878a2922f4563d004158d4eeff160c353fa1c /src/librustc/query
parent0c8700b9d50a1e3d31f7b6c0956df555279ac441 (diff)
downloadrust-72f8d4e2220cc48061288b57d716f194567b4307.tar.gz
rust-72f8d4e2220cc48061288b57d716f194567b4307.zip
Add no_hash to query macro and move some queries over
Diffstat (limited to 'src/librustc/query')
-rw-r--r--src/librustc/query/mod.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs
index ecc00898600..b99bffd3bd3 100644
--- a/src/librustc/query/mod.rs
+++ b/src/librustc/query/mod.rs
@@ -63,4 +63,47 @@ rustc_queries! {
             desc { "checking if the crate is_panic_runtime" }
         }
     }
+
+    Codegen {
+        /// Set of all the `DefId`s in this crate that have MIR associated with
+        /// them. This includes all the body owners, but also things like struct
+        /// constructors.
+        query mir_keys(_: CrateNum) -> Lrc<DefIdSet> {
+            desc { "getting a list of all mir_keys" }
+        }
+
+        /// Maps DefId's that have an associated Mir to the result
+        /// of the MIR qualify_consts pass. The actual meaning of
+        /// the value isn't known except to the pass itself.
+        query mir_const_qualif(key: DefId) -> (u8, Lrc<BitSet<mir::Local>>) {
+            cache { key.is_local() }
+        }
+
+        /// Fetch the MIR for a given `DefId` right after it's built - this includes
+        /// unreachable code.
+        query mir_built(_: DefId) -> &'tcx Steal<mir::Mir<'tcx>> {}
+
+        /// Fetch the MIR for a given `DefId` up till the point where it is
+        /// ready for const evaluation.
+        ///
+        /// See the README for the `mir` module for details.
+        query mir_const(_: DefId) -> &'tcx Steal<mir::Mir<'tcx>> {
+            no_hash
+        }
+
+        query mir_validated(_: DefId) -> &'tcx Steal<mir::Mir<'tcx>> {
+            no_hash
+        }
+
+        /// MIR after our optimization passes have run. This is MIR that is ready
+        /// for codegen. This is also the only query that can fetch non-local MIR, at present.
+        query optimized_mir(key: DefId) -> &'tcx mir::Mir<'tcx> {
+            cache { key.is_local() }
+            load_cached(tcx, id) {
+                let mir: Option<crate::mir::Mir<'tcx>> = tcx.queries.on_disk_cache
+                                                            .try_load_query_result(tcx, id);
+                mir.map(|x| tcx.alloc_mir(x))
+            }
+        }
+    }
 }