Enum midenc_codegen_masm::Op

source ·
pub enum Op {
Show 196 variants Padw, Push(BaseElement), Push2([BaseElement; 2]), Pushw([BaseElement; 4]), PushU8(u8), PushU16(u16), PushU32(u32), Drop, Dropw, Dup(u8), Dupw(u8), Swap(u8), Swapw(u8), Swapdw, Movup(u8), Movupw(u8), Movdn(u8), Movdnw(u8), Cswap, Cswapw, Cdrop, Cdropw, Assert, AssertWithError(u32), Assertz, AssertzWithError(u32), AssertEq, AssertEqWithError(u32), AssertEqw, AssertEqwWithError(u32), LocAddr(LocalId), LocStore(LocalId), LocStorew(LocalId), LocLoad(LocalId), LocLoadw(LocalId), MemLoad, MemLoadImm(u32), MemLoadw, MemLoadwImm(u32), MemStore, MemStoreImm(u32), MemStorew, MemStorewImm(u32), MemStream, AdvPipe, AdvPush(u8), AdvLoadw, AdvInjectPushU64Div, AdvInjectPushMapVal, AdvInjectPushMapValImm(u8), AdvInjectPushMapValN, AdvInjectPushMapValNImm(u8), AdvInjectPushMTreeNode, AdvInjectInsertMem, AdvInjectInsertHdword, AdvInjectInsertHdwordImm(u8), AdvInjectInsertHperm, AdvInjectPushSignature(SignatureKind), Hash, Hmerge, Hperm, MtreeGet, MtreeSet, MtreeMerge, MtreeVerify, MtreeVerifyWithError(u32), FriExt2Fold4, RCombBase, Ext2add, Ext2sub, Ext2mul, Ext2neg, Ext2inv, Ext2div, If(MasmBlockId, MasmBlockId), While(MasmBlockId), Repeat(u16, MasmBlockId), Exec(FunctionIdent), Syscall(FunctionIdent), Call(FunctionIdent), DynExec, DynCall, ProcRef(FunctionIdent), Add, AddImm(BaseElement), Sub, SubImm(BaseElement), Mul, MulImm(BaseElement), Div, DivImm(BaseElement), Neg, Inv, Incr, Ilog2, Pow2, Exp, ExpImm(u8), ExpBitLength(u8), Not, And, AndImm(bool), Or, OrImm(bool), Xor, XorImm(bool), Eq, EqImm(BaseElement), Neq, NeqImm(BaseElement), Gt, GtImm(BaseElement), Gte, GteImm(BaseElement), Lt, LtImm(BaseElement), Lte, LteImm(BaseElement), IsOdd, Eqw, Sdepth, Caller, Clk, U32Test, U32Testw, U32Assert, U32AssertWithError(u32), U32Assert2, U32Assert2WithError(u32), U32Assertw, U32AssertwWithError(u32), U32Cast, U32Split, U32OverflowingAdd, U32OverflowingAddImm(u32), U32WrappingAdd, U32WrappingAddImm(u32), U32OverflowingAdd3, U32WrappingAdd3, U32OverflowingSub, U32OverflowingSubImm(u32), U32WrappingSub, U32WrappingSubImm(u32), U32OverflowingMul, U32OverflowingMulImm(u32), U32WrappingMul, U32WrappingMulImm(u32), U32OverflowingMadd, U32WrappingMadd, U32Div, U32DivImm(u32), U32Mod, U32ModImm(u32), U32DivMod, U32DivModImm(u32), U32And, U32Or, U32Xor, U32Not, U32Shl, U32ShlImm(u32), U32Shr, U32ShrImm(u32), U32Rotl, U32RotlImm(u32), U32Rotr, U32RotrImm(u32), U32Popcnt, U32Clz, U32Ctz, U32Clo, U32Cto, U32Lt, U32LtImm(u32), U32Lte, U32LteImm(u32), U32Gt, U32GtImm(u32), U32Gte, U32GteImm(u32), U32Min, U32MinImm(u32), U32Max, U32MaxImm(u32), Breakpoint, DebugStack, DebugStackN(u8), DebugMemory, DebugMemoryAt(u32), DebugMemoryRange(u32, u32), DebugFrame, DebugFrameAt(u16), DebugFrameRange(u16, u16), Emit(u32), Trace(u32), Nop,
}
Expand description

This enum represents the Miden Assembly (MASM) instruction set.

Not all MASM instructions are necessarily represented here, only those we actually use, or intend to use, when compiling from Miden IR.

Variants§

§

Padw

Pushes a null word on the stack, i.e. four 0 values

§

Push(BaseElement)

Pushes the given field element constant on top of the stack

§

Push2([BaseElement; 2])

Pushes a pair of field elements on top of the stack

§

Pushw([BaseElement; 4])

Pushes the given word constant on top of the stack

§

PushU8(u8)

Pushes the given 8-bit constant on top of the stack

§

PushU16(u16)

Pushes the given 16-bit constant on top of the stack

§

PushU32(u32)

Pushes the given 32-bit constant on top of the stack

§

Drop

Removes the item on the top of the stack

§

Dropw

Removes the top 4 items on the stack

§

Dup(u8)

Copies the nth item on the stack to the top of stack

  • Dup(0) duplicates the item on top of the stack
§

Dupw(u8)

Copies the nth word on the stack, to the top of the stack

The only values of n which are valid, are 0, 1, 2, 3; or in other words, the 4 words which make up the top 16 elements of the stack.

§

Swap(u8)

Swaps the 1st and nth items on the stack

  • Swap(1) swaps the top two elements of the stack
§

Swapw(u8)

Swaps the 1st and nth words on the stack

The only values of n which are valid, are 1, 2, 3; or in other words, the 3 words which make up the last 12 elements of the stack.

§

Swapdw

§

Movup(u8)

Moves the nth stack item to top of stack

  • Movup(1) is equivalent to Swap(1)
§

Movupw(u8)

Moves the nth stack word to the top of the stack

The only values of n which are valid are 2 and 3. Use Swapw(1) if you want to move the second word to the top.

§

Movdn(u8)

Moves the top of stack to the nth index of the stack

  • Movdn(1) is equivalent to Swap(1)
§

Movdnw(u8)

Moves the top word of the stack, into position as the nth word on the stack.

The only values of n which are valid are 2 and 3. Use Swapw(1) if you want to make the top word the second word.

§

Cswap

Pops c, b, a off the stack, and swaps b and a if c is 1, or leaves them as-is when 0.

Traps if c is > 1.

§

Cswapw

Pops c, B, A off the stack, where B and A are words, and swaps B and A if c is 1, or leaves them as-is when 0.

Traps if c is > 1.

§

Cdrop

Pops c, b, a off the stack, and pushes back b if c is 1, and a if 0.

Traps if c is > 1.

§

Cdropw

Pops c, B, A off the stack, where B and A are words, and pushes back B if c is 1, and A if 0.

Traps if c is > 1.

§

Assert

Pops a value off the stack and asserts that it is equal to 1

§

AssertWithError(u32)

Pops a value off the stack and asserts that it is equal to 1, raising the given error code

§

Assertz

Pops a value off the stack and asserts that it is equal to 0

§

AssertzWithError(u32)

Pops a value off the stack and asserts that it is equal to 0, raising the given error code

§

AssertEq

Pops two values off the stack and asserts that they are equal

§

AssertEqWithError(u32)

Pops two values off the stack and asserts that they are equal, raising the given error code

§

AssertEqw

Pops two words off the stack and asserts that they are equal

§

AssertEqwWithError(u32)

Pops two words off the stack and asserts that they are equal, raising the given error code

§

LocAddr(LocalId)

Places the memory address of the given local index on top of the stack

§

LocStore(LocalId)

Writes a value to the first element of the word at the address corresponding to the given local index

§

LocStorew(LocalId)

Writes a word to the address corresponding to the given local index

§

LocLoad(LocalId)

Reads a value from the first element of the word at the address corresponding to the given local index

§

LocLoadw(LocalId)

Reads a word from the address corresponding to the given local index

§

MemLoad

Pops a, representing a memory address, from the top of the stack, then loads the first element of the word starting at that address, placing it on top of the stack.

Traps if a >= 2^32

§

MemLoadImm(u32)

Same as above, but the address is given as an immediate

§

MemLoadw

Pops a, representing a memory address, from the top of the stack, then overwrites the top word of the stack with the word starting at that address.

Traps if a >= 2^32

§

MemLoadwImm(u32)

Same as above, but the address is given as an immediate

§

MemStore

Pops a, v from the stack, where a represents a memory address, and v the value to be stored, and stores v as the element as the first element of the word starting at that address. The remaining elements of the word are not modified.

Traps if a >= 2^32

§

MemStoreImm(u32)

Same as above, but the address is given as an immediate

§

MemStorew

Pops a, V from the stack, where a represents a memory address, and V is a word to be stored at that location, and overwrites the word located at a.

Traps if a >= 2^32

§

MemStorewImm(u32)

Same as above, but the address is given as an immediate

§

MemStream

Read two sequential words from memory starting at a, overwriting the first two words on the stack, and advancing a to the next address following the two that were loaded [C, B, A, a] <- [*a, *(a + 1), A, a + 2]

§

AdvPipe

Pops the next two words from the advice stack, overwrites the top of the operand stack with them, and also writes these words into memory at a and a + 1

[C, B, A, a] <- [*a, *(a + 1), A, a + 2]

§

AdvPush(u8)

Pops n elements from the advice stack, and pushes them on the operand stack

Fails if less than n elements are available.

Valid values of n fall in the range 1..=16

§

AdvLoadw

Pop the next word from the advice stack and overwrite the word on top of the operand stack with it.

Fails if the advice stack does not have at least one word.

§

AdvInjectPushU64Div

Push the result of u64 division on the advice stack

[b_hi, b_lo, a_hi, a_lo]
§

AdvInjectPushMapVal

Pushes a list of field elements on the advice stack.

The list is looked up in the advice map using the word on top of the operand stack.

[K]
§

AdvInjectPushMapValImm(u8)

Pushes a list of field elements on the advice stack.

The list is looked up in the advice map using the word starting at index on the operand stack.

[K]
§

AdvInjectPushMapValN

Pushes a list of field elements, along with the number of elements on the advice stack.

The list is looked up in the advice map using the word on top of the operand stack.

[K]
§

AdvInjectPushMapValNImm(u8)

Pushes a list of field elements, along with the number of elements on the advice stack.

The list is looked up in the advice map using the word starting at index on the operand stack.

[K]
§

AdvInjectPushMTreeNode

Pushes a node of a Merkle tree with root R at depth d and index i from the Merkle store onto the advice stack

[d, i, R]
§

AdvInjectInsertMem

Reads words mem[a]..mem[b] from memory, and saves the data into the advice map under K

[K, a, b]
§

AdvInjectInsertHdword

Reads the top two words from the stack, and computes a key K as hash(A || B, 0).

The two words that were hashed are then saved into the advice map under K.

[B, A]
§

AdvInjectInsertHdwordImm(u8)

Reads the top two words from the stack, and computes a key K as hash(A || B, d).

d is a domain value which can be in the range 0..=255

The two words that were hashed are then saved into the advice map under K as [A, B].

[B, A]
§

AdvInjectInsertHperm

Reads the top three words from the stack, and computes a key K as permute(C, A, B).digest.

The words A and B are saved into the advice map under K as [A, B]

[B, A, C]
§

AdvInjectPushSignature(SignatureKind)

TODO

§

Hash

Compute the Rescue Prime Optimized (RPO) hash of the word on top of the operand stack.

The resulting hash of one word is placed on the operand stack.

The input operand is consumed.

§

Hmerge

Computes a 2-to-1 RPO hash of the two words on top of the operand stack.

The resulting hash of one word is placed on the operand stack.

The input operands are consumed.

§

Hperm

Compute an RPO permutation on the top 3 words of the operand stack, where the top 2 words (C and B) are the rate, and the last word (A) is the capacity.

The digest output is the word E.

[C, B, A] => [F, E, D]
§

MtreeGet

Fetches the value V of the Merkle tree with root R, at depth d, and index i from the advice provider, and runs a verification equivalent to mtree_verify, returning the value if successful.

[d, i, R] => [V, R]
§

MtreeSet

Sets the value to V' of the Merkle tree with root R, at depth d, and index i.

R' is the Merkle root of the new tree, and V is the old value of the node.

Requires that a Merkle tree with root R is present in the advice provider, otherwise it fails.

Both trees are in the advice provider upon return.

[d, i, R, V'] => [V, R']
§

MtreeMerge

Create a new Merkle tree root M, that joins two other Merkle trees, R and L.

Both the new tree and the input trees are in the advice provider upon return.

[R, L] => [M]
§

MtreeVerify

Verifies that a Merkle tree with root R opens to node V at depth d and index i.

The Merkle tree with root R must be present in the advice provider or the operation fails.

[V, d, i, R] => [V, d, i, R]
§

MtreeVerifyWithError(u32)

Verifies that a Merkle tree with root R opens to node V at depth d and index i.

The Merkle tree with root R must be present in the advice provider or the operation fails.

[V, d, i, R] => [V, d, i, R]

Raise the given error code if the verification fails

§

FriExt2Fold4

Performs FRI layer folding by a factor of 4 for FRI protocol executed in a degree 2 extension of the base field. Additionally, performs several computations which simplify FRI verification procedure.

  • Folds 4 query values: (v0, v1), (v2, v3), (v4, v5), and (v6, v7) into a single value (ne0, ne1)
  • Computes new value of the domain generator power: poe' = poe^4
  • Increments layer pointer (cptr) by 2
  • Shifts the stack left to move an item from the overflow table to bottom of stack
[v7, v6, v5, v4, v3, v2, v1, v0, f_pos, d_seg, poe, pe1, pe0, a1, a0, cptr]
=> [t1, t0, s1, s0, df3, df2, df1, df0, poe^2, f_tau, cptr+2, poe^4, f_pos, ne1, ne0, eptr]

Above, eptr is moved from the overflow table and is expected to be the address of the final FRI layer.

§

RCombBase

Perform a single step of a random linear combination defining the DEEP composition polynomial, i.e. the input to the FRI protocol.

[t7, t6, t5, t4, t3, t2, t1, t0, p1, p0, r1, r0, x_addr, z_addr, a_addr]
=> [t0, t7, t6, t5, t4, t3, t2, t1, p1', p0', r1', r0', x_addr, z_addr+1, a_addr+1]

Where:

  • tN stands for the value of the Nth trace polynomial for the current query, i.e. tN(x)
  • p0 and p1 stand for an extension field element accumulating the values for the quotients with common denominator x - z
  • r0 and r1 stand for an extension field element accumulating the values for the quotients with common denominator x - gz
  • x_addr is the memory address from which we are loading the tNs using the mem_stream instruction
  • z_addr is the memory address to the Nth OOD evaluations at z and gz
  • a_addr is the memory address of the Nth random element alpha_i used in batching the trace polynomial quotients
§

Ext2add

[b1, b0, a1, a0] => [c1, c0]

c1 = (a1 + b1) mod p c0 = (a0 + b0) mod p

§

Ext2sub

[b1, b0, a1, a0] => [c1, c0]

c1 = (a1 - b1) mod p c0 = (a0 - b0) mod p

§

Ext2mul

[b1, b0, a1, a0] => [c1, c0]

c1 = ((a0 + a1) * (b0 + b1)) mod p c0 = ((a0 * b0) - 2(a1 * b1)) mod p

§

Ext2neg

[a1, a0] => [a1’, a0’]

a1’ = -a1 a0’ = -a0

§

Ext2inv

[a1, a0] => [a1’, a0’]

a’ = a^-1 mod q (where q is the extension field prime)

Fails if a = 0.

§

Ext2div

[b1, b0, a1, a0] => [c1, c0]

c = a * b^-1

Fails if b is 0. Multiplication and inversion are defined by the ops above.

§

If(MasmBlockId, MasmBlockId)

Pops the top of the stack, and evaluates the ops in the block of code corresponding to the branch taken.

If the value is 1, corresponding to true, the first block is evaluated. Otherwise, the value must be 0, corresponding to false, and the second block is evaluated.

§

While(MasmBlockId)

Pops the top of the stack, and evaluates the given block of code if the value is 1, corresponding to true.

Otherwise, the value must be 0, corresponding to false, and the block is skipped.

§

Repeat(u16, MasmBlockId)

Repeatedly evaluates the given block, n times.

§

Exec(FunctionIdent)

Pops N args off the stack, executes the procedure, results will be placed on the stack

§

Syscall(FunctionIdent)

Pops N args off the stack, executes the procedure in the root context, results will be placed on the stack

§

Call(FunctionIdent)

Pops N args off the stack, executes the procedure in a new context, results will be placed on the stack

§

DynExec

Pops the address (MAST root hash) of a callee off the stack, and dynamically exec the function

§

DynCall

TODO

§

ProcRef(FunctionIdent)

Pushes the address (MAST root hash) of the given function on the stack, to be used by dynexec or dyncall

§

Add

Pops b, a off the stack, and places the result of (a + b) mod p on the stack

§

AddImm(BaseElement)

Same as above, but the immediate is used for b

§

Sub

Pops b, a off the stack, and places the result of (a - b) mod p on the stack

§

SubImm(BaseElement)

Same as above, but the immediate is used for b

§

Mul

Pops b, a off the stack, and places the result of (a * b) mod p on the stack

§

MulImm(BaseElement)

Same as above, but the immediate is used for b

§

Div

Pops b, a off the stack, and places the result of (a * b^-1) mod p on the stack

NOTE: b must not be 0

§

DivImm(BaseElement)

Same as above, but the immediate is used for b

§

Neg

Pops a off the stack, and places the result of -a mod p on the stack

§

Inv

Pops a off the stack, and places the result of a^-1 mod p on the stack

NOTE: a must not be equal to 0

§

Incr

Pops a off the stack, and places the result of incrementing it by 1 back on the stack

§

Ilog2

Computes the base 2 logarithm of a, rounded down, and places it on the advice stack.

§

Pow2

Pops a off the stack, and places the result of 2^a on the stack

NOTE: a must not be > 63

§

Exp

Pops a and b off the stack, and places the result of a^b on the stack

NOTE: b must not be > 63

§

ExpImm(u8)

Pops a off the stack, and places the result of a^<imm> on the stack

NOTE: imm must not be > 63

§

ExpBitLength(u8)

§

Not

Pops a off the stack, and places the result of 1 - a on the stack

NOTE: a must be boolean

§

And

Pops b, a off the stack, and places the result of a * b on the stack

NOTE: a must be boolean

§

AndImm(bool)

Same as above, but a is taken from the stack, and b is the immediate.

NOTE: a must be boolean

§

Or

Pops b, a off the stack, and places the result of a + b - a * b on the stack

NOTE: a must be boolean

§

OrImm(bool)

Same as above, but a is taken from the stack, and b is the immediate.

NOTE: a must be boolean

§

Xor

Pops b, a off the stack, and places the result of a + b - 2 * a * b on the stack

NOTE: a and b must be boolean

§

XorImm(bool)

Same as above, but a is taken from the stack, and b is the immediate.

NOTE: a must be boolean

§

Eq

Pops b, a off the stack, and places the result of a == b on the stack

§

EqImm(BaseElement)

Same as above, but b is provided by the immediate

§

Neq

Pops b, a off the stack, and places the result of a != b on the stack

§

NeqImm(BaseElement)

Same as above, but b is provided by the immediate

§

Gt

Pops b, a off the stack, and places the result of a > b on the stack

§

GtImm(BaseElement)

Same as above, but b is provided by the immediate

§

Gte

Pops b, a off the stack, and places the result of a >= b on the stack

§

GteImm(BaseElement)

Same as above, but b is provided by the immediate

§

Lt

Pops b, a off the stack, and places the result of a < b on the stack

§

LtImm(BaseElement)

Same as above, but b is provided by the immediate

§

Lte

Pops b, a off the stack, and places the result of a <= b on the stack

§

LteImm(BaseElement)

Same as above, but b is provided by the immediate

§

IsOdd

Pops a off the stack, and places the 1 on the stack if a is odd, else 0

§

Eqw

Pops B, A off the stack, and places the result of A == B on the stack, where the uppercase variables here represent words, rather than field elements.

The comparison works by comparing pairs of elements from each word

§

Sdepth

Pushes the current depth of the operand stack, on the stack

§

Caller

When the current procedure is called via syscall, this pushes the hash of the caller’s MAST root on the stack

§

Clk

Pushes the current value of the cycle counter (clock) on the stack

§

U32Test

Peeks a from the top of the stack, and places the 1 on the stack if a < 2^32, else 0

§

U32Testw

Peeks A from the top of the stack, and places the 1 on the stack if forall a : A, a < 2^32, else 0

§

U32Assert

Peeks a from the top of the stack, and traps if a >= 2^32

§

U32AssertWithError(u32)

Peeks a from the top of the stack, and traps if a >= 2^32, raising the given error code

§

U32Assert2

Peeks b, a from the top of the stack, and traps if either a or b is >= 2^32

§

U32Assert2WithError(u32)

Peeks b, a from the top of the stack, and traps if either a or b is >= 2^32, raising the given error code

§

U32Assertw

Peeks A from the top of the stack, and traps unless forall a : A, a < 2^32, else 0

§

U32AssertwWithError(u32)

Peeks A from the top of the stack, and traps unless forall a : A, a < 2^32, else 0, raising the given error code

§

U32Cast

Pops a from the top of the stack, and places the result of a mod 2^32 on the stack

This is used to cast a field element to the u32 range

§

U32Split

Pops a from the top of the stack, and splits it into upper and lower 32-bit values, placing them back on the stack. The lower part is calculated as a mod 2^32, and the higher part as a / 2^32. The higher part will be on top of the stack after.

§

U32OverflowingAdd

Pops b, a from the stack, and places the result of (a + b) mod 2^32 on the stack, followed by 1 if (a + b) >= 2^32, else 0. Thus the first item on the stack will be a boolean indicating whether the arithmetic overflowed, and the second will be the result of the addition.

The behavior is undefined if either b or a are >= 2^32

§

U32OverflowingAddImm(u32)

Same as above, but with b provided by the immediate

§

U32WrappingAdd

Pops b, a from the stack, and places the result of (a + b) mod 2^32 on the stack.

The behavior is undefined if either b or a are >= 2^32

§

U32WrappingAddImm(u32)

Same as above, but with b provided by the immediate

§

U32OverflowingAdd3

Pops c, b, a from the stack, adds them together, and splits the result into higher and lower parts. The lower part is calculated as (a + b + c) mod 2^32, the higher part as (a + b + c) / 2^32.

The behavior is undefined if any of c, b or a are >= 2^32

§

U32WrappingAdd3

Pops c, b, a from the stack, adds them together, and splits the result into higher and lower parts. The lower part is calculated as (a + b + c) mod 2^32, the higher part as (a + b + c) / 2^32.

The behavior is undefined if any of c, b or a are >= 2^32

§

U32OverflowingSub

Pops b, a from the stack, and places the result of (a - b) mod 2^32 on the stack, followed by 1 if a < b, else 0. Thus the first item on the stack will be a boolean indicating whether the arithmetic underflowed, and the second will be the result of the subtraction.

The behavior is undefined if either b or a are >= 2^32

§

U32OverflowingSubImm(u32)

Same as above, but with b provided by the immediate

§

U32WrappingSub

Pops b, a from the stack, and places the result of (a - b) mod 2^32 on the stack.

The behavior is undefined if either b or a are >= 2^32

§

U32WrappingSubImm(u32)

Same as above, but with b provided by the immediate

§

U32OverflowingMul

Pops b, a from the stack, and places the result of (a * b) mod 2^32 on the stack, followed by (a * b) / 2^32. Thus the first item on the stack will be the number of times the multiplication overflowed, followed by the result.

The behavior is undefined if either b or a are >= 2^32

§

U32OverflowingMulImm(u32)

Same as above, but with b provided by the immediate

§

U32WrappingMul

Pops b, a from the stack, and places the result of (a * b) mod 2^32 on the stack.

The behavior is undefined if either b or a are >= 2^32

§

U32WrappingMulImm(u32)

Same as above, but with b provided by the immediate

§

U32OverflowingMadd

Pops c, b, a off the stack, and calculates d = c * b + a, then splits the result into higher and lower parts, the lower given by d mod 2^32, the higher by d / 2^32, and pushes them back on the stack, with the higher part on top of the stack at the end.

Behavior is undefined if any of a, b, or c are >= 2^32

§

U32WrappingMadd

Pops c, b, a off the stack, and pushes (c * a + b) mod 2^32 on the stack.

Behavior is undefined if any of a, b, or c are >= 2^32

§

U32Div

Pops b, a off the stack, and pushes a / b on the stack.

This operation traps if b is zero.

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32DivImm(u32)

Same as above, except b is provided by the immediate

§

U32Mod

Pops b, a off the stack, and pushes a mod b on the stack.

This operation traps if b is zero.

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32ModImm(u32)

Same as above, except b is provided by the immediate

§

U32DivMod

Pops b, a off the stack, and first pushes a / b on the stack, followed by a mod b.

This operation traps if b is zero.

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32DivModImm(u32)

Same as above, except b is provided by the immediate

§

U32And

Pops b, a off the stack, and places the bitwise AND of a and b on the stack.

Traps if either a or b >= 2^32

§

U32Or

Pops b, a off the stack, and places the bitwise OR of a and b on the stack.

Traps if either a or b >= 2^32

§

U32Xor

Pops b, a off the stack, and places the bitwise XOR of a and b on the stack.

Traps if either a or b >= 2^32

§

U32Not

Pops a off the stack, and places the bitwise NOT of a on the stack.

Traps if a >= 2^32

§

U32Shl

Pops b, a off the stack, and places the result of (a * 2^b) mod 2^32 on the stack.

Truncates if the shift would cause overflow.

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32ShlImm(u32)

Same as above, except b is provided by the immediate

§

U32Shr

Pops b, a off the stack, and places the result of a / 2^b on the stack.

Truncates if the shift would cause overflow.

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32ShrImm(u32)

Same as above, except b is provided by the immediate

§

U32Rotl

Pops b, a off the stack, and places the result of rotating the 32-bit representation of a to the left by b bits.

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32RotlImm(u32)

Same as above, except b is provided by the immediate

§

U32Rotr

Pops b, a off the stack, and places the result of rotating the 32-bit representation of a to the right by b bits.

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32RotrImm(u32)

Same as above, except b is provided by the immediate

§

U32Popcnt

Pops a off the stack, and places the number of set bits in a (it’s hamming weight).

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32Clz

Computes the number of leading zero bits in a, and places it on the advice stack

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32Ctz

Computes the number of trailing zero bits in a, and places it on the advice stack

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32Clo

Computes the number of leading one bits in a, and places it on the advice stack

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32Cto

Computes the number of trailing one bits in a, and places it on the advice stack

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32Lt

Pops b, a from the stack, and places 1 on the stack if a < b, else 0

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32LtImm(u32)

Same as above, but b is provided by the immediate

§

U32Lte

Pops b, a from the stack, and places 1 on the stack if a <= b, else 0

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32LteImm(u32)

Same as above, but b is provided by the immediate

§

U32Gt

Pops b, a from the stack, and places 1 on the stack if a > b, else 0

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32GtImm(u32)

Same as above, but b is provided by the immediate

§

U32Gte

Pops b, a from the stack, and places 1 on the stack if a >= b, else 0

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32GteImm(u32)

Same as above, but b is provided by the immediate

§

U32Min

Pops b, a from the stack, and places a back on the stack if a < b, else b

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32MinImm(u32)

Same as above, but b is provided by the immediate

§

U32Max

Pops b, a from the stack, and places a back on the stack if a > b, else b

This operation is unchecked, so the result is undefined if the operands are not valid u32

§

U32MaxImm(u32)

Same as above, but b is provided by the immediate

§

Breakpoint

Trigger a breakpoint when this instruction is reached

§

DebugStack

Print out the contents of the stack

§

DebugStackN(u8)

Print out the top n contents of the stack

§

DebugMemory

Print out the entire contents of RAM

§

DebugMemoryAt(u32)

Print out the contents of RAM starting at address n

§

DebugMemoryRange(u32, u32)

Print out the contents of RAM in the range n..=m

§

DebugFrame

Print out the local memory for the current procedure

§

DebugFrameAt(u16)

Print out the local memory for the current procedure starting at index n

§

DebugFrameRange(u16, u16)

Print out the local memory for the current procedure for indices in the range n..=m

§

Emit(u32)

Emit an event with the given event code

§

Trace(u32)

Emit a trace event with the given code

§

Nop

No operation

Implementations§

source§

impl MasmOp

source

pub fn has_regions(&self) -> bool

source

pub fn cost(&self) -> usize

The cost of this instruction in cycles

source

pub fn from_masm( current_module: Ident, ix: Instruction, ) -> SmallVec<[MasmOp; 2]>

source

pub fn into_masm( self, imports: &ModuleImportInfo, locals: &BTreeSet<FunctionIdent>, ) -> SmallVec<[Instruction; 2]>

Trait Implementations§

source§

impl Clone for MasmOp

source§

fn clone(&self) -> MasmOp

Returns a copy 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 MasmOp

source§

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

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

impl Display for MasmOp

This implementation displays the opcode name for the given MasmOp

source§

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

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

impl PartialEq for MasmOp

source§

fn eq(&self, other: &MasmOp) -> 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 Copy for MasmOp

source§

impl Eq for MasmOp

source§

impl StructuralPartialEq for MasmOp

Auto Trait Implementations§

§

impl Freeze for MasmOp

§

impl RefUnwindSafe for MasmOp

§

impl Send for MasmOp

§

impl Sync for MasmOp

§

impl Unpin for MasmOp

§

impl UnwindSafe for MasmOp

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, dst: *mut T)

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<D> OwoColorize for D

source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text italicized
Make the text blink
Make the text blink (but fast!)
source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

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