Fix redundant borrows.
This commit is contained in:
@@ -83,7 +83,7 @@ pub fn compile_module(
|
|||||||
let mut functions_code = Vec::new();
|
let mut functions_code = Vec::new();
|
||||||
for (function_index, function) in trans_result.functions.iter().enumerate() {
|
for (function_index, function) in trans_result.functions.iter().enumerate() {
|
||||||
let mut context = Context::new();
|
let mut context = Context::new();
|
||||||
verify_function(&function, isa).unwrap();
|
verify_function(function, isa).unwrap();
|
||||||
context.func = function.clone(); // TODO: Avoid this clone.
|
context.func = function.clone(); // TODO: Avoid this clone.
|
||||||
let code_size = context.compile(isa).map_err(|e| {
|
let code_size = context.compile(isa).map_err(|e| {
|
||||||
pretty_error(&context.func, Some(isa), e)
|
pretty_error(&context.func, Some(isa), e)
|
||||||
|
|||||||
15
src/main.rs
15
src/main.rs
@@ -207,14 +207,7 @@ fn handle_module(args: &Args, path: PathBuf, name: &str, isa: &TargetIsa) -> Res
|
|||||||
if args.flag_print {
|
if args.flag_print {
|
||||||
let mut writer1 = stdout();
|
let mut writer1 = stdout();
|
||||||
let mut writer2 = stdout();
|
let mut writer2 = stdout();
|
||||||
match pretty_print_translation(
|
match pretty_print_translation(name, &data, &translation, &mut writer1, &mut writer2, isa) {
|
||||||
&name,
|
|
||||||
&data,
|
|
||||||
&translation,
|
|
||||||
&mut writer1,
|
|
||||||
&mut writer2,
|
|
||||||
isa,
|
|
||||||
) {
|
|
||||||
Err(error) => return Err(String::from(error.description())),
|
Err(error) => return Err(String::from(error.description())),
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
}
|
}
|
||||||
@@ -226,10 +219,10 @@ fn handle_module(args: &Args, path: PathBuf, name: &str, isa: &TargetIsa) -> Res
|
|||||||
for func in &translation.functions {
|
for func in &translation.functions {
|
||||||
let mut loop_analysis = LoopAnalysis::new();
|
let mut loop_analysis = LoopAnalysis::new();
|
||||||
let mut cfg = ControlFlowGraph::new();
|
let mut cfg = ControlFlowGraph::new();
|
||||||
cfg.compute(&func);
|
cfg.compute(func);
|
||||||
let mut domtree = DominatorTree::new();
|
let mut domtree = DominatorTree::new();
|
||||||
domtree.compute(&func, &cfg);
|
domtree.compute(func, &cfg);
|
||||||
loop_analysis.compute(&func, &cfg, &domtree);
|
loop_analysis.compute(func, &cfg, &domtree);
|
||||||
let mut context = Context::new();
|
let mut context = Context::new();
|
||||||
context.func = func.clone(); // TODO: Avoid this clone.
|
context.func = func.clone(); // TODO: Avoid this clone.
|
||||||
context.cfg = cfg;
|
context.cfg = cfg;
|
||||||
|
|||||||
Reference in New Issue
Block a user