| 563 | "omitting the frame pointer changed UART output" |
| 564 | ); |
| 565 | assert!( |
| 566 | omit_lines <= base_lines, |
| 567 | "omitting the frame pointer should not add instructions: {base_lines} -> {omit_lines}" |
| 568 | ); |
| 569 | } |
| 570 | |
| 571 | // Returns the VM run plus the emitted instruction count, so a caller can |
| 572 | // compare IR optimization on against off. |
| 573 | fn run_hll_optimize(src: &str, opts: hll_to_ir::OptOptions) -> (StepOutcome, String, usize) { |
| 574 | let mut pipeline = CompilationPipeline::new(); |
| 575 | pipeline.set_write_artifacts(false); |
| 576 | pipeline.set_optimize(opts); |
| 577 | |
| 578 | let user_result = pipeline.compile(src).expect("user compile failed"); |
| 579 | let (_, user_tokens) = pipeline.compile_ir_to_assembly_with_tokens(&user_result.ir_program); |
| 580 | let code_lines = user_tokens.iter().filter(|t| t.is_code()).count(); |
| 581 | let user_obj = pipeline |
| 582 | .assemble(&user_tokens) |