Remove instance_def_size_estimate
query.
It doesn't seem worthwhile now that `MonoItem::size_estimate` is called much less often.
This commit is contained in:
parent
87c509da95
commit
005a70e303
@ -59,12 +59,19 @@ impl<'tcx> MonoItem<'tcx> {
|
|||||||
pub fn size_estimate(&self, tcx: TyCtxt<'tcx>) -> usize {
|
pub fn size_estimate(&self, tcx: TyCtxt<'tcx>) -> usize {
|
||||||
match *self {
|
match *self {
|
||||||
MonoItem::Fn(instance) => {
|
MonoItem::Fn(instance) => {
|
||||||
// Estimate the size of a function based on how many statements
|
match instance.def {
|
||||||
// it contains.
|
// "Normal" functions size estimate: the number of
|
||||||
tcx.instance_def_size_estimate(instance.def)
|
// statements, plus one for the terminator.
|
||||||
|
InstanceDef::Item(..) | InstanceDef::DropGlue(..) => {
|
||||||
|
let mir = tcx.instance_mir(instance.def);
|
||||||
|
mir.basic_blocks.iter().map(|bb| bb.statements.len() + 1).sum()
|
||||||
|
}
|
||||||
|
// Other compiler-generated shims size estimate: 1
|
||||||
|
_ => 1,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Conservatively estimate the size of a static declaration
|
// Conservatively estimate the size of a static declaration or
|
||||||
// or assembly to be 1.
|
// assembly item to be 1.
|
||||||
MonoItem::Static(_) | MonoItem::GlobalAsm(_) => 1,
|
MonoItem::Static(_) | MonoItem::GlobalAsm(_) => 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2080,12 +2080,6 @@ rustc_queries! {
|
|||||||
desc { "looking up supported target features" }
|
desc { "looking up supported target features" }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning.
|
|
||||||
query instance_def_size_estimate(def: ty::InstanceDef<'tcx>)
|
|
||||||
-> usize {
|
|
||||||
desc { |tcx| "estimating size for `{}`", tcx.def_path_str(def.def_id()) }
|
|
||||||
}
|
|
||||||
|
|
||||||
query features_query(_: ()) -> &'tcx rustc_feature::Features {
|
query features_query(_: ()) -> &'tcx rustc_feature::Features {
|
||||||
feedable
|
feedable
|
||||||
desc { "looking up enabled feature gates" }
|
desc { "looking up enabled feature gates" }
|
||||||
|
@ -311,22 +311,6 @@ fn param_env_reveal_all_normalized(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamE
|
|||||||
tcx.param_env(def_id).with_reveal_all_normalized(tcx)
|
tcx.param_env(def_id).with_reveal_all_normalized(tcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn instance_def_size_estimate<'tcx>(
|
|
||||||
tcx: TyCtxt<'tcx>,
|
|
||||||
instance_def: ty::InstanceDef<'tcx>,
|
|
||||||
) -> usize {
|
|
||||||
use ty::InstanceDef;
|
|
||||||
|
|
||||||
match instance_def {
|
|
||||||
InstanceDef::Item(..) | InstanceDef::DropGlue(..) => {
|
|
||||||
let mir = tcx.instance_mir(instance_def);
|
|
||||||
mir.basic_blocks.iter().map(|bb| bb.statements.len() + 1).sum()
|
|
||||||
}
|
|
||||||
// Estimate the size of other compiler-generated shims to be 1.
|
|
||||||
_ => 1,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`.
|
/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`.
|
||||||
///
|
///
|
||||||
/// See [`ty::ImplOverlapKind::Issue33140`] for more details.
|
/// See [`ty::ImplOverlapKind::Issue33140`] for more details.
|
||||||
@ -432,7 +416,6 @@ pub fn provide(providers: &mut Providers) {
|
|||||||
adt_sized_constraint,
|
adt_sized_constraint,
|
||||||
param_env,
|
param_env,
|
||||||
param_env_reveal_all_normalized,
|
param_env_reveal_all_normalized,
|
||||||
instance_def_size_estimate,
|
|
||||||
issue33140_self_ty,
|
issue33140_self_ty,
|
||||||
defaultness,
|
defaultness,
|
||||||
unsizing_params_for_adt,
|
unsizing_params_for_adt,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user