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

Method branch_destination

cranelift/codegen/src/ir/instructions.rs:426–443  ·  view source on GitHub ↗

Get the destinations of this instruction, if it's a branch. `br_table` returns the empty slice.

(
        &'a self,
        jump_tables: &'a ir::JumpTables,
        exception_tables: &'a ir::ExceptionTables,
    )

Source from the content-addressed store, hash-verified

424 ///
425 /// `br_table` returns the empty slice.
426 pub fn branch_destination<'a>(
427 &'a self,
428 jump_tables: &'a ir::JumpTables,
429 exception_tables: &'a ir::ExceptionTables,
430 ) -> &'a [BlockCall] {
431 match self {
432 Self::Jump { destination, .. } => core::slice::from_ref(destination),
433 Self::Brif { blocks, .. } => blocks.as_slice(),
434 Self::BranchTable { table, .. } => jump_tables.get(*table).unwrap().all_branches(),
435 Self::TryCall { exception, .. } | Self::TryCallIndirect { exception, .. } => {
436 exception_tables.get(*exception).unwrap().all_branches()
437 }
438 _ => {
439 debug_assert!(!self.opcode().is_branch());
440 &[]
441 }
442 }
443 }
444
445 /// Get a mutable slice of the destinations of this instruction, if it's a branch.
446 ///

Callers 5

mutateMethod · 0.80
do_remove_constant_phisFunction · 0.80
collect_block_callMethod · 0.80
inst_valuesMethod · 0.80
block_successorsMethod · 0.80

Calls 4

as_sliceMethod · 0.45
all_branchesMethod · 0.45
unwrapMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected