pub struct ModulePassManager<'a> { /* private fields */ }Expand description
A configured LLVM module pass manager using the new PassManager infrastructure.
Bundles all analysis managers, PassBuilder, StandardInstrumentations, and the ModulePassManager into a single object with correct lifetime management.
The lifetime 'a is tied to the borrowed inkwell::targets::TargetMachine,
ensuring the target machine outlives the pass manager.
Implementations§
Source§impl<'a> ModulePassManager<'a>
impl<'a> ModulePassManager<'a>
Sourcepub fn with_opt_level(
target_machine: Option<&'a TargetMachine>,
level: OptLevel,
options: Option<&Options>,
) -> Result<Self, Error>
pub fn with_opt_level( target_machine: Option<&'a TargetMachine>, level: OptLevel, options: Option<&Options>, ) -> Result<Self, Error>
Create a pass manager with a standard optimization pipeline.
Examples found in repository?
573fn main() -> Result<(), Box<dyn std::error::Error>> {
574 let module = build_demo_module();
575 module.verify()?;
576 assert_rich_ir(&module);
577
578 let module_ran = Arc::new(AtomicU32::new(0));
579 let function_ran = Arc::new(AtomicU32::new(0));
580 let cgscc_ran = Arc::new(AtomicU32::new(0));
581 let loop_ran = Arc::new(AtomicU32::new(0));
582
583 let mut module_pm = ModulePassManager::with_opt_level(None, OptLevel::O2, None)?;
584 module_pm.add_pass((ModuleAnalysisOnlyPass).into_pass());
585 module_pm.add_pass((ModuleStatsAnalysis).into_pass());
586 module_pm.add_pass(ModuleMutatePass {
587 ran: module_ran.clone(),
588 });
589 module_pm.add_cgscc_pass((CgsccAnalysisOnlyPass).into_pass());
590 module_pm.add_cgscc_pass(CgsccUsesAnalysisPass {
591 ran: cgscc_ran.clone(),
592 registered: Arc::new(AtomicBool::new(false)),
593 });
594 module_pm.run(&module)?;
595
596 let mut function_pm = FunctionPassManager::with_pipeline(
597 None,
598 "loop-simplify,loop-rotate,instcombine,simplifycfg",
599 None,
600 )?;
601 function_pm.add_pass((FunctionAnalysisOnlyPass).into_pass());
602 function_pm.add_pass((FunctionStatsAnalysis).into_pass());
603 function_pm.add_pass(FunctionMutatePass {
604 ran: function_ran.clone(),
605 });
606 function_pm.add_loop_pass((LoopAnalysisOnlyPass).into_pass());
607 function_pm.add_loop_pass(LoopUsesAnalysisPass {
608 ran: loop_ran.clone(),
609 registered: Arc::new(AtomicBool::new(false)),
610 });
611
612 for f in module.get_functions() {
613 if f.count_basic_blocks() == 0 {
614 continue;
615 }
616 function_pm.run(f)?;
617 }
618
619 module.verify()?;
620
621 assert_eq!(
622 get_pass_delta(&module),
623 DELTA_LOOP,
624 "final delta must reflect loop-pass mutation"
625 );
626 assert!(module_ran.load(Ordering::SeqCst) >= 1);
627 assert!(function_ran.load(Ordering::SeqCst) >= 3);
628 assert!(cgscc_ran.load(Ordering::SeqCst) >= 3);
629 assert!(loop_ran.load(Ordering::SeqCst) >= 1);
630
631 // Execute the final IR and assert deterministic output.
632 // driver(12, 5):
633 // callee_cond(12)=11, helper_loop(5)=10, delta=13 => adjusted=34 => returns 35.
634 let ee = module.create_jit_execution_engine(OptimizationLevel::None)?;
635 type DriverFn = unsafe extern "C" fn(i32, i32) -> i32;
636 // SAFETY: "driver" exists with signature i32(i32, i32) in this module.
637 let driver = unsafe { ee.get_function::<DriverFn>("driver") }?;
638 // SAFETY: calling with valid i32 arguments matches the JIT symbol signature.
639 let got = unsafe { driver.call(12, 5) };
640 assert_eq!(got, 35, "unexpected final JIT result");
641
642 println!(
643 "ok: delta={}, module_passes={}, function_passes={}, cgscc_passes={}, loop_passes={}, driver(12,5)={}",
644 get_pass_delta(&module),
645 module_ran.load(Ordering::SeqCst),
646 function_ran.load(Ordering::SeqCst),
647 cgscc_ran.load(Ordering::SeqCst),
648 loop_ran.load(Ordering::SeqCst),
649 got
650 );
651 Ok(())
652}Sourcepub fn with_pipeline(
target_machine: Option<&'a TargetMachine>,
pipeline: &str,
options: Option<&Options>,
) -> Result<Self, Error>
pub fn with_pipeline( target_machine: Option<&'a TargetMachine>, pipeline: &str, options: Option<&Options>, ) -> Result<Self, Error>
Create a pass manager from a textual pipeline description.
The format matches opt -passes=... syntax, e.g.:
"instcombine,dce,sroa""default<O2>""module(function(instcombine,sroa))"
Sourcepub fn with_lto(
target_machine: Option<&'a TargetMachine>,
level: OptLevel,
options: Option<&Options>,
) -> Result<Self, Error>
pub fn with_lto( target_machine: Option<&'a TargetMachine>, level: OptLevel, options: Option<&Options>, ) -> Result<Self, Error>
Create a pass manager with the full-LTO default pipeline.
Sourcepub fn with_lto_pre_link(
target_machine: Option<&'a TargetMachine>,
level: OptLevel,
options: Option<&Options>,
) -> Result<Self, Error>
pub fn with_lto_pre_link( target_machine: Option<&'a TargetMachine>, level: OptLevel, options: Option<&Options>, ) -> Result<Self, Error>
Create a pass manager with the full-LTO pre-link pipeline.
Sourcepub fn with_thin_lto_pre_link(
target_machine: Option<&'a TargetMachine>,
level: OptLevel,
options: Option<&Options>,
) -> Result<Self, Error>
pub fn with_thin_lto_pre_link( target_machine: Option<&'a TargetMachine>, level: OptLevel, options: Option<&Options>, ) -> Result<Self, Error>
Create a pass manager with the ThinLTO pre-link pipeline.
Sourcepub fn new(
target_machine: Option<&'a TargetMachine>,
options: Option<&Options>,
) -> Result<Self, Error>
pub fn new( target_machine: Option<&'a TargetMachine>, options: Option<&Options>, ) -> Result<Self, Error>
Create an empty module pass manager with no built-in passes.
Use add_pass() to add custom passes.
Examples found in repository?
290fn main() -> Result<(), Box<dyn std::error::Error>> {
291 let module = build_module_with_dead_code();
292 module.verify()?;
293
294 let removed = Arc::new(AtomicU32::new(0));
295
296 // Phase 1: Report initial stats + CGSCC analysis (before DCE)
297 {
298 let mut pm = ModulePassManager::new(None, None)?;
299 pm.add_pass(DCEStatsPass {
300 label: "Before DCE",
301 });
302 pm.add_cgscc_pass(BasicBlockReportPass {
303 registered: Arc::new(AtomicBool::new(false)),
304 });
305 pm.run(&module)?;
306 }
307
308 // Phase 2: Run DCE on each function
309 {
310 let mut fpm = FunctionPassManager::new(None, None)?;
311 fpm.add_pass(SimpleDCEPass {
312 removed: removed.clone(),
313 });
314 for func in module.get_functions() {
315 if func.count_basic_blocks() == 0 {
316 continue;
317 }
318 fpm.run(func)?;
319 }
320 }
321
322 module.verify()?;
323
324 // Phase 3: Report final stats (after DCE)
325 {
326 let mut pm = ModulePassManager::new(None, None)?;
327 pm.add_pass(DCEStatsPass { label: "After DCE" });
328 pm.run(&module)?;
329 }
330
331 let total_removed = removed.load(Ordering::SeqCst);
332 println!("\nRemoved {} dead instructions", total_removed);
333 assert!(
334 total_removed >= 5,
335 "Expected to remove at least 5 dead instructions, got {}",
336 total_removed
337 );
338
339 println!("ok");
340 Ok(())
341}Sourcepub fn add_pass<P>(&mut self, pass: P)where
P: LlvmModulePass + 'static,
pub fn add_pass<P>(&mut self, pass: P)where
P: LlvmModulePass + 'static,
Add a custom module pass to this pass manager.
The pass is moved into the pass manager and kept alive until the pass manager is dropped. The pass is appended after any existing passes in the pipeline.
Examples found in repository?
290fn main() -> Result<(), Box<dyn std::error::Error>> {
291 let module = build_module_with_dead_code();
292 module.verify()?;
293
294 let removed = Arc::new(AtomicU32::new(0));
295
296 // Phase 1: Report initial stats + CGSCC analysis (before DCE)
297 {
298 let mut pm = ModulePassManager::new(None, None)?;
299 pm.add_pass(DCEStatsPass {
300 label: "Before DCE",
301 });
302 pm.add_cgscc_pass(BasicBlockReportPass {
303 registered: Arc::new(AtomicBool::new(false)),
304 });
305 pm.run(&module)?;
306 }
307
308 // Phase 2: Run DCE on each function
309 {
310 let mut fpm = FunctionPassManager::new(None, None)?;
311 fpm.add_pass(SimpleDCEPass {
312 removed: removed.clone(),
313 });
314 for func in module.get_functions() {
315 if func.count_basic_blocks() == 0 {
316 continue;
317 }
318 fpm.run(func)?;
319 }
320 }
321
322 module.verify()?;
323
324 // Phase 3: Report final stats (after DCE)
325 {
326 let mut pm = ModulePassManager::new(None, None)?;
327 pm.add_pass(DCEStatsPass { label: "After DCE" });
328 pm.run(&module)?;
329 }
330
331 let total_removed = removed.load(Ordering::SeqCst);
332 println!("\nRemoved {} dead instructions", total_removed);
333 assert!(
334 total_removed >= 5,
335 "Expected to remove at least 5 dead instructions, got {}",
336 total_removed
337 );
338
339 println!("ok");
340 Ok(())
341}More examples
573fn main() -> Result<(), Box<dyn std::error::Error>> {
574 let module = build_demo_module();
575 module.verify()?;
576 assert_rich_ir(&module);
577
578 let module_ran = Arc::new(AtomicU32::new(0));
579 let function_ran = Arc::new(AtomicU32::new(0));
580 let cgscc_ran = Arc::new(AtomicU32::new(0));
581 let loop_ran = Arc::new(AtomicU32::new(0));
582
583 let mut module_pm = ModulePassManager::with_opt_level(None, OptLevel::O2, None)?;
584 module_pm.add_pass((ModuleAnalysisOnlyPass).into_pass());
585 module_pm.add_pass((ModuleStatsAnalysis).into_pass());
586 module_pm.add_pass(ModuleMutatePass {
587 ran: module_ran.clone(),
588 });
589 module_pm.add_cgscc_pass((CgsccAnalysisOnlyPass).into_pass());
590 module_pm.add_cgscc_pass(CgsccUsesAnalysisPass {
591 ran: cgscc_ran.clone(),
592 registered: Arc::new(AtomicBool::new(false)),
593 });
594 module_pm.run(&module)?;
595
596 let mut function_pm = FunctionPassManager::with_pipeline(
597 None,
598 "loop-simplify,loop-rotate,instcombine,simplifycfg",
599 None,
600 )?;
601 function_pm.add_pass((FunctionAnalysisOnlyPass).into_pass());
602 function_pm.add_pass((FunctionStatsAnalysis).into_pass());
603 function_pm.add_pass(FunctionMutatePass {
604 ran: function_ran.clone(),
605 });
606 function_pm.add_loop_pass((LoopAnalysisOnlyPass).into_pass());
607 function_pm.add_loop_pass(LoopUsesAnalysisPass {
608 ran: loop_ran.clone(),
609 registered: Arc::new(AtomicBool::new(false)),
610 });
611
612 for f in module.get_functions() {
613 if f.count_basic_blocks() == 0 {
614 continue;
615 }
616 function_pm.run(f)?;
617 }
618
619 module.verify()?;
620
621 assert_eq!(
622 get_pass_delta(&module),
623 DELTA_LOOP,
624 "final delta must reflect loop-pass mutation"
625 );
626 assert!(module_ran.load(Ordering::SeqCst) >= 1);
627 assert!(function_ran.load(Ordering::SeqCst) >= 3);
628 assert!(cgscc_ran.load(Ordering::SeqCst) >= 3);
629 assert!(loop_ran.load(Ordering::SeqCst) >= 1);
630
631 // Execute the final IR and assert deterministic output.
632 // driver(12, 5):
633 // callee_cond(12)=11, helper_loop(5)=10, delta=13 => adjusted=34 => returns 35.
634 let ee = module.create_jit_execution_engine(OptimizationLevel::None)?;
635 type DriverFn = unsafe extern "C" fn(i32, i32) -> i32;
636 // SAFETY: "driver" exists with signature i32(i32, i32) in this module.
637 let driver = unsafe { ee.get_function::<DriverFn>("driver") }?;
638 // SAFETY: calling with valid i32 arguments matches the JIT symbol signature.
639 let got = unsafe { driver.call(12, 5) };
640 assert_eq!(got, 35, "unexpected final JIT result");
641
642 println!(
643 "ok: delta={}, module_passes={}, function_passes={}, cgscc_passes={}, loop_passes={}, driver(12,5)={}",
644 get_pass_delta(&module),
645 module_ran.load(Ordering::SeqCst),
646 function_ran.load(Ordering::SeqCst),
647 cgscc_ran.load(Ordering::SeqCst),
648 loop_ran.load(Ordering::SeqCst),
649 got
650 );
651 Ok(())
652}Sourcepub fn add_cgscc_pass<P>(&mut self, pass: P)where
P: LlvmCgsccPass + 'static,
pub fn add_cgscc_pass<P>(&mut self, pass: P)where
P: LlvmCgsccPass + 'static,
Add a custom CGSCC pass to this pass manager.
The pass is adapted into the module pipeline and invoked for each function in each SCC.
Examples found in repository?
290fn main() -> Result<(), Box<dyn std::error::Error>> {
291 let module = build_module_with_dead_code();
292 module.verify()?;
293
294 let removed = Arc::new(AtomicU32::new(0));
295
296 // Phase 1: Report initial stats + CGSCC analysis (before DCE)
297 {
298 let mut pm = ModulePassManager::new(None, None)?;
299 pm.add_pass(DCEStatsPass {
300 label: "Before DCE",
301 });
302 pm.add_cgscc_pass(BasicBlockReportPass {
303 registered: Arc::new(AtomicBool::new(false)),
304 });
305 pm.run(&module)?;
306 }
307
308 // Phase 2: Run DCE on each function
309 {
310 let mut fpm = FunctionPassManager::new(None, None)?;
311 fpm.add_pass(SimpleDCEPass {
312 removed: removed.clone(),
313 });
314 for func in module.get_functions() {
315 if func.count_basic_blocks() == 0 {
316 continue;
317 }
318 fpm.run(func)?;
319 }
320 }
321
322 module.verify()?;
323
324 // Phase 3: Report final stats (after DCE)
325 {
326 let mut pm = ModulePassManager::new(None, None)?;
327 pm.add_pass(DCEStatsPass { label: "After DCE" });
328 pm.run(&module)?;
329 }
330
331 let total_removed = removed.load(Ordering::SeqCst);
332 println!("\nRemoved {} dead instructions", total_removed);
333 assert!(
334 total_removed >= 5,
335 "Expected to remove at least 5 dead instructions, got {}",
336 total_removed
337 );
338
339 println!("ok");
340 Ok(())
341}More examples
573fn main() -> Result<(), Box<dyn std::error::Error>> {
574 let module = build_demo_module();
575 module.verify()?;
576 assert_rich_ir(&module);
577
578 let module_ran = Arc::new(AtomicU32::new(0));
579 let function_ran = Arc::new(AtomicU32::new(0));
580 let cgscc_ran = Arc::new(AtomicU32::new(0));
581 let loop_ran = Arc::new(AtomicU32::new(0));
582
583 let mut module_pm = ModulePassManager::with_opt_level(None, OptLevel::O2, None)?;
584 module_pm.add_pass((ModuleAnalysisOnlyPass).into_pass());
585 module_pm.add_pass((ModuleStatsAnalysis).into_pass());
586 module_pm.add_pass(ModuleMutatePass {
587 ran: module_ran.clone(),
588 });
589 module_pm.add_cgscc_pass((CgsccAnalysisOnlyPass).into_pass());
590 module_pm.add_cgscc_pass(CgsccUsesAnalysisPass {
591 ran: cgscc_ran.clone(),
592 registered: Arc::new(AtomicBool::new(false)),
593 });
594 module_pm.run(&module)?;
595
596 let mut function_pm = FunctionPassManager::with_pipeline(
597 None,
598 "loop-simplify,loop-rotate,instcombine,simplifycfg",
599 None,
600 )?;
601 function_pm.add_pass((FunctionAnalysisOnlyPass).into_pass());
602 function_pm.add_pass((FunctionStatsAnalysis).into_pass());
603 function_pm.add_pass(FunctionMutatePass {
604 ran: function_ran.clone(),
605 });
606 function_pm.add_loop_pass((LoopAnalysisOnlyPass).into_pass());
607 function_pm.add_loop_pass(LoopUsesAnalysisPass {
608 ran: loop_ran.clone(),
609 registered: Arc::new(AtomicBool::new(false)),
610 });
611
612 for f in module.get_functions() {
613 if f.count_basic_blocks() == 0 {
614 continue;
615 }
616 function_pm.run(f)?;
617 }
618
619 module.verify()?;
620
621 assert_eq!(
622 get_pass_delta(&module),
623 DELTA_LOOP,
624 "final delta must reflect loop-pass mutation"
625 );
626 assert!(module_ran.load(Ordering::SeqCst) >= 1);
627 assert!(function_ran.load(Ordering::SeqCst) >= 3);
628 assert!(cgscc_ran.load(Ordering::SeqCst) >= 3);
629 assert!(loop_ran.load(Ordering::SeqCst) >= 1);
630
631 // Execute the final IR and assert deterministic output.
632 // driver(12, 5):
633 // callee_cond(12)=11, helper_loop(5)=10, delta=13 => adjusted=34 => returns 35.
634 let ee = module.create_jit_execution_engine(OptimizationLevel::None)?;
635 type DriverFn = unsafe extern "C" fn(i32, i32) -> i32;
636 // SAFETY: "driver" exists with signature i32(i32, i32) in this module.
637 let driver = unsafe { ee.get_function::<DriverFn>("driver") }?;
638 // SAFETY: calling with valid i32 arguments matches the JIT symbol signature.
639 let got = unsafe { driver.call(12, 5) };
640 assert_eq!(got, 35, "unexpected final JIT result");
641
642 println!(
643 "ok: delta={}, module_passes={}, function_passes={}, cgscc_passes={}, loop_passes={}, driver(12,5)={}",
644 get_pass_delta(&module),
645 module_ran.load(Ordering::SeqCst),
646 function_ran.load(Ordering::SeqCst),
647 cgscc_ran.load(Ordering::SeqCst),
648 loop_ran.load(Ordering::SeqCst),
649 got
650 );
651 Ok(())
652}Sourcepub fn add_function_pass_via_cgscc<P>(&mut self, pass: P)where
P: LlvmFunctionPass + 'static,
pub fn add_function_pass_via_cgscc<P>(&mut self, pass: P)where
P: LlvmFunctionPass + 'static,
Add a custom function pass adapted through the CGSCC level.
The pass is wrapped with Module → CGSCC → Function adaptors, so it
runs on each function within the CGSCC traversal order.
Sourcepub fn add_loop_pass_via_cgscc<P>(&mut self, pass: P)where
P: LlvmLoopPass + 'static,
pub fn add_loop_pass_via_cgscc<P>(&mut self, pass: P)where
P: LlvmLoopPass + 'static,
Add a custom loop pass adapted through the CGSCC and function levels.
The pass is wrapped with Module → CGSCC → Function → Loop adaptors.
Sourcepub fn run(&mut self, module: &Module<'_>) -> Result<(), Error>
pub fn run(&mut self, module: &Module<'_>) -> Result<(), Error>
Run the optimization passes on the given module.
Examples found in repository?
290fn main() -> Result<(), Box<dyn std::error::Error>> {
291 let module = build_module_with_dead_code();
292 module.verify()?;
293
294 let removed = Arc::new(AtomicU32::new(0));
295
296 // Phase 1: Report initial stats + CGSCC analysis (before DCE)
297 {
298 let mut pm = ModulePassManager::new(None, None)?;
299 pm.add_pass(DCEStatsPass {
300 label: "Before DCE",
301 });
302 pm.add_cgscc_pass(BasicBlockReportPass {
303 registered: Arc::new(AtomicBool::new(false)),
304 });
305 pm.run(&module)?;
306 }
307
308 // Phase 2: Run DCE on each function
309 {
310 let mut fpm = FunctionPassManager::new(None, None)?;
311 fpm.add_pass(SimpleDCEPass {
312 removed: removed.clone(),
313 });
314 for func in module.get_functions() {
315 if func.count_basic_blocks() == 0 {
316 continue;
317 }
318 fpm.run(func)?;
319 }
320 }
321
322 module.verify()?;
323
324 // Phase 3: Report final stats (after DCE)
325 {
326 let mut pm = ModulePassManager::new(None, None)?;
327 pm.add_pass(DCEStatsPass { label: "After DCE" });
328 pm.run(&module)?;
329 }
330
331 let total_removed = removed.load(Ordering::SeqCst);
332 println!("\nRemoved {} dead instructions", total_removed);
333 assert!(
334 total_removed >= 5,
335 "Expected to remove at least 5 dead instructions, got {}",
336 total_removed
337 );
338
339 println!("ok");
340 Ok(())
341}More examples
573fn main() -> Result<(), Box<dyn std::error::Error>> {
574 let module = build_demo_module();
575 module.verify()?;
576 assert_rich_ir(&module);
577
578 let module_ran = Arc::new(AtomicU32::new(0));
579 let function_ran = Arc::new(AtomicU32::new(0));
580 let cgscc_ran = Arc::new(AtomicU32::new(0));
581 let loop_ran = Arc::new(AtomicU32::new(0));
582
583 let mut module_pm = ModulePassManager::with_opt_level(None, OptLevel::O2, None)?;
584 module_pm.add_pass((ModuleAnalysisOnlyPass).into_pass());
585 module_pm.add_pass((ModuleStatsAnalysis).into_pass());
586 module_pm.add_pass(ModuleMutatePass {
587 ran: module_ran.clone(),
588 });
589 module_pm.add_cgscc_pass((CgsccAnalysisOnlyPass).into_pass());
590 module_pm.add_cgscc_pass(CgsccUsesAnalysisPass {
591 ran: cgscc_ran.clone(),
592 registered: Arc::new(AtomicBool::new(false)),
593 });
594 module_pm.run(&module)?;
595
596 let mut function_pm = FunctionPassManager::with_pipeline(
597 None,
598 "loop-simplify,loop-rotate,instcombine,simplifycfg",
599 None,
600 )?;
601 function_pm.add_pass((FunctionAnalysisOnlyPass).into_pass());
602 function_pm.add_pass((FunctionStatsAnalysis).into_pass());
603 function_pm.add_pass(FunctionMutatePass {
604 ran: function_ran.clone(),
605 });
606 function_pm.add_loop_pass((LoopAnalysisOnlyPass).into_pass());
607 function_pm.add_loop_pass(LoopUsesAnalysisPass {
608 ran: loop_ran.clone(),
609 registered: Arc::new(AtomicBool::new(false)),
610 });
611
612 for f in module.get_functions() {
613 if f.count_basic_blocks() == 0 {
614 continue;
615 }
616 function_pm.run(f)?;
617 }
618
619 module.verify()?;
620
621 assert_eq!(
622 get_pass_delta(&module),
623 DELTA_LOOP,
624 "final delta must reflect loop-pass mutation"
625 );
626 assert!(module_ran.load(Ordering::SeqCst) >= 1);
627 assert!(function_ran.load(Ordering::SeqCst) >= 3);
628 assert!(cgscc_ran.load(Ordering::SeqCst) >= 3);
629 assert!(loop_ran.load(Ordering::SeqCst) >= 1);
630
631 // Execute the final IR and assert deterministic output.
632 // driver(12, 5):
633 // callee_cond(12)=11, helper_loop(5)=10, delta=13 => adjusted=34 => returns 35.
634 let ee = module.create_jit_execution_engine(OptimizationLevel::None)?;
635 type DriverFn = unsafe extern "C" fn(i32, i32) -> i32;
636 // SAFETY: "driver" exists with signature i32(i32, i32) in this module.
637 let driver = unsafe { ee.get_function::<DriverFn>("driver") }?;
638 // SAFETY: calling with valid i32 arguments matches the JIT symbol signature.
639 let got = unsafe { driver.call(12, 5) };
640 assert_eq!(got, 35, "unexpected final JIT result");
641
642 println!(
643 "ok: delta={}, module_passes={}, function_passes={}, cgscc_passes={}, loop_passes={}, driver(12,5)={}",
644 get_pass_delta(&module),
645 module_ran.load(Ordering::SeqCst),
646 function_ran.load(Ordering::SeqCst),
647 cgscc_ran.load(Ordering::SeqCst),
648 loop_ran.load(Ordering::SeqCst),
649 got
650 );
651 Ok(())
652}Trait Implementations§
Source§impl<'a> Debug for ModulePassManager<'a>
impl<'a> Debug for ModulePassManager<'a>
Source§impl<'a> Drop for ModulePassManager<'a>
impl<'a> Drop for ModulePassManager<'a>
impl<'a> Send for ModulePassManager<'a>
Auto Trait Implementations§
impl<'a> Freeze for ModulePassManager<'a>
impl<'a> !RefUnwindSafe for ModulePassManager<'a>
impl<'a> !Sync for ModulePassManager<'a>
impl<'a> Unpin for ModulePassManager<'a>
impl<'a> UnsafeUnpin for ModulePassManager<'a>
impl<'a> !UnwindSafe for ModulePassManager<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more