rename from item_mir to optimized_mir
This commit is contained in:
parent
c7023d1c2f
commit
393fa4f1b7
11 changed files with 33 additions and 42 deletions
|
|
@ -333,7 +333,7 @@ impl<'tcx> QueryDescription for queries::const_is_rvalue_promotable_to_static<'t
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> QueryDescription for queries::is_item_mir_available<'tcx> {
|
||||
impl<'tcx> QueryDescription for queries::is_mir_available<'tcx> {
|
||||
fn describe(tcx: TyCtxt, def_id: DefId) -> String {
|
||||
format!("checking if item is mir available: `{}`",
|
||||
tcx.item_path_str(def_id))
|
||||
|
|
@ -770,7 +770,7 @@ define_maps! { <'tcx>
|
|||
|
||||
[] item_body_nested_bodies: metadata_dep_node(DefId) -> Rc<BTreeMap<hir::BodyId, hir::Body>>,
|
||||
[] const_is_rvalue_promotable_to_static: metadata_dep_node(DefId) -> bool,
|
||||
[] is_item_mir_available: metadata_dep_node(DefId) -> bool,
|
||||
[] is_mir_available: metadata_dep_node(DefId) -> bool,
|
||||
}
|
||||
|
||||
fn coherent_trait_dep_node((_, def_id): (CrateNum, DefId)) -> DepNode<DefId> {
|
||||
|
|
|
|||
|
|
@ -2324,18 +2324,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Given the did of an item, returns its (optimized) MIR, borrowed immutably.
|
||||
pub fn item_mir(self, did: DefId) -> &'gcx Mir<'gcx> {
|
||||
self.optimized_mir(did)
|
||||
}
|
||||
|
||||
/// Return the possibly-auto-generated MIR of a (DefId, Subst) pair.
|
||||
pub fn instance_mir(self, instance: ty::InstanceDef<'gcx>)
|
||||
-> &'gcx Mir<'gcx>
|
||||
{
|
||||
match instance {
|
||||
ty::InstanceDef::Item(did) => {
|
||||
self.item_mir(did)
|
||||
self.optimized_mir(did)
|
||||
}
|
||||
ty::InstanceDef::Intrinsic(..) |
|
||||
ty::InstanceDef::FnPtrShim(..) |
|
||||
|
|
@ -2349,16 +2344,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
|
||||
/// Given the DefId of an item, returns its MIR, borrowed immutably.
|
||||
/// Returns None if there is no MIR for the DefId
|
||||
pub fn maybe_item_mir(self, did: DefId) -> Option<&'gcx Mir<'gcx>> {
|
||||
if did.is_local() && !self.mir_keys(LOCAL_CRATE).contains(&did) {
|
||||
return None;
|
||||
pub fn maybe_optimized_mir(self, did: DefId) -> Option<&'gcx Mir<'gcx>> {
|
||||
if self.is_mir_available(did) {
|
||||
Some(self.optimized_mir(did))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
if !did.is_local() && !self.is_item_mir_available(did) {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(self.item_mir(did))
|
||||
}
|
||||
|
||||
/// Get the attributes of a definition.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue