Struct Ins

Source
pub struct Ins {
    pub code: u32,
    pub op: Opcode,
}
Expand description

A PowerPC instruction.

Fields§

§code: u32§op: Opcode

Implementations§

Source§

impl Ins

Source

pub fn new(code: u32, extensions: Extensions) -> Self

Create a new instruction from its raw code.

Source

pub fn parse_simplified(self, out: &mut ParsedIns)

Parse the instruction into a simplified mnemonic, if any match.

Source

pub fn simplified(self) -> ParsedIns

Returns the simplified form of the instruction, if any match.

Source

pub fn parse_basic(self, out: &mut ParsedIns)

Parse the instruction into its basic form.

Source

pub fn basic(self) -> ParsedIns

Returns the basic form of the instruction.

Source

pub fn parse_defs(self, out: &mut Arguments)

Emits all registers defined by the instruction into the given argument list.

Source

pub fn defs(self) -> Arguments

Returns all registers defined by the instruction.

Source

pub fn parse_uses(self, out: &mut Arguments)

Emits all registers used by the instruction into the given argument list.

Source

pub fn uses(self) -> Arguments

Returns all registers used by the instruction.

Source

pub fn branch_offset(&self) -> Option<i32>

Returns the relative branch offset of the instruction, if any.

Source

pub fn branch_dest(&self, addr: u32) -> Option<u32>

Returns the absolute branch destination of the instruction, if any.

Source

pub fn is_branch(&self) -> bool

Whether the instruction is any kind of branch.

Source

pub fn is_direct_branch(&self) -> bool

Whether the instruction is a direct branch.

Source

pub fn is_unconditional_branch(&self) -> bool

Whether the instruction is an unconditional branch.

Source

pub fn is_conditional_branch(&self) -> bool

Whether the instruction is a conditional branch.

Source

pub fn is_blr(&self) -> bool

Whether the instruction is a branch with link. (blr)

Source§

impl Ins

Source

pub const fn field_simm(&self) -> i16

simm: Signed Immediate

Source

pub const fn field_uimm(&self) -> u16

uimm: Unsigned Immediate

Source

pub const fn field_offset(&self) -> i16

offset: Branch Offset

Source

pub const fn field_bo(&self) -> u8

BO: Branch Options

Source

pub const fn field_bi(&self) -> u8

BI: Branch Condition Register Bit

Source

pub const fn field_bd(&self) -> i16

BD: Branch Destination (14-bit)

Source

pub const fn field_li(&self) -> i32

LI: Branch Destination (24-bit)

Source

pub const fn field_sh(&self) -> u8

SH: Shift Amount

Source

pub const fn field_mb(&self) -> u8

MB: Mask Begin

Source

pub const fn field_me(&self) -> u8

ME: Mask End

Source

pub const fn field_rs(&self) -> u8

rS: Source Register

Source

pub const fn field_rd(&self) -> u8

rD: Destination Register

Source

pub const fn field_ra(&self) -> u8

rA: Register A

Source

pub const fn field_rb(&self) -> u8

rB: Register B

Source

pub const fn field_sr(&self) -> u8

sr: Segment Register

Source

pub const fn field_spr(&self) -> u16

spr: Special Purpose Register

Source

pub const fn field_frs(&self) -> u8

frS: Source Floating-Point Register

Source

pub const fn field_frd(&self) -> u8

frD: Destination Floating-Point Register

Source

pub const fn field_fra(&self) -> u8

frA: Floating-Point Register A

Source

pub const fn field_frb(&self) -> u8

frB: Floating-Point Register B

Source

pub const fn field_frc(&self) -> u8

frC: Floating-Point Register C

Source

pub const fn field_crbd(&self) -> u8

crbD: Condition Register Bit Destination

Source

pub const fn field_crba(&self) -> u8

crbA: Condition Register Bit A

Source

pub const fn field_crbb(&self) -> u8

crbB: Condition Register Bit B

Source

pub const fn field_crfd(&self) -> u8

crfD: Condition Register Field Destination

Source

pub const fn field_crfs(&self) -> u8

crfS: Condition Register Field Source

Source

pub const fn field_crm(&self) -> u8

crm: Condition Register Mask

Source

pub const fn field_nb(&self) -> u8

NB

Source

pub const fn field_tbr(&self) -> u16

tbr: Time Base

Source

pub const fn field_mtfsf_fm(&self) -> u8

mtfsf_FM: Field Mask for mtfsf

Source

pub const fn field_mtfsf_imm(&self) -> u8

mtfsf_IMM: Immediate for mtfsfi

Source

pub const fn field_spr_sprg(&self) -> u8

spr_SPRG: SPRG index for m[tf]sprg

Source

pub const fn field_spr_bat(&self) -> u8

spr_BAT: IBAT/DBAT index for m[tf][id]bat[ul]

Source

pub const fn field_to(&self) -> u8

TO: Bitset for tw and twi

Source

pub const fn field_l(&self) -> u8

L: Bitset for cmp, cmpi, cmpl, cmpli

Source

pub const fn field_sync_l(&self) -> u8

sync_L: L field for sync

Source

pub const fn field_ds(&self) -> i16

ds: Load/Store Double Word Offset (for 64-bit instructions)

Source

pub const fn field_sh64(&self) -> u8

SH64: Shift Amount (for 64-bit instructions)

Source

pub const fn field_mb64(&self) -> u8

MB64: Mask Begin (for 64-bit instructions)

Source

pub const fn field_me64(&self) -> u8

ME64: Mask End (for 64-bit instructions)

Source

pub const fn field_mtmsrd_l(&self) -> u8

mtmsrd_L: L field for mtmsrd

Source

pub const fn field_ps_offset(&self) -> i16

ps_offset: Paired Single Offset

Source

pub const fn field_ps_i(&self) -> u8

ps_I

Source

pub const fn field_ps_ix(&self) -> u8

ps_IX

Source

pub const fn field_ps_w(&self) -> u8

ps_W

Source

pub const fn field_ps_wx(&self) -> u8

ps_WX

Source

pub const fn field_vsimm(&self) -> i8

vsimm: Vector Signed Immediate

Source

pub const fn field_vuimm(&self) -> u8

vuimm: Vector Unsigned Immediate

Source

pub const fn field_vs(&self) -> u8

vS: Vector Source Register

Source

pub const fn field_vd(&self) -> u8

vD: Vector Destination Register

Source

pub const fn field_va(&self) -> u8

vA: Vector Register A

Source

pub const fn field_vb(&self) -> u8

vB: Vector Register B

Source

pub const fn field_vc(&self) -> u8

vC: Vector Register C

Source

pub const fn field_ds_a(&self) -> u8

ds_A: All field for ds instructions

Source

pub const fn field_strm(&self) -> u8

STRM: Stream ID

Source

pub const fn field_shb(&self) -> u8

SHB

Source

pub const fn field_vds128(&self) -> u8

VDS128: VMX128 Source/Dest Register

Source

pub const fn field_va128(&self) -> u8

VA128: VMX128 Register A

Source

pub const fn field_vb128(&self) -> u8

VB128: VMX128 Register B

Source

pub const fn field_vc128(&self) -> u8

VC128: VMX128 Register C

Source

pub const fn field_perm(&self) -> u8

PERM: VMX128 Permutation

Source

pub const fn field_d3dtype(&self) -> u8

D3DType: the packed data type

Source

pub const fn field_vmask(&self) -> u8

VMASK: the pack mask

Source

pub const fn field_zimm(&self) -> u8

Zimm: amount to rotate/shift left

Source

pub const fn field_oe(&self) -> bool

OE: Field used by XO-form instructions to enable setting OV and SO in the XER.

Source

pub const fn field_rc(&self) -> bool

Rc: Record Bit

Source

pub const fn field_lk(&self) -> bool

LK: Link Bit

Source

pub const fn field_aa(&self) -> bool

AA: Absolute Address Bit

Source

pub const fn field_bp(&self) -> bool

BP: Predict branch to be taken

Source

pub const fn field_bnp(&self) -> bool

BNP: Predict branch not to be taken (fall through)

Source

pub const fn field_bp_nd(&self) -> bool

BP_ND: Predict branch to be taken (implicit dest for LR/CTR)

Source

pub const fn field_t(&self) -> bool

T: Transient bit

Source

pub const fn field_rcav(&self) -> bool

RcAV: Record Bit (AltiVec)

Source

pub const fn field_rc128(&self) -> bool

Rc128: Record Bit (VMX128)

Trait Implementations§

Source§

impl Clone for Ins

Source§

fn clone(&self) -> Ins

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 Ins

Source§

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

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

impl Default for Ins

Source§

fn default() -> Ins

Returns the “default value” for a type. Read more
Source§

impl Hash for Ins

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Ins

Source§

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

Source§

impl Eq for Ins

Source§

impl StructuralPartialEq for Ins

Auto Trait Implementations§

§

impl Freeze for Ins

§

impl RefUnwindSafe for Ins

§

impl Send for Ins

§

impl Sync for Ins

§

impl Unpin for Ins

§

impl UnwindSafe for Ins

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, 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, 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.