Use this when you're building the IR of a function to reference a function. TODO: Coalesce redundant decls and signatures. TODO: Look into ways to reduce the risk of using a FuncRef in the wrong function.
(&mut self, func_id: FuncId, func: &mut ir::Function)
| 902 | /// TODO: Coalesce redundant decls and signatures. |
| 903 | /// TODO: Look into ways to reduce the risk of using a FuncRef in the wrong function. |
| 904 | fn declare_func_in_func(&mut self, func_id: FuncId, func: &mut ir::Function) -> ir::FuncRef { |
| 905 | let decl = &self.declarations().functions[func_id]; |
| 906 | let signature = func.import_signature(decl.signature.clone()); |
| 907 | let user_name_ref = func.declare_imported_user_function(ir::UserExternalName { |
| 908 | namespace: 0, |
| 909 | index: func_id.as_u32(), |
| 910 | }); |
| 911 | let colocated = decl.linkage.is_final(); |
| 912 | func.import_function(ir::ExtFuncData { |
| 913 | name: ir::ExternalName::user(user_name_ref), |
| 914 | signature, |
| 915 | colocated, |
| 916 | patchable: false, |
| 917 | }) |
| 918 | } |
| 919 | |
| 920 | /// Use this when you're building the IR of a function to reference a data object. |
| 921 | /// |
nothing calls this directly
no test coverage detected