pub trait OpVisitor {
type BytecodeStream: BytecodeStream;
type Return;
Show 70 methods
// Required methods
fn bytecode(&mut self) -> &mut Self::BytecodeStream;
fn ret(&mut self) -> Self::Return;
fn call(&mut self, offset: PcRelOffset) -> Self::Return;
fn jump(&mut self, offset: PcRelOffset) -> Self::Return;
fn br_if(&mut self, cond: XReg, offset: PcRelOffset) -> Self::Return;
fn br_if_not(&mut self, cond: XReg, offset: PcRelOffset) -> Self::Return;
fn br_if_xeq32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xneq32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xslt32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xslteq32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xult32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xulteq32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xeq64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xneq64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xslt64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xslteq64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xult64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn br_if_xulteq64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return;
fn xmov(&mut self, dst: XReg, src: XReg) -> Self::Return;
fn fmov(&mut self, dst: FReg, src: FReg) -> Self::Return;
fn vmov(&mut self, dst: VReg, src: VReg) -> Self::Return;
fn xconst8(&mut self, dst: XReg, imm: i8) -> Self::Return;
fn xconst16(&mut self, dst: XReg, imm: i16) -> Self::Return;
fn xconst32(&mut self, dst: XReg, imm: i32) -> Self::Return;
fn xconst64(&mut self, dst: XReg, imm: i64) -> Self::Return;
fn xadd32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xadd64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xeq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xneq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xslt64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xslteq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xult64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xulteq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xeq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xneq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xslt32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xslteq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xult32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn xulteq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return;
fn load32_u(&mut self, dst: XReg, ptr: XReg) -> Self::Return;
fn load32_s(&mut self, dst: XReg, ptr: XReg) -> Self::Return;
fn load64(&mut self, dst: XReg, ptr: XReg) -> Self::Return;
fn load32_u_offset8(
&mut self,
dst: XReg,
ptr: XReg,
offset: i8,
) -> Self::Return;
fn load32_s_offset8(
&mut self,
dst: XReg,
ptr: XReg,
offset: i8,
) -> Self::Return;
fn load64_offset8(
&mut self,
dst: XReg,
ptr: XReg,
offset: i8,
) -> Self::Return;
fn load32_u_offset64(
&mut self,
dst: XReg,
ptr: XReg,
offset: i64,
) -> Self::Return;
fn load32_s_offset64(
&mut self,
dst: XReg,
ptr: XReg,
offset: i64,
) -> Self::Return;
fn load64_offset64(
&mut self,
dst: XReg,
ptr: XReg,
offset: i64,
) -> Self::Return;
fn store32(&mut self, ptr: XReg, src: XReg) -> Self::Return;
fn store64(&mut self, ptr: XReg, src: XReg) -> Self::Return;
fn store32_offset8(
&mut self,
ptr: XReg,
offset: i8,
src: XReg,
) -> Self::Return;
fn store64_offset8(
&mut self,
ptr: XReg,
offset: i8,
src: XReg,
) -> Self::Return;
fn store32_offset64(
&mut self,
ptr: XReg,
offset: i64,
src: XReg,
) -> Self::Return;
fn store64_offset64(
&mut self,
ptr: XReg,
offset: i64,
src: XReg,
) -> Self::Return;
fn push_frame(&mut self) -> Self::Return;
fn pop_frame(&mut self) -> Self::Return;
fn xpush32(&mut self, src: XReg) -> Self::Return;
fn xpush32_many(&mut self, srcs: RegSet<XReg>) -> Self::Return;
fn xpush64(&mut self, src: XReg) -> Self::Return;
fn xpush64_many(&mut self, srcs: RegSet<XReg>) -> Self::Return;
fn xpop32(&mut self, dst: XReg) -> Self::Return;
fn xpop32_many(&mut self, dsts: RegSet<XReg>) -> Self::Return;
fn xpop64(&mut self, dst: XReg) -> Self::Return;
fn xpop64_many(&mut self, dsts: RegSet<XReg>) -> Self::Return;
fn bitcast_int_from_float_32(
&mut self,
dst: XReg,
src: FReg,
) -> Self::Return;
fn bitcast_int_from_float_64(
&mut self,
dst: XReg,
src: FReg,
) -> Self::Return;
fn bitcast_float_from_int_32(
&mut self,
dst: FReg,
src: XReg,
) -> Self::Return;
fn bitcast_float_from_int_64(
&mut self,
dst: FReg,
src: XReg,
) -> Self::Return;
// Provided methods
fn before_visit(&mut self) { ... }
fn after_visit(&mut self) { ... }
}
decode
only.Expand description
Callbacks upon decoding instructions from bytecode.
Implement this trait for your type, give an instance of your type to
a Decoder
method, and the Decoder
will invoke the associated
method for each instruction that it decodes. For example, if the
Decoder
decodes an xadd32
instruction, then it will invoke the
xadd32
visitor method, passing along any decoded immediates,
operands, etc… as arguments.
Required Associated Types§
Sourcetype BytecodeStream: BytecodeStream
type BytecodeStream: BytecodeStream
The type of this visitor’s bytecode stream.
Required Methods§
Sourcefn bytecode(&mut self) -> &mut Self::BytecodeStream
fn bytecode(&mut self) -> &mut Self::BytecodeStream
Get this visitor’s underlying bytecode stream.
Sourcefn call(&mut self, offset: PcRelOffset) -> Self::Return
fn call(&mut self, offset: PcRelOffset) -> Self::Return
Transfer control to the PC at the given offset and set the lr
register to the PC just after this instruction.
Sourcefn jump(&mut self, offset: PcRelOffset) -> Self::Return
fn jump(&mut self, offset: PcRelOffset) -> Self::Return
Unconditionally transfer control to the PC at the given offset.
Sourcefn br_if(&mut self, cond: XReg, offset: PcRelOffset) -> Self::Return
fn br_if(&mut self, cond: XReg, offset: PcRelOffset) -> Self::Return
Conditionally transfer control to the given PC offset if cond
contains a non-zero value.
Sourcefn br_if_not(&mut self, cond: XReg, offset: PcRelOffset) -> Self::Return
fn br_if_not(&mut self, cond: XReg, offset: PcRelOffset) -> Self::Return
Conditionally transfer control to the given PC offset if cond
contains a zero value.
Sourcefn br_if_xeq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset) -> Self::Return
fn br_if_xeq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset) -> Self::Return
Branch if a == b
.
Sourcefn br_if_xneq32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xneq32( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if a !=
b.
Sourcefn br_if_xslt32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xslt32( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if signed a < b
.
Sourcefn br_if_xslteq32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xslteq32( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if signed a <= b
.
Sourcefn br_if_xult32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xult32( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if unsigned a < b
.
Sourcefn br_if_xulteq32(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xulteq32( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if unsigned a <= b
.
Sourcefn br_if_xeq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset) -> Self::Return
fn br_if_xeq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset) -> Self::Return
Branch if a == b
.
Sourcefn br_if_xneq64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xneq64( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if a !=
b.
Sourcefn br_if_xslt64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xslt64( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if signed a < b
.
Sourcefn br_if_xslteq64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xslteq64( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if signed a <= b
.
Sourcefn br_if_xult64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xult64( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if unsigned a < b
.
Sourcefn br_if_xulteq64(
&mut self,
a: XReg,
b: XReg,
offset: PcRelOffset,
) -> Self::Return
fn br_if_xulteq64( &mut self, a: XReg, b: XReg, offset: PcRelOffset, ) -> Self::Return
Branch if unsigned a <= b
.
Sourcefn xadd32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xadd32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
32-bit wrapping addition: low32(dst) = low32(src1) + low32(src2)
.
The upper 32-bits of dst
are unmodified.
Sourcefn xadd64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xadd64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
64-bit wrapping addition: dst = src1 + src2
.
Sourcefn xeq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xeq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
64-bit equality.
Sourcefn xneq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xneq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
64-bit inequality.
Sourcefn xslt64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xslt64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
64-bit signed less-than.
Sourcefn xslteq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xslteq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
64-bit signed less-than-equal.
Sourcefn xult64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xult64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
64-bit unsigned less-than.
Sourcefn xulteq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xulteq64(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
64-bit unsigned less-than-equal.
Sourcefn xeq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xeq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
32-bit equality.
Sourcefn xneq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xneq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
32-bit inequality.
Sourcefn xslt32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xslt32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
32-bit signed less-than.
Sourcefn xslteq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xslteq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
32-bit signed less-than-equal.
Sourcefn xult32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xult32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
32-bit unsigned less-than.
Sourcefn xulteq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
fn xulteq32(&mut self, operands: BinaryOperands<XReg>) -> Self::Return
32-bit unsigned less-than-equal.
Sourcefn load32_u_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8) -> Self::Return
fn load32_u_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8) -> Self::Return
dst = zero_extend(load32(ptr + offset8))
Sourcefn load32_s_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8) -> Self::Return
fn load32_s_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8) -> Self::Return
dst = sign_extend(load32(ptr + offset8))
Sourcefn load64_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8) -> Self::Return
fn load64_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8) -> Self::Return
dst = load64(ptr + offset8)
Sourcefn load32_u_offset64(
&mut self,
dst: XReg,
ptr: XReg,
offset: i64,
) -> Self::Return
fn load32_u_offset64( &mut self, dst: XReg, ptr: XReg, offset: i64, ) -> Self::Return
dst = zero_extend(load32(ptr + offset64))
Sourcefn load32_s_offset64(
&mut self,
dst: XReg,
ptr: XReg,
offset: i64,
) -> Self::Return
fn load32_s_offset64( &mut self, dst: XReg, ptr: XReg, offset: i64, ) -> Self::Return
dst = sign_extend(load32(ptr + offset64))
Sourcefn load64_offset64(&mut self, dst: XReg, ptr: XReg, offset: i64) -> Self::Return
fn load64_offset64(&mut self, dst: XReg, ptr: XReg, offset: i64) -> Self::Return
dst = load64(ptr + offset64)
Sourcefn store32_offset8(&mut self, ptr: XReg, offset: i8, src: XReg) -> Self::Return
fn store32_offset8(&mut self, ptr: XReg, offset: i8, src: XReg) -> Self::Return
*(ptr + sign_extend(offset8)) = low32(src)
Sourcefn store64_offset8(&mut self, ptr: XReg, offset: i8, src: XReg) -> Self::Return
fn store64_offset8(&mut self, ptr: XReg, offset: i8, src: XReg) -> Self::Return
*(ptr + sign_extend(offset8)) = src
Sourcefn store32_offset64(
&mut self,
ptr: XReg,
offset: i64,
src: XReg,
) -> Self::Return
fn store32_offset64( &mut self, ptr: XReg, offset: i64, src: XReg, ) -> Self::Return
*(ptr + sign_extend(offset64)) = low32(src)
Sourcefn store64_offset64(
&mut self,
ptr: XReg,
offset: i64,
src: XReg,
) -> Self::Return
fn store64_offset64( &mut self, ptr: XReg, offset: i64, src: XReg, ) -> Self::Return
*(ptr + sign_extend(offset64)) = src
Sourcefn push_frame(&mut self) -> Self::Return
fn push_frame(&mut self) -> Self::Return
push lr; push fp; fp = sp
Sourcefn xpush32_many(&mut self, srcs: RegSet<XReg>) -> Self::Return
fn xpush32_many(&mut self, srcs: RegSet<XReg>) -> Self::Return
for src in srcs { xpush32 src }
Sourcefn xpush64_many(&mut self, srcs: RegSet<XReg>) -> Self::Return
fn xpush64_many(&mut self, srcs: RegSet<XReg>) -> Self::Return
for src in srcs { xpush64 src }
Sourcefn xpop32_many(&mut self, dsts: RegSet<XReg>) -> Self::Return
fn xpop32_many(&mut self, dsts: RegSet<XReg>) -> Self::Return
for dst in dsts.rev() { xpop32 dst }
Sourcefn xpop64_many(&mut self, dsts: RegSet<XReg>) -> Self::Return
fn xpop64_many(&mut self, dsts: RegSet<XReg>) -> Self::Return
for dst in dsts.rev() { xpop64 dst }
Sourcefn bitcast_int_from_float_32(&mut self, dst: XReg, src: FReg) -> Self::Return
fn bitcast_int_from_float_32(&mut self, dst: XReg, src: FReg) -> Self::Return
low32(dst) = bitcast low32(src) as i32
Sourcefn bitcast_int_from_float_64(&mut self, dst: XReg, src: FReg) -> Self::Return
fn bitcast_int_from_float_64(&mut self, dst: XReg, src: FReg) -> Self::Return
dst = bitcast src as i64
Sourcefn bitcast_float_from_int_32(&mut self, dst: FReg, src: XReg) -> Self::Return
fn bitcast_float_from_int_32(&mut self, dst: FReg, src: XReg) -> Self::Return
low32(dst) = bitcast low32(src) as f32
Sourcefn bitcast_float_from_int_64(&mut self, dst: FReg, src: XReg) -> Self::Return
fn bitcast_float_from_int_64(&mut self, dst: FReg, src: XReg) -> Self::Return
dst = bitcast src as f64
Provided Methods§
Sourcefn before_visit(&mut self)
fn before_visit(&mut self)
A callback invoked before starting to decode an instruction.
Does nothing by default.
Sourcefn after_visit(&mut self)
fn after_visit(&mut self)
A callback invoked after an instruction has been completely decoded.
Does nothing by default.
Implementors§
Source§impl<'a> OpVisitor for Disassembler<'a>
Available on crate feature disas
only.
impl<'a> OpVisitor for Disassembler<'a>
disas
only.