remove register_reads

The reads will occur naturally as the HIR/MIR is fetched from the
tracked tables, and this winds up adding reads to the hir of foreign
def-ids somehow.
This commit is contained in:
Niko Matsakis 2016-07-30 09:00:18 -04:00
parent b4929d11ae
commit 2797b2a5ca

View File

@ -83,8 +83,6 @@ impl<'a, 'tcx> TransItem<'tcx> {
// that the incoming edges to a particular fn are from a
// particular set.
self.register_reads(ccx);
match *self {
TransItem::Static(node_id) => {
let def_id = ccx.tcx().map.local_def_id(node_id);
@ -120,46 +118,6 @@ impl<'a, 'tcx> TransItem<'tcx> {
ccx.codegen_unit().name());
}
/// If necessary, creates a subtask for trans'ing a particular item and registers reads on
/// `TypeckItemBody` and `Hir`.
fn register_reads(&self, ccx: &CrateContext<'a, 'tcx>) {
let tcx = ccx.tcx();
let def_id = match *self {
TransItem::Static(node_id) => {
tcx.map.local_def_id(node_id)
}
TransItem::Fn(instance) => {
if let Some(node) = tcx.map.as_local_node_id(instance.def) {
if let hir_map::Node::NodeItem(_) = tcx.map.get(node) {
// This already is a "real" item
instance.def
} else {
// Get the enclosing item and register a read on it
tcx.map.get_parent_did(node)
}
} else {
// Translating an inlined item from another crate? Don't track anything.
return;
}
}
TransItem::DropGlue(_) => {
// Nothing to track for drop glue
return;
}
};
tcx.dep_graph.with_task(DepNode::TransCrateItem(def_id), || {
tcx.dep_graph.read(DepNode::Hir(def_id));
// We are going to be accessing various tables
// generated by TypeckItemBody; we also assume
// that the body passes type check. These tables
// are not individually tracked, so just register
// a read here.
tcx.dep_graph.read(DepNode::TypeckItemBody(def_id));
});
}
pub fn predefine(&self,
ccx: &CrateContext<'a, 'tcx>,
linkage: llvm::Linkage) {