Commit 1b65bccd authored by qinsoon's avatar qinsoon

profile substages in reg alloc, change --allow-inline to

--disable-inline
parent 928b9053
extern crate hprof;
use ast::ir::*;
use compiler::backend;
use compiler::backend::reg_alloc::graph_coloring;
......@@ -113,6 +115,8 @@ impl <'a> GraphColoring<'a> {
fn regalloc(mut self) -> GraphColoring<'a> {
trace!("---InterenceGraph---");
let _p = hprof::enter("regalloc: graph coloring");
self.ig.print(&self.func.context);
// precolor for all machine registers
......@@ -161,6 +165,8 @@ impl <'a> GraphColoring<'a> {
self.assign_colors();
drop(_p);
if !self.spilled_nodes.is_empty() {
trace!("spill required");
if cfg!(debug_assertions) {
......
extern crate hprof;
use compiler::machine_code::CompiledFunction;
use ast::ir::*;
use compiler::backend;
......@@ -231,6 +233,8 @@ impl InterferenceGraph {
}
}
const TRACE_BUILD_LIVE_SET : bool = false;
fn build_live_set (cf: &mut CompiledFunction, func: &MuFunctionVersion) {
info!("---start building live set---");
......@@ -243,7 +247,9 @@ fn build_live_set (cf: &mut CompiledFunction, func: &MuFunctionVersion) {
let mut i = 0;
while is_changed {
if TRACE_BUILD_LIVE_SET {
trace!("---iteration {}---", i);
}
i += 1;
// reset
......@@ -281,11 +287,13 @@ fn build_live_set (cf: &mut CompiledFunction, func: &MuFunctionVersion) {
// is in/out changed in this iteration?
let n_changed = !in_set_old.equals(&livein[n]) || !out_set_old.equals(&liveout[n]);
if TRACE_BUILD_LIVE_SET {
trace!("inst {}", n);
trace!("in(old) = {:?}", in_set_old);
trace!("in(new) = {:?}", livein[n]);
trace!("out(old) = {:?}", out_set_old);
trace!("out(new) = {:?}", liveout[n]);
}
is_changed = is_changed || n_changed;
}
......@@ -314,7 +322,11 @@ fn build_live_set (cf: &mut CompiledFunction, func: &MuFunctionVersion) {
// from Tailoring Graph-coloring Register Allocation For Runtime Compilation, Figure 4
pub fn build_chaitin_briggs (cf: &mut CompiledFunction, func: &MuFunctionVersion) -> InterferenceGraph {
let _p = hprof::enter("regalloc: build live set");
build_live_set(cf, func);
drop(_p);
let _p = hprof::enter("regalloc: build interference graph");
info!("---start building interference graph---");
......@@ -462,6 +474,7 @@ pub fn build_chaitin_briggs (cf: &mut CompiledFunction, func: &MuFunctionVersion
}
}
drop(_p);
info!("---finish building interference graph---");
ig
}
......
......@@ -453,7 +453,7 @@ impl CompilerPass for Inlining {
}
fn visit_function(&mut self, vm: &VM, func: &mut MuFunctionVersion) {
if !vm.vm_options.flag_allow_inline {
if vm.vm_options.flag_disable_inline {
info!("inlining is disabled");
return;
}
......
......@@ -15,7 +15,7 @@ VM:
--log-level=<level> logging level: none, error, warn, info, debug, trace [default: trace]
Compiler:
--allow-inline=<flag> allow compiler inlining functions on its decision [default: true]
--disable-inline disable compiler function inlining
AOT Compiler:
--aot-emit-dir=<dir> the emit directory for ahead-of-time compiling [default: emit]
......@@ -29,7 +29,7 @@ Garbage Collection:
#[derive(Debug, RustcDecodable, RustcEncodable)]
pub struct VMOptions {
pub flag_log_level: MuLogLevel,
pub flag_allow_inline: bool,
pub flag_disable_inline: bool,
pub flag_aot_emit_dir: String,
pub flag_gc_immixspace_size: usize,
pub flag_gc_lospace_size: usize,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment