pub struct LoweringTable {
pub cpu_ref: fn(&[u8], &mut Vec<u8>),
pub primary_text: Option<fn(&LoweringCtx<'_>) -> Result<(), String>>,
pub primary_binary: Option<fn(&LoweringCtx<'_>) -> Vec<u32>>,
pub secondary_text: Option<fn(&LoweringCtx<'_>) -> TextModule>,
pub native_module: Option<fn(&LoweringCtx<'_>) -> NativeModule>,
pub extensions: HashMap<&'static str, fn(&LoweringCtx<'_>) -> Result<Vec<u8>, String>, FxBuildHasher>,
}Expand description
Lowering function table attached to an operation definition.
The named fields are terminal 0.6 in-tree slots. extensions is
the open-ended slot: any
out-of-tree backend registers its builder under its stable
backend-id string. Look up by id via
LoweringTable::extension.
Not #[non_exhaustive] so static registrations can use functional
record update (..LoweringTable::empty()) from inventory::submit!
closures. Additive fields must carry defaults so the spread form
keeps working without a breaking change.
Fields§
§cpu_ref: fn(&[u8], &mut Vec<u8>)Portable CPU reference implementation.
primary_text: Option<fn(&LoweringCtx<'_>) -> Result<(), String>>Primary text builder. None in v0.4.1 pure-IR ops.
primary_binary: Option<fn(&LoweringCtx<'_>) -> Vec<u32>>Primary binary builder. None in v0.4.1 pure-IR ops.
secondary_text: Option<fn(&LoweringCtx<'_>) -> TextModule>Secondary text builder. None unless a concrete backend owns it.
native_module: Option<fn(&LoweringCtx<'_>) -> NativeModule>Native native-module builder. None until native-module support lands.
extensions: HashMap<&'static str, fn(&LoweringCtx<'_>) -> Result<Vec<u8>, String>, FxBuildHasher>Open extension map for out-of-tree backends. Keyed by backend
id (matches the string a VyreBackend::id returns). Builders
are by-value function pointers so lookup is allocation-free
and the map stays Clone + Send + Sync without interior
locking.
Implementations§
Source§impl LoweringTable
impl LoweringTable
Sourcepub fn new(cpu_ref: fn(&[u8], &mut Vec<u8>)) -> LoweringTable
pub fn new(cpu_ref: fn(&[u8], &mut Vec<u8>)) -> LoweringTable
Build a lowering table with only the explicit CPU reference oracle
populated. Production execution still requires a concrete backend
lowering (primary_*, secondary_text, native_module, or an
extension); this constructor is for parity/conformance surfaces and
incremental backend registration.
Sourcepub fn empty() -> LoweringTable
pub fn empty() -> LoweringTable
Empty table whose reference-oracle slot is the structured-intrinsic sentinel. Invoking that slot panics after clearing output so missing reference adapters cannot masquerade as empty CPU results. This is not a production fallback path.
Sourcepub fn with_extension(
self,
backend_id: &'static str,
builder: fn(&LoweringCtx<'_>) -> Result<Vec<u8>, String>,
) -> LoweringTable
pub fn with_extension( self, backend_id: &'static str, builder: fn(&LoweringCtx<'_>) -> Result<Vec<u8>, String>, ) -> LoweringTable
Register an out-of-tree backend’s lowering. Stable backend id
is the key DialectRegistry::get_lowering uses for lookup; pick it
carefully, it is a wire-like identifier.
Trait Implementations§
Source§impl Clone for LoweringTable
impl Clone for LoweringTable
Source§fn clone(&self) -> LoweringTable
fn clone(&self) -> LoweringTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more