ExtensionOpFn

Trait ExtensionOpFn 

Source
pub trait ExtensionOpFn<'a, H>: for<'c> Fn(&mut EmitFuncContext<'c, 'a, H>, EmitOpArgs<'c, '_, ExtensionOp, H>) -> Result<()> + 'a { }
Expand description

A helper trait for describing the callback used for emitting ExtensionOps, and for hanging documentation.

We have the appropriate Fn as a supertrait, and there is a blanket impl for that Fn. We do not intend users to impl this trait.

ExtensionOpFn callbacks are registered against a fully qualified OpName, i.e. including it’s ExtensionId. Callbacks can assume that the provided EmitOpArgs::node holds an op matching that fully qualified name, and that the signature of that op determinies the length and types of EmitOpArgs::inputs, and EmitOpArgs::outputs via EmitFuncContext::llvm_type.

Callbacks should use the supplied EmitFuncContext to emit LLVM to match the desired semantics of the op. If a callback returns success then the callback must:

Callbacks may hold references with lifetimes older than 'a.

Implementors§

Source§

impl<'a, H, F: for<'c> Fn(&mut EmitFuncContext<'c, 'a, H>, EmitOpArgs<'c, '_, ExtensionOp, H>) -> Result<()> + ?Sized + 'a> ExtensionOpFn<'a, H> for F