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

Method inline

cranelift/filetests/src/test_inline.rs:123–157  ·  view source on GitHub ↗
(
        &mut self,
        caller: &ir::Function,
        _inst: ir::Inst,
        _opcode: ir::Opcode,
        callee: ir::FuncRef,
        _args: &[ir::Value],
    )

Source from the content-addressed store, hash-verified

121
122impl<'a> Inline for Inliner<'a> {
123 fn inline(
124 &mut self,
125 caller: &ir::Function,
126 _inst: ir::Inst,
127 _opcode: ir::Opcode,
128 callee: ir::FuncRef,
129 _args: &[ir::Value],
130 ) -> InlineCommand<'_> {
131 match &caller.dfg.ext_funcs[callee].name {
132 ir::ExternalName::User(name) => match caller
133 .params
134 .user_named_funcs()
135 .get(*name)
136 .and_then(|name| self.0.get(&ir::UserFuncName::User(name.clone())))
137 {
138 None => InlineCommand::KeepCall,
139 Some(f) => InlineCommand::Inline {
140 callee: Cow::Borrowed(f),
141 visit_callee: true,
142 },
143 },
144 ir::ExternalName::TestCase(name) => {
145 match self.0.get(&ir::UserFuncName::Testcase(name.clone())) {
146 None => InlineCommand::KeepCall,
147 Some(f) => InlineCommand::Inline {
148 callee: Cow::Borrowed(f),
149 visit_callee: true,
150 },
151 }
152 }
153 ir::ExternalName::LibCall(_) | ir::ExternalName::KnownSymbol(_) => {
154 InlineCommand::KeepCall
155 }
156 }
157 }
158}

Callers 1

runMethod · 0.45

Calls 3

user_named_funcsMethod · 0.80
getMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected