Rename Cretonne to Cranelift!

This commit is contained in:
Dan Gohman
2018-07-13 09:01:28 -07:00
parent 19a636af96
commit f4dbd38a4c
306 changed files with 977 additions and 975 deletions

View File

@@ -1,15 +1,15 @@
[package]
name = "cretonne-filetests"
authors = ["The Cretonne Project Developers"]
name = "cranelift-filetests"
authors = ["The Cranelift Project Developers"]
version = "0.13.0"
description = "Test driver and implementations of the filetest commands"
license = "Apache-2.0 WITH LLVM-exception"
documentation = "https://cretonne.readthedocs.io/en/latest/testing.html#file-tests"
repository = "https://github.com/cretonne/cretonne"
documentation = "https://cranelift.readthedocs.io/en/latest/testing.html#file-tests"
repository = "https://github.com/cranelift/cranelift"
publish = false
[dependencies]
cretonne-codegen = { path = "../codegen", version = "0.13.0" }
cretonne-reader = { path = "../reader", version = "0.13.0" }
cranelift-codegen = { path = "../codegen", version = "0.13.0" }
cranelift-reader = { path = "../reader", version = "0.13.0" }
filecheck = "0.3.0"
num_cpus = "1.8.0"

View File

@@ -3,7 +3,7 @@
//! This module provides the `ConcurrentRunner` struct which uses a pool of threads to run tests
//! concurrently.
use cretonne_codegen::timing;
use cranelift_codegen::timing;
use num_cpus;
use std::panic::catch_unwind;
use std::path::{Path, PathBuf};

View File

@@ -18,12 +18,12 @@
)]
#[macro_use(dbg)]
extern crate cretonne_codegen;
extern crate cretonne_reader;
extern crate cranelift_codegen;
extern crate cranelift_reader;
extern crate filecheck;
extern crate num_cpus;
use cretonne_reader::TestCommand;
use cranelift_reader::TestCommand;
use runner::TestRunner;
use std::path::Path;
use std::time;
@@ -52,13 +52,13 @@ mod test_verifier;
/// The result of running the test in a file.
type TestResult = Result<time::Duration, String>;
/// Main entry point for `cton-util test`.
/// Main entry point for `clif-util test`.
///
/// Take a list of filenames which can be either `.cton` files or directories.
/// Take a list of filenames which can be either `.clif` files or directories.
///
/// Files are interpreted as test cases and executed immediately.
///
/// Directories are scanned recursively for test cases ending in `.cton`. These test cases are
/// Directories are scanned recursively for test cases ending in `.clif`. These test cases are
/// executed on background threads.
///
pub fn run(verbose: bool, files: &[String]) -> TestResult {
@@ -79,7 +79,7 @@ pub fn run(verbose: bool, files: &[String]) -> TestResult {
/// Create a new subcommand trait object to match `parsed.command`.
///
/// This function knows how to create all of the possible `test <foo>` commands that can appear in
/// a `.cton` test file.
/// a `.clif` test file.
fn new_subtest(parsed: &TestCommand) -> subtest::SubtestResult<Box<subtest::SubTest>> {
match parsed.command {
"binemit" => test_binemit::subtest(parsed),

View File

@@ -116,7 +116,7 @@ impl TestRunner {
// This recursive search tries to minimize statting in a directory hierarchy containing
// mostly test cases.
//
// - Directory entries with a "cton" extension are presumed to be test case files.
// - Directory entries with a "clif" extension are presumed to be test case files.
// - Directory entries with no extension are presumed to be subdirectories.
// - Anything else is ignored.
//
@@ -149,7 +149,7 @@ impl TestRunner {
// Recognize directories and tests by extension.
// Yes, this means we ignore directories with '.' in their name.
match path.extension().and_then(OsStr::to_str) {
Some("cton") => self.push_test(path),
Some("clif") => self.push_test(path),
Some(_) => {}
None => self.push_dir(path),
}

View File

@@ -1,13 +1,13 @@
//! Run the tests in a single test file.
use cretonne_codegen::ir::Function;
use cretonne_codegen::isa::TargetIsa;
use cretonne_codegen::print_errors::pretty_verifier_error;
use cretonne_codegen::settings::Flags;
use cretonne_codegen::timing;
use cretonne_codegen::verify_function;
use cretonne_reader::parse_test;
use cretonne_reader::IsaSpec;
use cranelift_codegen::ir::Function;
use cranelift_codegen::isa::TargetIsa;
use cranelift_codegen::print_errors::pretty_verifier_error;
use cranelift_codegen::settings::Flags;
use cranelift_codegen::timing;
use cranelift_codegen::verify_function;
use cranelift_reader::parse_test;
use cranelift_reader::IsaSpec;
use std::borrow::Cow;
use std::fs;
use std::io::{self, Read};

View File

@@ -1,9 +1,9 @@
//! `SubTest` trait.
use cretonne_codegen::ir::Function;
use cretonne_codegen::isa::TargetIsa;
use cretonne_codegen::settings::{Flags, FlagsOrIsa};
use cretonne_reader::{Comment, Details};
use cranelift_codegen::ir::Function;
use cranelift_codegen::isa::TargetIsa;
use cranelift_codegen::settings::{Flags, FlagsOrIsa};
use cranelift_reader::{Comment, Details};
use filecheck::{Checker, CheckerBuilder, NO_VARIABLES};
use std::borrow::Cow;
@@ -40,7 +40,7 @@ impl<'a> Context<'a> {
/// Common interface for implementations of test commands.
///
/// Each `.cton` test file may contain multiple test commands, each represented by a `SubTest`
/// Each `.clif` test file may contain multiple test commands, each represented by a `SubTest`
/// trait object.
pub trait SubTest {
/// Name identifying this subtest. Typically the same as the test command.

View File

@@ -3,14 +3,14 @@
//! The `binemit` test command generates binary machine code for every instruction in the input
//! functions and compares the results to the expected output.
use cretonne_codegen::binemit;
use cretonne_codegen::binemit::RegDiversions;
use cretonne_codegen::dbg::DisplayList;
use cretonne_codegen::ir;
use cretonne_codegen::ir::entities::AnyEntity;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_codegen::settings::OptLevel;
use cretonne_reader::TestCommand;
use cranelift_codegen::binemit;
use cranelift_codegen::binemit::RegDiversions;
use cranelift_codegen::dbg::DisplayList;
use cranelift_codegen::ir;
use cranelift_codegen::ir::entities::AnyEntity;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_codegen::settings::OptLevel;
use cranelift_reader::TestCommand;
use match_directive::match_directive;
use std::borrow::Cow;
use std::collections::HashMap;

View File

@@ -1,7 +1,7 @@
//! The `cat` subtest.
use cretonne_codegen::ir::Function;
use cretonne_reader::TestCommand;
use cranelift_codegen::ir::Function;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{self, Context, SubTest, SubtestResult};

View File

@@ -2,10 +2,10 @@
//!
//! The `compile` test command runs each function through the full code generator pipeline
use cretonne_codegen;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_codegen::{binemit, ir};
use cretonne_reader::TestCommand;
use cranelift_codegen;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_codegen::{binemit, ir};
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
@@ -35,7 +35,7 @@ impl SubTest for TestCompile {
fn run(&self, func: Cow<ir::Function>, context: &Context) -> SubtestResult<()> {
let isa = context.isa.expect("compile needs an ISA");
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
let code_size = comp_ctx
.compile(isa)

View File

@@ -5,10 +5,10 @@
//!
//! The resulting function is sent to `filecheck`.
use cretonne_codegen;
use cretonne_codegen::ir::Function;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_reader::TestCommand;
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
@@ -33,7 +33,7 @@ impl SubTest for TestDCE {
}
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
comp_ctx.flowgraph();
comp_ctx.compute_loop_analysis();

View File

@@ -2,7 +2,7 @@
//!
//! The `test domtree` test command looks for annotations on instructions like this:
//!
//! ```cton
//! ```clif
//! jump ebb3 ; dominates: ebb3
//! ```
//!
@@ -12,11 +12,11 @@
//! We verify that the dominator tree annotations are complete and correct.
//!
use cretonne_codegen::dominator_tree::{DominatorTree, DominatorTreePreorder};
use cretonne_codegen::flowgraph::ControlFlowGraph;
use cretonne_codegen::ir::entities::AnyEntity;
use cretonne_codegen::ir::Function;
use cretonne_reader::TestCommand;
use cranelift_codegen::dominator_tree::{DominatorTree, DominatorTreePreorder};
use cranelift_codegen::flowgraph::ControlFlowGraph;
use cranelift_codegen::ir::entities::AnyEntity;
use cranelift_codegen::ir::Function;
use cranelift_reader::TestCommand;
use match_directive::match_directive;
use std::borrow::{Borrow, Cow};
use std::collections::HashMap;

View File

@@ -3,10 +3,10 @@
//! The `test legalizer` test command runs each function through `legalize_function()` and sends
//! the result to filecheck.
use cretonne_codegen;
use cretonne_codegen::ir::Function;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_reader::TestCommand;
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
@@ -35,7 +35,7 @@ impl SubTest for TestLegalizer {
}
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
let isa = context.isa.expect("legalizer needs an ISA");
comp_ctx.compute_cfg();

View File

@@ -5,10 +5,10 @@
//!
//! The resulting function is sent to `filecheck`.
use cretonne_codegen;
use cretonne_codegen::ir::Function;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_reader::TestCommand;
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
@@ -33,7 +33,7 @@ impl SubTest for TestLICM {
}
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
comp_ctx.flowgraph();
comp_ctx.compute_loop_analysis();

View File

@@ -2,10 +2,10 @@
//!
//! The resulting function is sent to `filecheck`.
use cretonne_codegen;
use cretonne_codegen::ir::Function;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_reader::TestCommand;
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
@@ -30,7 +30,7 @@ impl SubTest for TestPostopt {
}
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
let isa = context.isa.expect("postopt needs an ISA");
comp_ctx.flowgraph();

View File

@@ -2,10 +2,10 @@
//!
//! The resulting function is sent to `filecheck`.
use cretonne_codegen;
use cretonne_codegen::ir::Function;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_reader::TestCommand;
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
@@ -30,7 +30,7 @@ impl SubTest for TestPreopt {
}
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
let isa = context.isa.expect("preopt needs an ISA");
comp_ctx.flowgraph();

View File

@@ -1,13 +1,13 @@
//! The `print-cfg` sub-command.
//!
//! Read a series of Cretonne IR files and print their control flow graphs
//! Read a series of Cranelift IR files and print their control flow graphs
//! in graphviz format.
use std::borrow::Cow;
use cretonne_codegen::cfg_printer::CFGPrinter;
use cretonne_codegen::ir::Function;
use cretonne_reader::TestCommand;
use cranelift_codegen::cfg_printer::CFGPrinter;
use cranelift_codegen::ir::Function;
use cranelift_reader::TestCommand;
use subtest::{self, Context, SubTest, SubtestResult};
/// Object implementing the `test print-cfg` sub-test.

View File

@@ -5,10 +5,10 @@
//!
//! The resulting function is sent to `filecheck`.
use cretonne_codegen;
use cretonne_codegen::ir::Function;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_reader::TestCommand;
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
@@ -38,7 +38,7 @@ impl SubTest for TestRegalloc {
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
let isa = context.isa.expect("register allocator needs an ISA");
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
comp_ctx.compute_cfg();
// TODO: Should we have an option to skip legalization?

View File

@@ -5,10 +5,10 @@
//!
//! The resulting function is sent to `filecheck`.
use cretonne_codegen;
use cretonne_codegen::ir::Function;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_reader::TestCommand;
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
@@ -34,7 +34,7 @@ impl SubTest for TestShrink {
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
let isa = context.isa.expect("shrink needs an ISA");
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
comp_ctx
.shrink_instructions(isa)

View File

@@ -5,10 +5,10 @@
//!
//! The resulting function is sent to `filecheck`.
use cretonne_codegen;
use cretonne_codegen::ir::Function;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_reader::TestCommand;
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
@@ -33,7 +33,7 @@ impl SubTest for TestSimpleGVN {
}
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
comp_ctx.flowgraph();
comp_ctx

View File

@@ -2,16 +2,16 @@
//!
//! The `test verifier` test command looks for annotations on instructions like this:
//!
//! ```cton
//! ```clif
//! jump ebb3 ; error: jump to non-existent EBB
//! ```
//!
//! This annotation means that the verifier is expected to given an error for the jump instruction
//! containing the substring "jump to non-existent EBB".
use cretonne_codegen::ir::Function;
use cretonne_codegen::verify_function;
use cretonne_reader::TestCommand;
use cranelift_codegen::ir::Function;
use cranelift_codegen::verify_function;
use cranelift_reader::TestCommand;
use match_directive::match_directive;
use std::borrow::{Borrow, Cow};
use subtest::{Context, SubTest, SubtestResult};