Move dominator tree test cases to their own folder.
This commit is contained in:
23
cranelift/src/tools/Cargo.lock
generated
23
cranelift/src/tools/Cargo.lock
generated
@@ -5,6 +5,8 @@ dependencies = [
|
|||||||
"cretonne 0.0.0",
|
"cretonne 0.0.0",
|
||||||
"cretonne-reader 0.0.0",
|
"cretonne-reader 0.0.0",
|
||||||
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -37,6 +39,11 @@ dependencies = [
|
|||||||
"strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glob"
|
||||||
|
version = "0.2.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kernel32-sys"
|
name = "kernel32-sys"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
@@ -118,3 +125,19 @@ name = "winapi-build"
|
|||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
"checksum aho-corasick 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2b3fb52b09c1710b961acb35390d514be82e4ac96a9969a8e38565a29b878dc9"
|
||||||
|
"checksum docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4cc0acb4ce0828c6a5a11d47baa432fe885881c27428c3a4e473e454ffe57a76"
|
||||||
|
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||||
|
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||||
|
"checksum libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c96061f0c8a2dc27482e394d82e23073569de41d73cd736672ccd3e5c7471bfd"
|
||||||
|
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
|
||||||
|
"checksum regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)" = "e58a1b7d2bfecc0746e8587c30a53d01ea7bc0e98fac54e5aaa375b94338a0cc"
|
||||||
|
"checksum regex-syntax 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "baa04823ba7be7ed0bed3d0704c7b923019d9c4e4931c5af2804c7c7a0e3d00b"
|
||||||
|
"checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b"
|
||||||
|
"checksum strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4d73a2c36a4d095ed1a6df5cbeac159863173447f7a82b3f4757426844ab825"
|
||||||
|
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
|
||||||
|
"checksum thread_local 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "55dd963dbaeadc08aa7266bf7f91c3154a7805e32bb94b820b769d2ef3b4744d"
|
||||||
|
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
|
||||||
|
"checksum winapi 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3969e500d618a5e974917ddefd0ba152e4bcaae5eb5d9b8c1fbc008e9e28c24e"
|
||||||
|
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||||
|
|||||||
@@ -15,3 +15,4 @@ cretonne-reader = { path = "../libreader" }
|
|||||||
docopt = "0.6.80"
|
docopt = "0.6.80"
|
||||||
rustc-serialize = "0.3.19"
|
rustc-serialize = "0.3.19"
|
||||||
regex = "0.1.71"
|
regex = "0.1.71"
|
||||||
|
glob = "0.2.11"
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
extern crate cretonne;
|
extern crate cretonne;
|
||||||
extern crate cton_reader;
|
extern crate cton_reader;
|
||||||
|
extern crate glob;
|
||||||
extern crate regex;
|
extern crate regex;
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
use glob::glob;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Read;
|
||||||
use self::cretonne::ir::Ebb;
|
use self::cretonne::ir::Ebb;
|
||||||
use self::cton_reader::parser::Parser;
|
use self::cton_reader::parser::Parser;
|
||||||
use self::cretonne::ir::function::Function;
|
use self::cretonne::ir::function::Function;
|
||||||
@@ -76,42 +81,16 @@ fn test_dominator_tree(function_source: &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic() {
|
fn test_all() {
|
||||||
test_dominator_tree("
|
let testdir = format!("{}/tests/dominator_tree_testdata/*.cton",
|
||||||
function test(i32) {
|
env::current_dir().unwrap().display());
|
||||||
ebb0(v0: i32): ; dominates(0)
|
|
||||||
jump ebb1 ; dominates(1)
|
|
||||||
ebb1:
|
|
||||||
brz v0, ebb3 ; dominates(3)
|
|
||||||
jump ebb2 ; dominates(2)
|
|
||||||
ebb2:
|
|
||||||
jump ebb3
|
|
||||||
ebb3:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
for entry in glob(&testdir).unwrap() {
|
||||||
fn loops() {
|
let path = entry.unwrap();
|
||||||
test_dominator_tree("
|
println!("Testing {:?}", path);
|
||||||
function test(i32) {
|
let mut file = File::open(&path).unwrap();
|
||||||
ebb0(v0: i32): ; dominates(0)
|
let mut buffer = String::new();
|
||||||
brz v0, ebb1 ; dominates(1,3,4,5)
|
file.read_to_string(&mut buffer).unwrap();
|
||||||
jump ebb2 ; dominates(2)
|
test_dominator_tree(&buffer);
|
||||||
ebb1:
|
}
|
||||||
jump ebb3
|
|
||||||
ebb2:
|
|
||||||
brz v0, ebb4
|
|
||||||
jump ebb5
|
|
||||||
ebb3:
|
|
||||||
jump ebb4
|
|
||||||
ebb4:
|
|
||||||
brz v0, ebb3
|
|
||||||
jump ebb5
|
|
||||||
ebb5:
|
|
||||||
brz v0, ebb4
|
|
||||||
return
|
|
||||||
}
|
|
||||||
");
|
|
||||||
}
|
}
|
||||||
|
|||||||
11
cranelift/src/tools/tests/dominator_tree_testdata/basic.cton
Normal file
11
cranelift/src/tools/tests/dominator_tree_testdata/basic.cton
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
function test(i32) {
|
||||||
|
ebb0(v0: i32): ; dominates(0)
|
||||||
|
jump ebb1 ; dominates(1)
|
||||||
|
ebb1:
|
||||||
|
brz v0, ebb3 ; dominates(3)
|
||||||
|
jump ebb2 ; dominates(2)
|
||||||
|
ebb2:
|
||||||
|
jump ebb3
|
||||||
|
ebb3:
|
||||||
|
return
|
||||||
|
}
|
||||||
18
cranelift/src/tools/tests/dominator_tree_testdata/loops.cton
Normal file
18
cranelift/src/tools/tests/dominator_tree_testdata/loops.cton
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
function test(i32) {
|
||||||
|
ebb0(v0: i32): ; dominates(0)
|
||||||
|
brz v0, ebb1 ; dominates(1,3,4,5)
|
||||||
|
jump ebb2 ; dominates(2)
|
||||||
|
ebb1:
|
||||||
|
jump ebb3
|
||||||
|
ebb2:
|
||||||
|
brz v0, ebb4
|
||||||
|
jump ebb5
|
||||||
|
ebb3:
|
||||||
|
jump ebb4
|
||||||
|
ebb4:
|
||||||
|
brz v0, ebb3
|
||||||
|
jump ebb5
|
||||||
|
ebb5:
|
||||||
|
brz v0, ebb4
|
||||||
|
return
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user