asmjit::BaseReg Class Reference
Inheritance diagram for asmjit::BaseReg:
asmjit::Operand asmjit::Operand_ asmjit::arm::Reg asmjit::x86::Reg asmjit::a64::Gp asmjit::arm::BaseVec asmjit::x86::Bnd asmjit::x86::CReg asmjit::x86::DReg asmjit::x86::Gp asmjit::x86::KReg asmjit::x86::Mm asmjit::x86::Rip asmjit::x86::SReg asmjit::x86::St asmjit::x86::Tmm asmjit::x86::Vec

Physical or virtual register operand (base).

Public Types

Constants
- Public Types inherited from asmjit::Operand_

Member Functions

Construction & Destruction
Overloaded Operators
Accessors
- Public Member Functions inherited from asmjit::Operand
- Public Member Functions inherited from asmjit::Operand_

Static Functions

Static Functions
- Static Public Member Functions inherited from asmjit::Operand_

Additional Inherited Members

- Public Attributes inherited from asmjit::Operand_

Member Enumeration Documentation

anonymous enum : uint32_t◆ 

ConstantDescription
kIdBad 

None or any register (mostly internal).

Constructor & Destructor Documentation

BaseReg::BaseReg()constexprconstexprnoexcept[1/4]◆ 

Creates a dummy register operand.

BaseReg::BaseReg(const BaseReg& other)constexprconstexprnoexcept[2/4]◆ 

Creates a new register operand which is the same as other .

BaseReg::BaseReg(const BaseReg& other, uint32_t id)constexprconstexprnoexcept[3/4]◆ 

Creates a new register operand compatible with other, but with a different id.

BaseReg::BaseReg(const Signature& signature, uint32_t id)constexprconstexprnoexcept[4/4]◆ 

Creates a register initialized to the given signature and id.

Member Function Documentation

OperandSignature BaseReg::baseSignature() constconstexprconstexprnoexcept◆ 

Returns base signature of the register associated with each register type.

Base signature only contains the operand type, register type, register group, and register size. It doesn't contain element type, predicate, or other architecture-specific data. Base signature is a signature that is provided by architecture-specific RegTraits, like x86::RegTraits.

bool BaseReg::hasBaseSignature(uint32_t signature) constconstexprconstexprnoexcept[1/3]◆ 

Tests whether the operand's base signature matches the given signature sign.

bool BaseReg::hasBaseSignature(const OperandSignature& signature) constconstexprconstexprnoexcept[2/3]◆ 

Tests whether the operand's base signature matches the given signature sign.

bool BaseReg::hasBaseSignature(const BaseReg& other) constconstexprconstexprnoexcept[3/3]◆ 

Tests whether the operand's base signature matches the base signature of the other operand.

bool BaseReg::isSame(const BaseReg& other) constconstexprconstexprnoexcept◆ 

Tests whether this register is the same as other.

This is just an optimization. Registers by default only use the first 8 bytes of Operand data, so this method takes advantage of this knowledge and only compares these 8 bytes. If both operands were created correctly both equals() and isSame() should give the same answer, however, if any of these two contains garbage or other metadata in the upper 8 bytes then isSame() may return true in cases in which equals() returns false.

bool BaseReg::isValid() constconstexprconstexprnoexcept◆ 

Tests whether the register is valid (either virtual or physical).

bool BaseReg::isPhysReg() constconstexprconstexprnoexcept◆ 

Tests whether this is a physical register.

bool BaseReg::isVirtReg() constconstexprconstexprnoexcept◆ 

Tests whether this is a virtual register.

bool BaseReg::isType(RegType type) constconstexprconstexprnoexcept◆ 

Tests whether the register type matches type - same as isReg(type), provided for convenience.

bool BaseReg::isGroup(RegGroup group) constconstexprconstexprnoexcept◆ 

Tests whether the register group matches group.

bool BaseReg::isGp() constconstexprconstexprnoexcept[1/3]◆ 

Tests whether the register is a general purpose register (any size).

bool BaseReg::isVec() constconstexprconstexprnoexcept[1/3]◆ 

Tests whether the register is a vector register of any size.

bool BaseReg::isMask() constconstexprconstexprnoexcept◆ 

Tests whether the register is a mask register of any size.

bool BaseReg::isReg(RegType rType) constconstexprconstexprnoexcept[1/7]◆ 

Same as isType(), provided for convenience.

bool BaseReg::isReg(RegType rType, uint32_t id) constconstexprconstexprnoexcept[2/7]◆ 

Tests whether the register type matches type and register id matches id.

RegType BaseReg::type() constconstexprconstexprnoexcept◆ 

Returns the register type.

RegGroup BaseReg::group() constconstexprconstexprnoexcept◆ 

Returns the register group.

bool BaseReg::hasSize() constconstexprconstexprnoexcept[1/2]◆ 

Tests whether the register specifies a size (i.e. the size is not zero).

bool BaseReg::hasSize(uint32_t s) constconstexprconstexprnoexcept[2/2]◆ 

Tests whether the register size matches size s.

uint32_t BaseReg::size() constconstexprconstexprnoexcept◆ 

Returns the size of the register in bytes.

If the register size depends on architecture (like x86::CReg and x86::DReg) the size returned should be the greatest possible (so it should return 64-bit size in such case).

uint32_t BaseReg::predicate() constconstexprconstexprnoexcept◆ 

Returns operation predicate of the register (ARM/AArch64).

The meaning depends on architecture, for example on ARM hardware this describes arm::ShiftOp of the register.

void BaseReg::setPredicate(uint32_t predicate)noexcept◆ 

Sets operation predicate of the register to predicate (ARM/AArch64).

The meaning depends on architecture, for example on ARM hardware this describes arm::ShiftOp of the register.

void BaseReg::resetPredicate()noexcept◆ 

Resets shift operation type of the register to the default value (ARM/AArch64).

BaseReg BaseReg::clone() constconstexprconstexprnoexcept◆ 

Clones the register operand.

template<typename RegT>
RegT BaseReg::cloneAs() constconstexprconstexprnoexcept[1/2]◆ 

Casts this register to RegT by also changing its signature.

Note
Improper use of cloneAs() can lead to hard-to-debug errors.

template<typename RegT>
RegT BaseReg::cloneAs(const RegT& other) constconstexprconstexprnoexcept[2/2]◆ 

Casts this register to other by also changing its signature.

Note
Improper use of cloneAs() can lead to hard-to-debug errors.

void BaseReg::setId(uint32_t id)noexcept◆ 

Sets the register id to id.

template<typename RegT>
void BaseReg::setSignatureT()noexcept◆ 

Sets a 32-bit operand signature based on traits of RegT.

void BaseReg::setSignatureAndId(const OperandSignature& signature, uint32_t id)noexcept◆ 

Sets the register signature and id.

bool BaseReg::isGp(const Operand_& op)staticnoexcept[2/3]◆ 

Tests whether the op operand is a general purpose register.

bool BaseReg::isVec(const Operand_& op)staticnoexcept[2/3]◆ 

Tests whether the op operand is a vector register.

bool BaseReg::isGp(const Operand_& op, uint32_t id)staticnoexcept[3/3]◆ 

Tests whether the op is a general purpose register of the given id.

bool BaseReg::isVec(const Operand_& op, uint32_t id)staticnoexcept[3/3]◆ 

Tests whether the op is a vector register of the given id.

bool Operand_::isReg() constconstexprconstexprnoexcept[3/7]◆ 

Tests whether the operand is a register (OperandType::kReg).

bool Operand_::isReg(RegType type) constconstexprconstexprnoexcept[4/7]◆ 

Tests whether the operand is a register matching the given register type.

bool Operand_::isReg(RegGroup regGroup) constconstexprconstexprnoexcept[5/7]◆ 

Tests whether the operand is a register of the provided register group regGroup.

bool Operand_::isReg(RegType regType, uint32_t regId) constconstexprconstexprnoexcept[6/7]◆ 

Tests whether the operand is register and of register type regType and regId.

bool Operand_::isReg(RegGroup regGroup, uint32_t regId) constconstexprconstexprnoexcept[7/7]◆ 

Tests whether the operand is register and of register group regGroup and regId.