Use to_string() instead of write!(&mut text, "{}", ....
This commit is contained in:
@@ -7,7 +7,6 @@ use cretonne_codegen::print_errors::pretty_error;
|
|||||||
use cretonne_codegen::{binemit, ir};
|
use cretonne_codegen::{binemit, ir};
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::Write;
|
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, Result, SubTest};
|
||||||
|
|
||||||
struct TestCompile;
|
struct TestCompile;
|
||||||
@@ -64,8 +63,7 @@ impl SubTest for TestCompile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run final code through filecheck.
|
// Run final code through filecheck.
|
||||||
let mut text = String::new();
|
let text = comp_ctx.func.display(Some(isa)).to_string();
|
||||||
write!(&mut text, "{}", &comp_ctx.func.display(Some(isa))).map_err(|e| e.to_string())?;
|
|
||||||
run_filecheck(&text, context)
|
run_filecheck(&text, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::Write;
|
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, Result, SubTest};
|
||||||
|
|
||||||
struct TestDCE;
|
struct TestDCE;
|
||||||
@@ -42,8 +41,7 @@ impl SubTest for TestDCE {
|
|||||||
.dce(context.flags_or_isa())
|
.dce(context.flags_or_isa())
|
||||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
||||||
|
|
||||||
let mut text = String::new();
|
let text = comp_ctx.func.to_string();
|
||||||
write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?;
|
|
||||||
run_filecheck(&text, context)
|
run_filecheck(&text, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::Write;
|
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, Result, SubTest};
|
||||||
|
|
||||||
struct TestLegalizer;
|
struct TestLegalizer;
|
||||||
@@ -44,8 +43,7 @@ impl SubTest for TestLegalizer {
|
|||||||
.legalize(isa)
|
.legalize(isa)
|
||||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, e))?;
|
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, e))?;
|
||||||
|
|
||||||
let mut text = String::new();
|
let text = comp_ctx.func.display(Some(isa)).to_string();
|
||||||
write!(&mut text, "{}", &comp_ctx.func.display(Some(isa))).map_err(|e| e.to_string())?;
|
|
||||||
run_filecheck(&text, context)
|
run_filecheck(&text, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::Write;
|
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, Result, SubTest};
|
||||||
|
|
||||||
struct TestLICM;
|
struct TestLICM;
|
||||||
@@ -42,8 +41,7 @@ impl SubTest for TestLICM {
|
|||||||
.licm(context.flags_or_isa())
|
.licm(context.flags_or_isa())
|
||||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
||||||
|
|
||||||
let mut text = String::new();
|
let text = comp_ctx.func.to_string();
|
||||||
write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?;
|
|
||||||
run_filecheck(&text, context)
|
run_filecheck(&text, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::Write;
|
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, Result, SubTest};
|
||||||
|
|
||||||
struct TestPostopt;
|
struct TestPostopt;
|
||||||
@@ -39,8 +38,7 @@ impl SubTest for TestPostopt {
|
|||||||
.postopt(isa)
|
.postopt(isa)
|
||||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
||||||
|
|
||||||
let mut text = String::new();
|
let text = comp_ctx.func.to_string();
|
||||||
write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?;
|
|
||||||
run_filecheck(&text, context)
|
run_filecheck(&text, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::Write;
|
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, Result, SubTest};
|
||||||
|
|
||||||
struct TestPreopt;
|
struct TestPreopt;
|
||||||
@@ -39,8 +38,7 @@ impl SubTest for TestPreopt {
|
|||||||
.preopt(isa)
|
.preopt(isa)
|
||||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
||||||
|
|
||||||
let mut text = String::new();
|
let text = &comp_ctx.func.to_string();
|
||||||
write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?;
|
|
||||||
run_filecheck(&text, context)
|
run_filecheck(&text, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::Write;
|
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, Result, SubTest};
|
||||||
|
|
||||||
struct TestRegalloc;
|
struct TestRegalloc;
|
||||||
@@ -51,8 +50,7 @@ impl SubTest for TestRegalloc {
|
|||||||
.regalloc(isa)
|
.regalloc(isa)
|
||||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, e))?;
|
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, e))?;
|
||||||
|
|
||||||
let mut text = String::new();
|
let text = comp_ctx.func.display(Some(isa)).to_string();
|
||||||
write!(&mut text, "{}", &comp_ctx.func.display(Some(isa))).map_err(|e| e.to_string())?;
|
|
||||||
run_filecheck(&text, context)
|
run_filecheck(&text, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt::Write;
|
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, Result, SubTest};
|
||||||
|
|
||||||
struct TestSimpleGVN;
|
struct TestSimpleGVN;
|
||||||
@@ -41,8 +40,7 @@ impl SubTest for TestSimpleGVN {
|
|||||||
.simple_gvn(context.flags_or_isa())
|
.simple_gvn(context.flags_or_isa())
|
||||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
|
||||||
|
|
||||||
let mut text = String::new();
|
let text = comp_ctx.func.to_string();
|
||||||
write!(&mut text, "{}", &comp_ctx.func).map_err(|e| e.to_string())?;
|
|
||||||
run_filecheck(&text, context)
|
run_filecheck(&text, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user