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

Function create_entities

cranelift/codegen/src/inline.rs:1367–1391  ·  view source on GitHub ↗

Translate all of the callee's various entities into the caller, producing an `EntityMap` that can be used to translate callee entity references into inlined caller entity references.

(
    allocs: &mut InliningAllocs,
    func: &mut ir::Function,
    callee: &ir::Function,
)

Source from the content-addressed store, hash-verified

1365/// `EntityMap` that can be used to translate callee entity references into
1366/// inlined caller entity references.
1367fn create_entities(
1368 allocs: &mut InliningAllocs,
1369 func: &mut ir::Function,
1370 callee: &ir::Function,
1371) -> CodegenResult<EntityMap> {
1372 let mut entity_map = EntityMap::default();
1373
1374 entity_map.block_offset = Some(create_blocks(allocs, func, callee));
1375 entity_map.global_value_offset = Some(create_global_values(func, callee)?);
1376 entity_map.sig_ref_offset = Some(create_sig_refs(func, callee));
1377 create_user_external_name_refs(allocs, func, callee);
1378 entity_map.func_ref_offset = Some(create_func_refs(allocs, func, callee, &entity_map));
1379 entity_map.stack_slot_offset = Some(create_stack_slots(func, callee));
1380 entity_map.dynamic_type_offset = Some(create_dynamic_types(func, callee, &entity_map));
1381 entity_map.dynamic_stack_slot_offset =
1382 Some(create_dynamic_stack_slots(func, callee, &entity_map));
1383 entity_map.immediate_offset = Some(create_immediates(func, callee));
1384
1385 // `ir::ConstantData` is deduplicated, so we cannot use our offset scheme
1386 // for `ir::Constant`s. Nonetheless, we still insert them into the caller
1387 // now, at the same time as the rest of our entities.
1388 create_constants(allocs, func, callee);
1389
1390 Ok(entity_map)
1391}
1392
1393/// Create inlined blocks in the caller for every block in the callee.
1394fn create_blocks(

Callers 1

inline_oneFunction · 0.85

Calls 11

create_blocksFunction · 0.85
create_global_valuesFunction · 0.85
create_sig_refsFunction · 0.85
create_func_refsFunction · 0.85
create_stack_slotsFunction · 0.85
create_dynamic_typesFunction · 0.85
create_immediatesFunction · 0.85
create_constantsFunction · 0.85
OkFunction · 0.85

Tested by

no test coverage detected