Fix redundant borrows.

This commit is contained in:
Dan Gohman
2017-09-22 16:11:11 -07:00
parent 382415ed0c
commit b583d75c7a
2 changed files with 5 additions and 12 deletions

View File

@@ -83,7 +83,7 @@ pub fn compile_module(
let mut functions_code = Vec::new();
for (function_index, function) in trans_result.functions.iter().enumerate() {
let mut context = Context::new();
verify_function(&function, isa).unwrap();
verify_function(function, isa).unwrap();
context.func = function.clone(); // TODO: Avoid this clone.
let code_size = context.compile(isa).map_err(|e| {
pretty_error(&context.func, Some(isa), e)

View File

@@ -207,14 +207,7 @@ fn handle_module(args: &Args, path: PathBuf, name: &str, isa: &TargetIsa) -> Res
if args.flag_print {
let mut writer1 = stdout();
let mut writer2 = stdout();
match pretty_print_translation(
&name,
&data,
&translation,
&mut writer1,
&mut writer2,
isa,
) {
match pretty_print_translation(name, &data, &translation, &mut writer1, &mut writer2, isa) {
Err(error) => return Err(String::from(error.description())),
Ok(()) => (),
}
@@ -226,10 +219,10 @@ fn handle_module(args: &Args, path: PathBuf, name: &str, isa: &TargetIsa) -> Res
for func in &translation.functions {
let mut loop_analysis = LoopAnalysis::new();
let mut cfg = ControlFlowGraph::new();
cfg.compute(&func);
cfg.compute(func);
let mut domtree = DominatorTree::new();
domtree.compute(&func, &cfg);
loop_analysis.compute(&func, &cfg, &domtree);
domtree.compute(func, &cfg);
loop_analysis.compute(func, &cfg, &domtree);
let mut context = Context::new();
context.func = func.clone(); // TODO: Avoid this clone.
context.cfg = cfg;