diff --git a/compilers/rustyc/optimizer/src/main.rs b/compilers/rustyc/optimizer/src/main.rs index 07baa60d..097f7915 100644 --- a/compilers/rustyc/optimizer/src/main.rs +++ b/compilers/rustyc/optimizer/src/main.rs @@ -165,7 +165,6 @@ fn main() { // anaylsiser_example(); } - pub fn create_licm_graph_simple_example_from_cmu() -> Function { let mut function = Function::new(String::from("test_fun")); // create blocks @@ -195,8 +194,12 @@ pub fn create_licm_graph_simple_example_from_cmu() -> Function { let a_inner = function.build_add_inst(b, c); let e = function.add_register(IrValueType::I16); function.insert_inst_to_block_front( - &b2, - ir::instructions::InstructionData::Phi { opcode: ir::instructions::OpCode::Phi, dst: e , from: vec![(b2, a_inner), (b1, a)] } + &b2, + ir::instructions::InstructionData::Phi { + opcode: ir::instructions::OpCode::Phi, + dst: e, + from: vec![(b2, a_inner), (b1, a)], + }, ); // exit function.switch_to_block(b3); @@ -256,4 +259,4 @@ pub fn create_licm_graph_example_from_cmu() -> Function { function.build_ret_inst(None); function -} \ No newline at end of file +} diff --git a/compilers/rustyc/optimizer/tests/build_ir_graph.rs b/compilers/rustyc/optimizer/tests/build_ir_graph.rs index 9c11d950..21ba28ca 100644 --- a/compilers/rustyc/optimizer/tests/build_ir_graph.rs +++ b/compilers/rustyc/optimizer/tests/build_ir_graph.rs @@ -262,8 +262,12 @@ pub fn create_licm_graph_simple_example_from_cmu() -> Function { let a_inner = function.build_add_inst(b, c); let e = function.add_register(IrValueType::I16); function.insert_inst_to_block_front( - &b2, - ir::instructions::InstructionData::Phi { opcode: ir::instructions::OpCode::Phi, dst: e , from: vec![(b2, a_inner), (b1, a)] } + &b2, + ir::instructions::InstructionData::Phi { + opcode: ir::instructions::OpCode::Phi, + dst: e, + from: vec![(b2, a_inner), (b1, a)], + }, ); // exit function.switch_to_block(b3); diff --git a/compilers/rustyc/optimizer/tests/ir_optimizer_test_runner.rs b/compilers/rustyc/optimizer/tests/ir_optimizer_test_runner.rs index 56251b89..ce37dcad 100644 --- a/compilers/rustyc/optimizer/tests/ir_optimizer_test_runner.rs +++ b/compilers/rustyc/optimizer/tests/ir_optimizer_test_runner.rs @@ -132,21 +132,19 @@ generate_pass_cases!( let after = fun.print_to_string(); (before, table, after) }), - ( - test_licm_pass_cmu_example_2, "./licm/cmu_example_2", || { - let mut fun = create_licm_graph_simple_example_from_cmu(); - let before = fun.print_to_string(); - let mut dom = DomAnaylsier::new(); - let dom_table = dom.anaylsis(&fun); - let mut use_def = UseDefAnaylsier::new(); - let use_def_table = use_def.anaylsis(&fun); - let mut pass = LICMPass::new(&use_def_table, &dom_table); - pass.process(&mut fun); - let table = pass.debugger(&fun); - let after = fun.print_to_string(); - (before, table, after) - } - ) + (test_licm_pass_cmu_example_2, "./licm/cmu_example_2", || { + let mut fun = create_licm_graph_simple_example_from_cmu(); + let before = fun.print_to_string(); + let mut dom = DomAnaylsier::new(); + let dom_table = dom.anaylsis(&fun); + let mut use_def = UseDefAnaylsier::new(); + let use_def_table = use_def.anaylsis(&fun); + let mut pass = LICMPass::new(&use_def_table, &dom_table); + pass.process(&mut fun); + let table = pass.debugger(&fun); + let after = fun.print_to_string(); + (before, table, after) + }) ); #[test]