Skip to main content

CoreInstruction

Enum CoreInstruction 

Source
pub enum CoreInstruction {
Show 47 variants Alloca(GaiaType, usize), Load(GaiaType), Store(GaiaType), Gep { base_type: GaiaType, indices: Vec<usize>, }, Add(GaiaType), Sub(GaiaType), Mul(GaiaType), Div(GaiaType), Rem(GaiaType), And(GaiaType), Or(GaiaType), Xor(GaiaType), Shl(GaiaType), Shr(GaiaType), Neg(GaiaType), Not(GaiaType), Cmp(CmpCondition, GaiaType), Cast { from: GaiaType, to: GaiaType, kind: CastKind, }, PushConstant(GaiaConstant), Pop, Dup, LoadLocal(u32, GaiaType), StoreLocal(u32, GaiaType), LoadArg(u32, GaiaType), StoreArg(u32, GaiaType), Ret, Br(String), BrTrue(String), BrFalse(String), Label(String), Call(String, usize), CallIndirect(usize), New(String), NewArray(GaiaType, bool), LoadField(String, String), StoreField(String, String), LoadElement(GaiaType), StoreElement(GaiaType), ArrayLength, ArrayPush, Throw, StructNew(String), StructGet { struct_name: String, field_index: u32, is_signed: bool, }, StructSet { struct_name: String, field_index: u32, }, ArrayNew(String), ArrayGet { array_name: String, is_signed: bool, }, ArraySet(String),
}
Expand description

Tier 0: Core low-level instructions (LLVM/Assembly-like)

Variants§

§

Alloca(GaiaType, usize)

Allocate space on the stack (type, count)

§

Load(GaiaType)

Load from memory (target register type, pointer)

§

Store(GaiaType)

Store to memory (value type)

§

Gep

Get element pointer (calculate offset)

Fields

§base_type: GaiaType

The base type for the pointer arithmetic.

§indices: Vec<usize>

The indices to navigate through the type hierarchy.

§

Add(GaiaType)

Add two values of the specified type.

§

Sub(GaiaType)

Subtract two values of the specified type.

§

Mul(GaiaType)

Multiply two values of the specified type.

§

Div(GaiaType)

Divide two values of the specified type.

§

Rem(GaiaType)

Remainder of two values of the specified type.

§

And(GaiaType)

Bitwise AND of two values of the specified type.

§

Or(GaiaType)

Bitwise OR of two values of the specified type.

§

Xor(GaiaType)

Bitwise XOR of two values of the specified type.

§

Shl(GaiaType)

Left shift a value of the specified type.

§

Shr(GaiaType)

Right shift a value of the specified type.

§

Neg(GaiaType)

Negate a value of the specified type.

§

Not(GaiaType)

Bitwise NOT of a value of the specified type.

§

Cmp(CmpCondition, GaiaType)

Compare two values using the specified condition.

§

Cast

Cast a value from one type to another with the specified conversion kind.

Fields

§from: GaiaType

The source type.

§to: GaiaType

The target type.

§kind: CastKind

The kind of cast operation to perform.

§

PushConstant(GaiaConstant)

Push a constant value onto the stack.

§

Pop

Pop a value from the stack.

§

Dup

Duplicate the top value on the stack.

§

LoadLocal(u32, GaiaType)

Load local variable

§

StoreLocal(u32, GaiaType)

Store local variable

§

LoadArg(u32, GaiaType)

Load parameter

§

StoreArg(u32, GaiaType)

Store parameter

§

Ret

Return

§

Br(String)

Unconditional branch

§

BrTrue(String)

Branch if true

§

BrFalse(String)

Branch if false

§

Label(String)

Label

§

Call(String, usize)

Call function (function name, parameter count)

§

CallIndirect(usize)

Indirect call (parameter count). Stack: […, func_ptr, arg1, arg2, …]

§

New(String)

Create new object (type name)

§

NewArray(GaiaType, bool)

Create new array (element type, whether length is on stack)

§

LoadField(String, String)

Load field (object type, field name)

§

StoreField(String, String)

Store field (object type, field name)

§

LoadElement(GaiaType)

Load array element

§

StoreElement(GaiaType)

Store array element

§

ArrayLength

Get array length

§

ArrayPush

Push element to array (array, value)

§

Throw

Throw exception

§

StructNew(String)

Create new GC struct (type name)

§

StructGet

Get GC struct field (type name, field index)

Fields

§struct_name: String

The name of the struct type.

§field_index: u32

The index of the field to get.

§is_signed: bool

Whether the field value is signed.

§

StructSet

Set GC struct field (type name, field index)

Fields

§struct_name: String

The name of the struct type.

§field_index: u32

The index of the field to set.

§

ArrayNew(String)

Create new GC array (type name)

§

ArrayGet

Get GC array element (type name)

Fields

§array_name: String

The name of the array type.

§is_signed: bool

Whether the element value is signed.

§

ArraySet(String)

Set GC array element (type name)

Trait Implementations§

Source§

impl Clone for CoreInstruction

Source§

fn clone(&self) -> CoreInstruction

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CoreInstruction

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CoreInstruction

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CoreInstruction

Source§

fn eq(&self, other: &CoreInstruction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CoreInstruction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CoreInstruction

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,