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:
Jakob Stoklund Olesen
2017-12-06 10:56:17 -08:00
parent feaea238bc
commit 60c456c1ec
29 changed files with 305 additions and 12 deletions

View File

@@ -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)?;