pub struct CompileCtx {
pub reg_map: HashMap<usize, Register>,
pub symbols: HashMap<u64, Register>,
pub symbol_ptrs: HashMap<u64, usize>,
pub dictionary: HashMap<u64, String>,
pub types: TypeSection,
pub features: HashSet<FeatureFlag>,
pub const_entries: Vec<ConstEntry>,
pub const_blob: Vec<u8>,
pub instrs: Vec<EncodedInstr>,
pub next_reg: Register,
}
Fields§
§reg_map: HashMap<usize, Register>
§symbols: HashMap<u64, Register>
§symbol_ptrs: HashMap<u64, usize>
§dictionary: HashMap<u64, String>
§types: TypeSection
§features: HashSet<FeatureFlag>
§const_entries: Vec<ConstEntry>
§const_blob: Vec<u8>
§instrs: Vec<EncodedInstr>
§next_reg: Register
Implementations§
Source§impl CompileCtx
impl CompileCtx
pub fn new() -> Self
pub fn clear(&mut self)
pub fn define_symbol(&mut self, id: usize, reg: Register, name: &str)
pub fn alloc_register_for_ptr(&mut self, ptr: usize) -> Register
pub fn emit_const_load(&mut self, dst: Register, const_id: u32)
pub fn emit_unop(&mut self, fxn_id: u64, dst: Register, src: Register)
pub fn emit_binop( &mut self, fxn_id: u64, dst: Register, lhs: Register, rhs: Register, )
pub fn emit_ternop( &mut self, fxn_id: u64, dst: Register, a: Register, b: Register, c: Register, )
pub fn emit_quadop( &mut self, fxn_id: u64, dst: Register, a: Register, b: Register, c: Register, d: Register, )
pub fn emit_ret(&mut self, src: Register)
pub fn compile_const( &mut self, bytes: &[u8], value_kind: ValueKind, ) -> MResult<u32>
pub fn compile(&mut self) -> MResult<Vec<u8>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompileCtx
impl RefUnwindSafe for CompileCtx
impl Send for CompileCtx
impl Sync for CompileCtx
impl Unpin for CompileCtx
impl UnwindSafe for CompileCtx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.