[][src]Trait dynasm::arch::BasicExprBuilder

pub trait BasicExprBuilder {
    fn push(&mut self, _: Stmt);
fn emit_error_at(&mut self, _: ErrorSpan, _: Arguments);
fn bit_or(&mut self, _: Expr, _: Value) -> Option<Expr>;
fn bit_and(&mut self, _: Expr, _: Value) -> Option<Expr>;
fn bit_xor(&mut self, _: Expr, _: Value) -> Option<Expr>;
fn add(&mut self, _: Expr, _: Value) -> Option<Expr>;
fn mul(&mut self, _: Expr, _: Value) -> Option<Expr>;
fn neg(&mut self, _: Expr) -> Option<Expr>;
fn log2(&mut self, _: Expr) -> Option<Expr>;
fn mask_shift(&mut self, val: Expr, mask: u64, shift: i8) -> Option<Expr>; }

An environment that can dynamically build expressions from values.

These are used to integrate dynamic user expression into assembled code where values appear only in a modified form.

Required methods

fn push(&mut self, _: Stmt)

Append a new statement.

fn emit_error_at(&mut self, _: ErrorSpan, _: Arguments)

Emit an error message. When any error is generated then the instruction compilation is expected to fail.

fn bit_or(&mut self, _: Expr, _: Value) -> Option<Expr>

a | b

fn bit_and(&mut self, _: Expr, _: Value) -> Option<Expr>

a & b

fn bit_xor(&mut self, _: Expr, _: Value) -> Option<Expr>

a ^ b

fn add(&mut self, _: Expr, _: Value) -> Option<Expr>

a + b

fn mul(&mut self, _: Expr, _: Value) -> Option<Expr>

a * b

fn neg(&mut self, _: Expr) -> Option<Expr>

!a

fn log2(&mut self, _: Expr) -> Option<Expr>

Log2, mostly used to encode scalings.

fn mask_shift(&mut self, val: Expr, mask: u64, shift: i8) -> Option<Expr>

(val & mask) << shift

Loading content...

Implementors

impl<'_> BasicExprBuilder for State<'_>[src]

A simple implementation of a BasicExprBuilder.

It can not combine any expressions, pushes statements into a Vec and emits errors onto standard error directly.

fn emit_error_at(&mut self, _: ErrorSpan, args: Arguments)[src]

Emits the error message on stderr.

Loading content...