Add a Context::compile() function which runs all compiler passes.

This is the main entry point to the code generator. It returns the
computed size of the functions code.

Also add a 'test compile' command which runs the whole code generation
pipeline.
This commit is contained in:
Jakob Stoklund Olesen
2017-07-11 16:26:16 -07:00
parent ae5e440094
commit 9e3b6a6eba
5 changed files with 143 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ use filetest::runner::TestRunner;
pub mod subtest;
mod binemit;
mod compile;
mod concurrent;
mod domtree;
mod legalizer;
@@ -57,15 +58,16 @@ pub fn run(verbose: bool, files: Vec<String>) -> CommandResult {
/// a `.cton` test file.
fn new_subtest(parsed: &TestCommand) -> subtest::Result<Box<subtest::SubTest>> {
match parsed.command {
"binemit" => binemit::subtest(parsed),
"cat" => cat::subtest(parsed),
"print-cfg" => print_cfg::subtest(parsed),
"compile" => compile::subtest(parsed),
"domtree" => domtree::subtest(parsed),
"verifier" => verifier::subtest(parsed),
"legalizer" => legalizer::subtest(parsed),
"licm" => licm::subtest(parsed),
"print-cfg" => print_cfg::subtest(parsed),
"regalloc" => regalloc::subtest(parsed),
"binemit" => binemit::subtest(parsed),
"simple-gvn" => simple_gvn::subtest(parsed),
"verifier" => verifier::subtest(parsed),
_ => Err(format!("unknown test command '{}'", parsed.command)),
}
}