Added compile codegen to backend trait
This commit is contained in:
parent
6819e6e6e1
commit
4ba09ab8d2
4 changed files with 18 additions and 30 deletions
|
@ -56,6 +56,7 @@ use rustc_mir::monomorphize::item::DefPathBasedNames;
|
|||
use common::{self, IntPredicate, RealPredicate, TypeKind};
|
||||
use meth;
|
||||
use mir;
|
||||
use context::CodegenCx;
|
||||
use monomorphize::Instance;
|
||||
use monomorphize::partitioning::{CodegenUnit, CodegenUnitExt};
|
||||
use rustc_codegen_utils::symbol_names_test;
|
||||
|
@ -712,7 +713,7 @@ fn determine_cgu_reuse<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
pub fn codegen_crate<'a, 'tcx, B: BackendMethods>(
|
||||
pub fn codegen_crate<B: BackendMethods>(
|
||||
backend: B,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
rx: mpsc::Receiver<Box<dyn Any + Send>>
|
||||
|
@ -858,7 +859,7 @@ pub fn codegen_crate<'a, 'tcx, B: BackendMethods>(
|
|||
&format!("codegen {}", cgu.name()))
|
||||
});
|
||||
let start_time = Instant::now();
|
||||
let stats = compile_codegen_unit(tcx, *cgu.name());
|
||||
let stats = backend.compile_codegen_unit(tcx, *cgu.name());
|
||||
all_stats.extend(stats);
|
||||
total_codegen_time += start_time.elapsed();
|
||||
false
|
||||
|
@ -1066,7 +1067,7 @@ impl CrateInfo {
|
|||
}
|
||||
}
|
||||
|
||||
fn compile_codegen_unit<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>,
|
||||
pub fn compile_codegen_unit<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>,
|
||||
cgu_name: InternedString)
|
||||
-> Stats {
|
||||
let start_time = Instant::now();
|
||||
|
@ -1098,7 +1099,7 @@ fn compile_codegen_unit<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>,
|
|||
// Instantiate monomorphizations without filling out definitions yet...
|
||||
let llvm_module = backend.new_metadata(tcx.sess, &cgu_name.as_str());
|
||||
let stats = {
|
||||
let cx = backend.new_codegen_context(tcx, cgu, &llvm_module);
|
||||
let cx = CodegenCx::new(tcx, cgu, &llvm_module);
|
||||
let mono_items = cx.codegen_unit
|
||||
.items_in_deterministic_order(cx.tcx);
|
||||
for &(mono_item, (linkage, visibility)) in &mono_items {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue