CompileCtx

Struct CompileCtx 

Source
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

Source

pub fn new() -> Self

Source

pub fn clear(&mut self)

Source

pub fn define_symbol(&mut self, id: usize, reg: Register, name: &str)

Source

pub fn alloc_register_for_ptr(&mut self, ptr: usize) -> Register

Source

pub fn emit_const_load(&mut self, dst: Register, const_id: u32)

Source

pub fn emit_unop(&mut self, fxn_id: u64, dst: Register, src: Register)

Source

pub fn emit_binop( &mut self, fxn_id: u64, dst: Register, lhs: Register, rhs: Register, )

Source

pub fn emit_ternop( &mut self, fxn_id: u64, dst: Register, a: Register, b: Register, c: Register, )

Source

pub fn emit_quadop( &mut self, fxn_id: u64, dst: Register, a: Register, b: Register, c: Register, d: Register, )

Source

pub fn emit_ret(&mut self, src: Register)

Source

pub fn compile_const( &mut self, bytes: &[u8], value_kind: ValueKind, ) -> MResult<u32>

Source

pub fn compile(&mut self) -> MResult<Vec<u8>>

Trait Implementations§

Source§

impl Debug for CompileCtx

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.