A trait for directing Cranelift whether to inline a particular call or not. Used in combination with the [`Context::inline`][crate::Context::inline] method.
| 57 | /// Used in combination with the [`Context::inline`][crate::Context::inline] |
| 58 | /// method. |
| 59 | pub trait Inline { |
| 60 | /// A hook invoked for each direct call instruction in a function, whose |
| 61 | /// result determines whether Cranelift should inline a given call. |
| 62 | /// |
| 63 | /// The Cranelift user is responsible for defining their own heuristics and |
| 64 | /// deciding whether inlining the call is beneficial. |
| 65 | /// |
| 66 | /// When returning a function and directing Cranelift to inline its body |
| 67 | /// into the call site, the `Inline` implementer must ensure the following: |
| 68 | /// |
| 69 | /// * The returned function's signature exactly matches the `callee` |
| 70 | /// `FuncRef`'s signature. |
| 71 | /// |
| 72 | /// * The returned function must be legalized. |
| 73 | /// |
| 74 | /// * The returned function must be valid (i.e. it must pass the CLIF |
| 75 | /// verifier). |
| 76 | /// |
| 77 | /// * The returned function is a correct and valid implementation of the |
| 78 | /// `callee` according to your language's semantics. |
| 79 | /// |
| 80 | /// Failure to uphold these invariants may result in panics during |
| 81 | /// compilation or incorrect runtime behavior in the generated code. |
| 82 | fn inline( |
| 83 | &mut self, |
| 84 | caller: &ir::Function, |
| 85 | call_inst: ir::Inst, |
| 86 | call_opcode: ir::Opcode, |
| 87 | callee: ir::FuncRef, |
| 88 | call_args: &[ir::Value], |
| 89 | ) -> InlineCommand<'_>; |
| 90 | } |
| 91 | |
| 92 | impl<'a, T> Inline for &'a mut T |
| 93 | where |
no outgoing calls
no test coverage detected