Add a compilation pass timing facility.
Individual compilation passes call the corresponding timing::*() function and hold on to their timing token while they run. This causes nested per-pass timing information to be recorded in thread-local storage. The --time-passes command line option prints a pass timing report to stdout.
This commit is contained in:
@@ -6,6 +6,7 @@ use ir::Function;
|
||||
use regalloc::liveness::Liveness;
|
||||
use regalloc::virtregs::VirtRegs;
|
||||
use std::cmp::Ordering;
|
||||
use timing;
|
||||
use verifier::Result;
|
||||
|
||||
/// Verify conventional SSA form for `func`.
|
||||
@@ -29,6 +30,7 @@ pub fn verify_cssa(
|
||||
liveness: &Liveness,
|
||||
virtregs: &VirtRegs,
|
||||
) -> Result {
|
||||
let _tt = timing::verify_cssa();
|
||||
let verifier = CssaVerifier {
|
||||
func,
|
||||
cfg,
|
||||
|
||||
@@ -8,6 +8,7 @@ use isa;
|
||||
use packed_option::PackedOption;
|
||||
use std::result;
|
||||
use verifier::{Result, Error};
|
||||
use timing;
|
||||
|
||||
/// Verify that CPU flags are used correctly.
|
||||
///
|
||||
@@ -26,6 +27,7 @@ pub fn verify_flags(
|
||||
cfg: &ControlFlowGraph,
|
||||
isa: Option<&isa::TargetIsa>,
|
||||
) -> Result {
|
||||
let _tt = timing::verify_flags();
|
||||
let mut verifier = FlagsVerifier {
|
||||
func,
|
||||
cfg,
|
||||
|
||||
@@ -8,6 +8,7 @@ use regalloc::liveness::Liveness;
|
||||
use regalloc::liverange::LiveRange;
|
||||
use std::cmp::Ordering;
|
||||
use verifier::Result;
|
||||
use timing;
|
||||
|
||||
/// Verify liveness information for `func`.
|
||||
///
|
||||
@@ -27,6 +28,7 @@ pub fn verify_liveness(
|
||||
cfg: &ControlFlowGraph,
|
||||
liveness: &Liveness,
|
||||
) -> Result {
|
||||
let _tt = timing::verify_liveness();
|
||||
let verifier = LivenessVerifier {
|
||||
isa,
|
||||
func,
|
||||
|
||||
@@ -5,6 +5,7 @@ use isa;
|
||||
use regalloc::RegDiversions;
|
||||
use regalloc::liveness::Liveness;
|
||||
use verifier::Result;
|
||||
use timing;
|
||||
|
||||
/// Verify value locations for `func`.
|
||||
///
|
||||
@@ -22,6 +23,7 @@ pub fn verify_locations(
|
||||
func: &ir::Function,
|
||||
liveness: Option<&Liveness>,
|
||||
) -> Result {
|
||||
let _tt = timing::verify_locations();
|
||||
let verifier = LocationVerifier {
|
||||
isa,
|
||||
func,
|
||||
|
||||
@@ -73,6 +73,7 @@ use std::collections::BTreeSet;
|
||||
use std::error as std_error;
|
||||
use std::fmt::{self, Display, Formatter, Write};
|
||||
use std::result;
|
||||
use timing;
|
||||
|
||||
pub use self::cssa::verify_cssa;
|
||||
pub use self::liveness::verify_liveness;
|
||||
@@ -126,6 +127,7 @@ pub type Result = result::Result<(), Error>;
|
||||
|
||||
/// Verify `func`.
|
||||
pub fn verify_function<'a, FOI: Into<FlagsOrIsa<'a>>>(func: &Function, fisa: FOI) -> Result {
|
||||
let _tt = timing::verifier();
|
||||
Verifier::new(func, fisa.into()).run()
|
||||
}
|
||||
|
||||
@@ -137,6 +139,7 @@ pub fn verify_context<'a, FOI: Into<FlagsOrIsa<'a>>>(
|
||||
domtree: &DominatorTree,
|
||||
fisa: FOI,
|
||||
) -> Result {
|
||||
let _tt = timing::verifier();
|
||||
let verifier = Verifier::new(func, fisa.into());
|
||||
if cfg.is_valid() {
|
||||
verifier.cfg_integrity(cfg)?;
|
||||
|
||||
Reference in New Issue
Block a user