Translate `ir::FuncRef`s from the callee into the caller.
(
allocs: &InliningAllocs,
func: &mut ir::Function,
callee: &ir::Function,
entity_map: &EntityMap,
)
| 1512 | |
| 1513 | /// Translate `ir::FuncRef`s from the callee into the caller. |
| 1514 | fn create_func_refs( |
| 1515 | allocs: &InliningAllocs, |
| 1516 | func: &mut ir::Function, |
| 1517 | callee: &ir::Function, |
| 1518 | entity_map: &EntityMap, |
| 1519 | ) -> u32 { |
| 1520 | let offset = func.dfg.ext_funcs.len(); |
| 1521 | let offset = u32::try_from(offset).unwrap(); |
| 1522 | |
| 1523 | func.dfg.ext_funcs.reserve(callee.dfg.ext_funcs.len()); |
| 1524 | for ir::ExtFuncData { |
| 1525 | name, |
| 1526 | signature, |
| 1527 | colocated, |
| 1528 | patchable, |
| 1529 | } in callee.dfg.ext_funcs.values() |
| 1530 | { |
| 1531 | func.dfg.ext_funcs.push(ir::ExtFuncData { |
| 1532 | name: match name { |
| 1533 | ir::ExternalName::User(name_ref) => { |
| 1534 | ir::ExternalName::User(allocs.user_external_name_refs[*name_ref].expect( |
| 1535 | "should have translated all `ir::UserExternalNameRef`s before translating \ |
| 1536 | `ir::FuncRef`s", |
| 1537 | )) |
| 1538 | } |
| 1539 | ir::ExternalName::TestCase(_) |
| 1540 | | ir::ExternalName::LibCall(_) |
| 1541 | | ir::ExternalName::KnownSymbol(_) => name.clone(), |
| 1542 | }, |
| 1543 | signature: entity_map.inlined_sig_ref(*signature), |
| 1544 | colocated: *colocated, |
| 1545 | patchable: *patchable, |
| 1546 | }); |
| 1547 | } |
| 1548 | |
| 1549 | offset |
| 1550 | } |
| 1551 | |
| 1552 | /// Copy stack slots from the callee into the caller. |
| 1553 | fn create_stack_slots(func: &mut ir::Function, callee: &ir::Function) -> u32 { |
no test coverage detected