MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / cf_weight

Method cf_weight

cranelift/isle/isle/src/codegen.rs:645–654  ·  view source on GitHub ↗
(cf: &ControlFlow)

Source from the content-addressed store, hash-verified

643
644 fn block_weight(block: &Block) -> usize {
645 fn cf_weight(cf: &ControlFlow) -> usize {
646 match cf {
647 ControlFlow::Match { arms, .. } => {
648 arms.iter().map(|a| Codegen::block_weight(&a.body)).sum()
649 }
650 ControlFlow::Equal { body, .. } => Codegen::block_weight(body),
651 ControlFlow::Loop { body, .. } => Codegen::block_weight(body),
652 ControlFlow::Return { .. } => 0,
653 }
654 }
655
656 block.steps.iter().map(|s| 1 + cf_weight(&s.check)).sum()
657 }

Callers

nothing calls this directly

Calls 3

sumMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected