pub struct LoweringTable {
pub cpu_ref: ReferenceKind,
pub primary_text: Option<PrimaryTextBuilder>,
pub primary_binary: Option<PrimaryBinaryBuilder>,
pub secondary_text: Option<SecondaryTextBuilder>,
pub native_module: Option<NativeModuleBuilder>,
pub extensions: FxHashMap<&'static str, ExtensionLoweringFn>,
}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: ReferenceKindPortable CPU reference implementation.
primary_text: Option<PrimaryTextBuilder>Primary text builder. None in v0.6 pure-IR ops.
primary_binary: Option<PrimaryBinaryBuilder>Primary binary builder. None in v0.6 pure-IR ops.
secondary_text: Option<SecondaryTextBuilder>Secondary text builder. None unless a concrete backend owns it.
native_module: Option<NativeModuleBuilder>Native native-module builder. None until native-module support lands.
extensions: FxHashMap<&'static str, ExtensionLoweringFn>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: ReferenceKind) -> Self
pub fn new(cpu_ref: ReferenceKind) -> Self
Build a CPU-only lowering table.
Sourcepub fn with_extension(
self,
backend_id: &'static str,
builder: ExtensionLoweringFn,
) -> Self
pub fn with_extension( self, backend_id: &'static str, builder: ExtensionLoweringFn, ) -> Self
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.
Sourcepub fn extension(&self, backend_id: &str) -> Option<ExtensionLoweringFn>
pub fn extension(&self, backend_id: &str) -> Option<ExtensionLoweringFn>
Look up an extension builder by backend id.
Trait Implementations§
Source§impl Clone for LoweringTable
impl Clone for LoweringTable
Source§fn clone(&self) -> LoweringTable
fn clone(&self) -> LoweringTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more