asmjit::BaseReg Class Reference

Physical or virtual register operand.

Static Public Attributes

Classes

Public Types

- Public Types inherited from asmjit::Operand_

Member Functions

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_

Construction & Destruction

Additional Inherited Members

- Public Attributes inherited from asmjit::Operand_

Member Enumeration Documentation

BaseReg::RegType : uint32_tenum

Architecture neutral register types.

These must be reused by any platform that contains that types. All GP and VEC registers are also allowed by design to be part of a BASE|INDEX of a memory operand.

ConstantDescription
kTypeNone 

No register - unused, invalid, multiple meanings.

kTypeGp8Lo 

8-bit low general purpose register (X86).

kTypeGp8Hi 

8-bit high general purpose register (X86).

kTypeGp16 

16-bit general purpose register (X86).

kTypeGp32 

32-bit general purpose register (X86|ARM).

kTypeGp64 

64-bit general purpose register (X86|ARM).

kTypeVec8 

8-bit view of a vector register (ARM).

kTypeVec16 

16-bit view of a vector register (ARM).

kTypeVec32 

32-bit view of a vector register (ARM).

kTypeVec64 

64-bit view of a vector register (ARM).

kTypeVec128 

128-bit view of a vector register (X86|ARM).

kTypeVec256 

256-bit view of a vector register (X86).

kTypeVec512 

512-bit view of a vector register (X86).

kTypeVec1024 

1024-bit view of a vector register (future).

kTypeOther0 

Other0 register, should match kOther0 group.

kTypeOther1 

Other1 register, should match kOther1 group.

kTypeIP 

Universal id of IP/PC register (if separate).

kTypeCustom 

Start of platform dependent register types.

kTypeMax 

Maximum possible register type value.

BaseReg::RegGroup : uint32_tenum

Register group (architecture neutral), and some limits.

ConstantDescription
kGroupGp 

General purpose register group compatible with all backends.

kGroupVec 

Vector register group compatible with all backends.

kGroupOther0 

Group that is architecture dependent.

kGroupOther1 

Group that is architecture dependent.

kGroupVirt 

Count of register groups used by physical and virtual registers.

kGroupCount 

Count of register groups used by physical registers only.

BaseReg::Id : uint32_tenum

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 rId)constexprconstexprnoexcept[3/4]

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

BaseReg::BaseReg(const SignatureAndId& sid)constexprexplicitconstexprnoexcept[4/4]

Creates a register initialized to signature and rId.

Member Function Documentation

BaseReg BaseReg::fromSignatureAndId(uint32_t rSgn, uint32_t rId)staticnoexcept

Creates a new register from register signature rSgn and id.

uint32_t 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/2]

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

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

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(uint32_t type) constconstexprconstexprnoexcept

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

bool BaseReg::isGroup(uint32_t 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.

bool BaseReg::isReg(uint32_t rType) constconstexprconstexprnoexcept[1/5]

Same as isType(), provided for convenience.

bool BaseReg::isReg(uint32_t rType, uint32_t rId) constconstexprconstexprnoexcept[2/5]

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

uint32_t BaseReg::type() constconstexprconstexprnoexcept

Returns the type of the register.

uint32_t BaseReg::group() constconstexprconstexprnoexcept

Returns the register group.

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::Predicate::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::Predicate::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 rId)noexcept

Sets the register id to rId.

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

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

void BaseReg::setSignatureAndId(uint32_t signature, uint32_t rId)noexcept

Sets the register signature and rId.

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 rId)staticnoexcept[3/3]

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

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

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

bool Operand_::isRegconstexprconstexprnoexcept[3/5]

Tests whether the operand is a register (kOpReg).

bool Operand_::isRegconstexprconstexprnoexcept[4/5]

ASMJIT_NO_DEPRECATED.

Tests whether the operand is a register matching rType.

bool Operand_::isRegconstexprconstexprnoexcept[5/5]

Tests whether the operand is register and of rType and rId.

Member Data Documentation

uint32_t BaseReg::kBaseSignatureconstexprstaticconstexpr

Initial value:
=
kSignatureOpTypeMask |
kSignatureRegTypeMask |
kSignatureRegGroupMask |
kSignatureSizeMask