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

Function inline_block_layout

cranelift/codegen/src/inline.rs:1053–1078  ·  view source on GitHub ↗

Inline the callee's layout into the caller's layout. Returns the last inlined block in the layout.

(
    func: &mut ir::Function,
    call_block: ir::Block,
    callee: &ir::Function,
    entity_map: &EntityMap,
)

Source from the content-addressed store, hash-verified

1051///
1052/// Returns the last inlined block in the layout.
1053fn inline_block_layout(
1054 func: &mut ir::Function,
1055 call_block: ir::Block,
1056 callee: &ir::Function,
1057 entity_map: &EntityMap,
1058) -> ir::Block {
1059 debug_assert!(func.layout.is_block_inserted(call_block));
1060
1061 // Iterate over callee blocks in layout order, inserting their associated
1062 // inlined block into the caller's layout.
1063 let mut prev_inlined_block = call_block;
1064 let mut next_callee_block = callee.layout.entry_block();
1065 while let Some(callee_block) = next_callee_block {
1066 debug_assert!(func.layout.is_block_inserted(prev_inlined_block));
1067
1068 let inlined_block = entity_map.inlined_block(callee_block);
1069 func.layout
1070 .insert_block_after(inlined_block, prev_inlined_block);
1071
1072 prev_inlined_block = inlined_block;
1073 next_callee_block = callee.layout.next_block(callee_block);
1074 }
1075
1076 debug_assert!(func.layout.is_block_inserted(prev_inlined_block));
1077 prev_inlined_block
1078}
1079
1080/// Split the call instruction's block just after the call instruction to create
1081/// the point where control-flow joins after the inlined callee "returns".

Callers 1

inline_oneFunction · 0.85

Calls 4

inlined_blockMethod · 0.80
entry_blockMethod · 0.45
insert_block_afterMethod · 0.45
next_blockMethod · 0.45

Tested by

no test coverage detected