Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ block0:
v5 = vall_true v4
return v5
}
; run:
; run

function %swizzle_with_overflow() -> b1 {
block0:
Expand All @@ -190,4 +190,4 @@ block0:
v5 = vall_true v4
return v5
}
; run:
; run
8 changes: 8 additions & 0 deletions cranelift/filetests/src/test_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use crate::function_runner::FunctionRunner;
use crate::subtest::{Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir;
use cranelift_reader::parse_run_command;
use cranelift_reader::TestCommand;
use log::trace;
use std::borrow::Cow;

struct TestRun;
Expand Down Expand Up @@ -36,6 +38,12 @@ impl SubTest for TestRun {
fn run(&self, func: Cow<ir::Function>, context: &Context) -> SubtestResult<()> {
for comment in context.details.comments.iter() {
if comment.text.contains("run") {
let trimmed_comment = comment.text.trim_start_matches(|c| c == ' ' || c == ';');
let command = parse_run_command(trimmed_comment, &func.signature)
.map_err(|e| format!("{}", e))?;
trace!("Parsed run command: {}", command);
// TODO in following changes we will use the parsed command to alter FunctionRunner's behavior.

let runner =
FunctionRunner::with_host_isa(func.clone().into_owned(), context.flags.clone());
runner.run()?
Expand Down
2 changes: 1 addition & 1 deletion cranelift/reader/src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub enum Token<'a> {
SigRef(u32), // sig2
UserRef(u32), // u345
Name(&'a str), // %9arbitrary_alphanum, %x3, %0, %function ...
String(&'a str), // "abritrary quoted string with no escape" ...
String(&'a str), // "arbitrary quoted string with no escape" ...
HexSequence(&'a str), // #89AF
Identifier(&'a str), // Unrecognized identifier (opcode, enumerator, ...)
SourceLoc(&'a str), // @00c7
Expand Down
4 changes: 3 additions & 1 deletion cranelift/reader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

pub use crate::error::{Location, ParseError, ParseResult};
pub use crate::isaspec::{parse_options, IsaSpec};
pub use crate::parser::{parse_functions, parse_test, ParseOptions};
pub use crate::parser::{parse_functions, parse_run_command, parse_test, ParseOptions};
pub use crate::run_command::{Comparison, DataValue, Invocation, RunCommand};
pub use crate::sourcemap::SourceMap;
pub use crate::testcommand::{TestCommand, TestOption};
pub use crate::testfile::{Comment, Details, Feature, TestFile};
Expand All @@ -37,6 +38,7 @@ mod error;
mod isaspec;
mod lexer;
mod parser;
mod run_command;
mod sourcemap;
mod testcommand;
mod testfile;
Loading