logo
#[non_exhaustive]
pub enum Register {
Show 256 variants None, AL, CL, DL, BL, AH, CH, DH, BH, SPL, BPL, SIL, DIL, R8L, R9L, R10L, R11L, R12L, R13L, R14L, R15L, AX, CX, DX, BX, SP, BP, SI, DI, R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W, EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D, RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8, R9, R10, R11, R12, R13, R14, R15, EIP, RIP, ES, CS, SS, DS, FS, GS, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM16, XMM17, XMM18, XMM19, XMM20, XMM21, XMM22, XMM23, XMM24, XMM25, XMM26, XMM27, XMM28, XMM29, XMM30, XMM31, YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7, YMM8, YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15, YMM16, YMM17, YMM18, YMM19, YMM20, YMM21, YMM22, YMM23, YMM24, YMM25, YMM26, YMM27, YMM28, YMM29, YMM30, YMM31, ZMM0, ZMM1, ZMM2, ZMM3, ZMM4, ZMM5, ZMM6, ZMM7, ZMM8, ZMM9, ZMM10, ZMM11, ZMM12, ZMM13, ZMM14, ZMM15, ZMM16, ZMM17, ZMM18, ZMM19, ZMM20, ZMM21, ZMM22, ZMM23, ZMM24, ZMM25, ZMM26, ZMM27, ZMM28, ZMM29, ZMM30, ZMM31, K0, K1, K2, K3, K4, K5, K6, K7, BND0, BND1, BND2, BND3, CR0, CR1, CR2, CR3, CR4, CR5, CR6, CR7, CR8, CR9, CR10, CR11, CR12, CR13, CR14, CR15, DR0, DR1, DR2, DR3, DR4, DR5, DR6, DR7, DR8, DR9, DR10, DR11, DR12, DR13, DR14, DR15, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, TR0, TR1, TR2, TR3, TR4, TR5, TR6, TR7, TMM0, TMM1, TMM2, TMM3, TMM4, TMM5, TMM6, TMM7, DontUse0, DontUseFA, DontUseFB, DontUseFC, DontUseFD, DontUseFE, DontUseFF,
}
Expand description

A register

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

None

AL

CL

DL

BL

AH

CH

DH

BH

SPL

BPL

SIL

DIL

R8L

R9L

R10L

R11L

R12L

R13L

R14L

R15L

AX

CX

DX

BX

SP

BP

SI

DI

R8W

R9W

R10W

R11W

R12W

R13W

R14W

R15W

EAX

ECX

EDX

EBX

ESP

EBP

ESI

EDI

R8D

R9D

R10D

R11D

R12D

R13D

R14D

R15D

RAX

RCX

RDX

RBX

RSP

RBP

RSI

RDI

R8

R9

R10

R11

R12

R13

R14

R15

EIP

RIP

ES

CS

SS

DS

FS

GS

XMM0

XMM1

XMM2

XMM3

XMM4

XMM5

XMM6

XMM7

XMM8

XMM9

XMM10

XMM11

XMM12

XMM13

XMM14

XMM15

XMM16

XMM17

XMM18

XMM19

XMM20

XMM21

XMM22

XMM23

XMM24

XMM25

XMM26

XMM27

XMM28

XMM29

XMM30

XMM31

YMM0

YMM1

YMM2

YMM3

YMM4

YMM5

YMM6

YMM7

YMM8

YMM9

YMM10

YMM11

YMM12

YMM13

YMM14

YMM15

YMM16

YMM17

YMM18

YMM19

YMM20

YMM21

YMM22

YMM23

YMM24

YMM25

YMM26

YMM27

YMM28

YMM29

YMM30

YMM31

ZMM0

ZMM1

ZMM2

ZMM3

ZMM4

ZMM5

ZMM6

ZMM7

ZMM8

ZMM9

ZMM10

ZMM11

ZMM12

ZMM13

ZMM14

ZMM15

ZMM16

ZMM17

ZMM18

ZMM19

ZMM20

ZMM21

ZMM22

ZMM23

ZMM24

ZMM25

ZMM26

ZMM27

ZMM28

ZMM29

ZMM30

ZMM31

K0

K1

K2

K3

K4

K5

K6

K7

BND0

BND1

BND2

BND3

CR0

CR1

CR2

CR3

CR4

CR5

CR6

CR7

CR8

CR9

CR10

CR11

CR12

CR13

CR14

CR15

DR0

DR1

DR2

DR3

DR4

DR5

DR6

DR7

DR8

DR9

DR10

DR11

DR12

DR13

DR14

DR15

ST0

ST1

ST2

ST3

ST4

ST5

ST6

ST7

MM0

MM1

MM2

MM3

MM4

MM5

MM6

MM7

TR0

TR1

TR2

TR3

TR4

TR5

TR6

TR7

TMM0

TMM1

TMM2

TMM3

TMM4

TMM5

TMM6

TMM7

DontUse0

👎Deprecated since 1.12.0: Not part of the public API

Don’t use it!

DontUseFA

👎Deprecated since 1.12.0: Not part of the public API

Don’t use it!

DontUseFB

👎Deprecated since 1.12.0: Not part of the public API

Don’t use it!

DontUseFC

👎Deprecated since 1.12.0: Not part of the public API

Don’t use it!

DontUseFD

👎Deprecated since 1.12.0: Not part of the public API

Don’t use it!

DontUseFE

👎Deprecated since 1.12.0: Not part of the public API

Don’t use it!

DontUseFF

👎Deprecated since 1.12.0: Not part of the public API

Don’t use it!

Implementations

Gets register info

Examples
use iced_x86::*;
let info = Register::EAX.info();
assert_eq!(info.size(), 4);

Gets the base register, eg. AL, AX, EAX, RAX, MM0, XMM0, YMM0, ZMM0, ES

Examples
use iced_x86::*;
assert_eq!(Register::GS.base(), Register::ES);
assert_eq!(Register::SIL.base(), Register::AL);
assert_eq!(Register::SP.base(), Register::AX);
assert_eq!(Register::R13D.base(), Register::EAX);
assert_eq!(Register::RBP.base(), Register::RAX);
assert_eq!(Register::MM6.base(), Register::MM0);
assert_eq!(Register::XMM28.base(), Register::XMM0);
assert_eq!(Register::YMM12.base(), Register::YMM0);
assert_eq!(Register::ZMM31.base(), Register::ZMM0);
assert_eq!(Register::K3.base(), Register::K0);
assert_eq!(Register::BND1.base(), Register::BND0);
assert_eq!(Register::ST7.base(), Register::ST0);
assert_eq!(Register::CR8.base(), Register::CR0);
assert_eq!(Register::DR6.base(), Register::DR0);
assert_eq!(Register::TR3.base(), Register::TR0);
assert_eq!(Register::RIP.base(), Register::EIP);

The register number (index) relative to base(), eg. 0-15, or 0-31, or if 8-bit GPR, 0-19

Examples
use iced_x86::*;
assert_eq!(Register::GS.number(), 5);
assert_eq!(Register::SIL.number(), 10);
assert_eq!(Register::SP.number(), 4);
assert_eq!(Register::R13D.number(), 13);
assert_eq!(Register::RBP.number(), 5);
assert_eq!(Register::MM6.number(), 6);
assert_eq!(Register::XMM28.number(), 28);
assert_eq!(Register::YMM12.number(), 12);
assert_eq!(Register::ZMM31.number(), 31);
assert_eq!(Register::K3.number(), 3);
assert_eq!(Register::BND1.number(), 1);
assert_eq!(Register::ST7.number(), 7);
assert_eq!(Register::CR8.number(), 8);
assert_eq!(Register::DR6.number(), 6);
assert_eq!(Register::TR3.number(), 3);
assert_eq!(Register::RIP.number(), 1);

Gets the full register that this one is a part of, eg. CL/CH/CX/ECX/RCX -> RCX, XMM11/YMM11/ZMM11 -> ZMM11

Examples
use iced_x86::*;
assert_eq!(Register::GS.full_register(), Register::GS);
assert_eq!(Register::SIL.full_register(), Register::RSI);
assert_eq!(Register::SP.full_register(), Register::RSP);
assert_eq!(Register::R13D.full_register(), Register::R13);
assert_eq!(Register::RBP.full_register(), Register::RBP);
assert_eq!(Register::MM6.full_register(), Register::MM6);
assert_eq!(Register::XMM10.full_register(), Register::ZMM10);
assert_eq!(Register::YMM10.full_register(), Register::ZMM10);
assert_eq!(Register::ZMM10.full_register(), Register::ZMM10);
assert_eq!(Register::K3.full_register(), Register::K3);
assert_eq!(Register::BND1.full_register(), Register::BND1);
assert_eq!(Register::ST7.full_register(), Register::ST7);
assert_eq!(Register::CR8.full_register(), Register::CR8);
assert_eq!(Register::DR6.full_register(), Register::DR6);
assert_eq!(Register::TR3.full_register(), Register::TR3);
assert_eq!(Register::RIP.full_register(), Register::RIP);

Gets the full register that this one is a part of, except if it’s a GPR in which case the 32-bit register is returned, eg. CL/CH/CX/ECX/RCX -> ECX, XMM11/YMM11/ZMM11 -> ZMM11

Examples
use iced_x86::*;
assert_eq!(Register::GS.full_register32(), Register::GS);
assert_eq!(Register::SIL.full_register32(), Register::ESI);
assert_eq!(Register::SP.full_register32(), Register::ESP);
assert_eq!(Register::R13D.full_register32(), Register::R13D);
assert_eq!(Register::RBP.full_register32(), Register::EBP);
assert_eq!(Register::MM6.full_register32(), Register::MM6);
assert_eq!(Register::XMM10.full_register32(), Register::ZMM10);
assert_eq!(Register::YMM10.full_register32(), Register::ZMM10);
assert_eq!(Register::ZMM10.full_register32(), Register::ZMM10);
assert_eq!(Register::K3.full_register32(), Register::K3);
assert_eq!(Register::BND1.full_register32(), Register::BND1);
assert_eq!(Register::ST7.full_register32(), Register::ST7);
assert_eq!(Register::CR8.full_register32(), Register::CR8);
assert_eq!(Register::DR6.full_register32(), Register::DR6);
assert_eq!(Register::TR3.full_register32(), Register::TR3);
assert_eq!(Register::RIP.full_register32(), Register::RIP);

Gets the size of the register in bytes

Examples
use iced_x86::*;
assert_eq!(Register::GS.size(), 2);
assert_eq!(Register::SIL.size(), 1);
assert_eq!(Register::SP.size(), 2);
assert_eq!(Register::R13D.size(), 4);
assert_eq!(Register::RBP.size(), 8);
assert_eq!(Register::MM6.size(), 8);
assert_eq!(Register::XMM10.size(), 16);
assert_eq!(Register::YMM10.size(), 32);
assert_eq!(Register::ZMM10.size(), 64);
assert_eq!(Register::K3.size(), 8);
assert_eq!(Register::BND1.size(), 16);
assert_eq!(Register::ST7.size(), 10);
assert_eq!(Register::CR8.size(), 8);
assert_eq!(Register::DR6.size(), 8);
assert_eq!(Register::TR3.size(), 4);
assert_eq!(Register::RIP.size(), 8);

Checks if it’s a segment register (ES, CS, SS, DS, FS, GS)

Examples
use iced_x86::*;
assert!(Register::GS.is_segment_register());
assert!(!Register::RCX.is_segment_register());

Checks if it’s a general purpose register (AL-R15L, AX-R15W, EAX-R15D, RAX-R15)

Examples
use iced_x86::*;
assert!(!Register::GS.is_gpr());
assert!(Register::CH.is_gpr());
assert!(Register::DX.is_gpr());
assert!(Register::R13D.is_gpr());
assert!(Register::RSP.is_gpr());
assert!(!Register::XMM0.is_gpr());

Checks if it’s an 8-bit general purpose register (AL-R15L)

Examples
use iced_x86::*;
assert!(!Register::GS.is_gpr8());
assert!(Register::CH.is_gpr8());
assert!(!Register::DX.is_gpr8());
assert!(!Register::R13D.is_gpr8());
assert!(!Register::RSP.is_gpr8());
assert!(!Register::XMM0.is_gpr8());

Checks if it’s a 16-bit general purpose register (AX-R15W)

Examples
use iced_x86::*;
assert!(!Register::GS.is_gpr16());
assert!(!Register::CH.is_gpr16());
assert!(Register::DX.is_gpr16());
assert!(!Register::R13D.is_gpr16());
assert!(!Register::RSP.is_gpr16());
assert!(!Register::XMM0.is_gpr16());

Checks if it’s a 32-bit general purpose register (EAX-R15D)

Examples
use iced_x86::*;
assert!(!Register::GS.is_gpr32());
assert!(!Register::CH.is_gpr32());
assert!(!Register::DX.is_gpr32());
assert!(Register::R13D.is_gpr32());
assert!(!Register::RSP.is_gpr32());
assert!(!Register::XMM0.is_gpr32());

Checks if it’s a 64-bit general purpose register (RAX-R15)

Examples
use iced_x86::*;
assert!(!Register::GS.is_gpr64());
assert!(!Register::CH.is_gpr64());
assert!(!Register::DX.is_gpr64());
assert!(!Register::R13D.is_gpr64());
assert!(Register::RSP.is_gpr64());
assert!(!Register::XMM0.is_gpr64());

Checks if it’s a 128-bit vector register (XMM0-XMM31)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_xmm());
assert!(!Register::RSP.is_xmm());
assert!(Register::XMM0.is_xmm());
assert!(!Register::YMM0.is_xmm());
assert!(!Register::ZMM0.is_xmm());

Checks if it’s a 256-bit vector register (YMM0-YMM31)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_ymm());
assert!(!Register::RSP.is_ymm());
assert!(!Register::XMM0.is_ymm());
assert!(Register::YMM0.is_ymm());
assert!(!Register::ZMM0.is_ymm());

Checks if it’s a 512-bit vector register (ZMM0-ZMM31)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_zmm());
assert!(!Register::RSP.is_zmm());
assert!(!Register::XMM0.is_zmm());
assert!(!Register::YMM0.is_zmm());
assert!(Register::ZMM0.is_zmm());

Checks if it’s an XMM, YMM or ZMM register

Examples
use iced_x86::*;
assert!(!Register::R13D.is_vector_register());
assert!(!Register::RSP.is_vector_register());
assert!(Register::XMM0.is_vector_register());
assert!(Register::YMM0.is_vector_register());
assert!(Register::ZMM0.is_vector_register());

Checks if it’s EIP/RIP

Examples
use iced_x86::*;
assert!(Register::EIP.is_ip());
assert!(Register::RIP.is_ip());

Checks if it’s an opmask register (K0-K7)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_k());
assert!(Register::K3.is_k());

Checks if it’s a control register (CR0-CR15)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_cr());
assert!(Register::CR3.is_cr());

Checks if it’s a debug register (DR0-DR15)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_dr());
assert!(Register::DR3.is_dr());

Checks if it’s a test register (TR0-TR7)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_tr());
assert!(Register::TR3.is_tr());

Checks if it’s an FPU stack register (ST0-ST7)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_st());
assert!(Register::ST3.is_st());

Checks if it’s a bound register (BND0-BND3)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_bnd());
assert!(Register::BND3.is_bnd());

Checks if it’s an MMX register (MM0-MM7)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_mm());
assert!(Register::MM3.is_mm());

Checks if it’s a tile register (TMM0-TMM7)

Examples
use iced_x86::*;
assert!(!Register::R13D.is_tmm());
assert!(Register::TMM3.is_tmm());

Iterates over all Register enum values

Trait Implementations

The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
The resulting type after applying the + operator.
Performs the + operation. Read more
Performs the += operation. Read more
Performs the += operation. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Serialize this value into the given Serde serializer. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
Performs the -= operation. Read more
Performs the -= operation. Read more
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.