asmjit::x86::Mem Class Reference
Inheritance diagram for asmjit::x86::Mem:
asmjit::BaseMem asmjit::Operand asmjit::Operand_

Memory operand specific to X86 and X86_64 architecture.

Public Types

Constants
- Public Types inherited from asmjit::Operand_

Member Functions

Construction & Destruction
Overloaded Operators
Clone
Base & Index
Memory Size
Address Type
Segment
Shift
Broadcast
- Public Member Functions inherited from asmjit::BaseMem
- Public Member Functions inherited from asmjit::Operand
- Public Member Functions inherited from asmjit::Operand_

Additional Inherited Members

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

Member Enumeration Documentation

x86::Mem::AdditionalBits : uint32_tenum◆ 

Additional bits of operand's signature used by x86::Mem.

class x86::Mem::AddrType : uint32_tenumstrong◆ 

Address type.

ConstantDescription
kDefault 

Default address type, Assembler will select the best type when necessary.

kAbs 

Absolute address type.

kRel 

Relative address type.

kMaxValue 

Maximum value of AddrType.

class x86::Mem::Broadcast : uint32_tenumstrong◆ 

Memory broadcast type.

ConstantDescription
kNone 

No broadcast (regular memory operand).

k1To2 

Broadcast {1to2}.

k1To4 

Broadcast {1to4}.

k1To8 

Broadcast {1to8}.

k1To16 

Broadcast {1to16}.

k1To32 

Broadcast {1to32}.

k1To64 

Broadcast {1to64}.

kMaxValue 

Maximum value of Broadcast.

Constructor & Destructor Documentation

x86::Mem::Mem()constexprconstexprnoexcept◆ 

Creates a default Mem operand that points to [0].

Member Function Documentation

Mem x86::Mem::clone() constconstexprconstexprnoexcept◆ 

Clones the memory operand.

Mem x86::Mem::cloneAdjusted(int64_t off) constnoexcept◆ 

Creates a copy of this memory operand adjusted by off.

Mem x86::Mem::cloneResized(uint32_t size) constnoexcept◆ 

Creates a copy of this memory operand resized to size.

Mem x86::Mem::cloneBroadcasted(Broadcast bcst) constconstexprconstexprnoexcept◆ 

Creates a copy of this memory operand with a broadcast bcst.

Reg x86::Mem::baseReg() constnoexcept◆ 

Converts memory baseType and baseId to x86::Reg instance.

The memory must have a valid base register otherwise the result will be wrong.

Reg x86::Mem::indexReg() constnoexcept◆ 

Converts memory indexType and indexId to x86::Reg instance.

The memory must have a valid index register otherwise the result will be wrong.

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

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

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

Tests whether the memory operand size matches size s.

uint32_t x86::Mem::size() constconstexprconstexprnoexcept◆ 

Returns the size of the memory operand in bytes.

Note
Most instructions would deduce the size of the memory operand, so in most cases it's expected that the returned value would be zero. However, some instruction require the size to select between multiple variations, so in some cases size is required would be non-zero (for example inc [mem], immediate requires size to distinguish between 8-bit, 16-bit, 32-bit, and 64-bit increments.

void x86::Mem::setSize(uint32_t size)noexcept◆ 

Sets the memory operand size (in bytes).

AddrType x86::Mem::addrType() constconstexprconstexprnoexcept◆ 

Returns the address type of the memory operand.

By default, address type of newly created memory operands is always AddrType::kDefault.

void x86::Mem::setAddrType(AddrType addrType)noexcept◆ 

Sets the address type to addrType.

void x86::Mem::resetAddrType()noexcept◆ 

Resets the address type to AddrType::kDefault.

bool x86::Mem::isAbs() constconstexprconstexprnoexcept◆ 

Tests whether the address type is AddrType::kAbs.

void x86::Mem::setAbs()noexcept◆ 

Sets the address type to AddrType::kAbs.

bool x86::Mem::isRel() constconstexprconstexprnoexcept◆ 

Tests whether the address type is AddrType::kRel.

void x86::Mem::setRel()noexcept◆ 

Sets the address type to AddrType::kRel.

bool x86::Mem::hasSegment() constconstexprconstexprnoexcept◆ 

Tests whether the memory operand has a segment override.

SReg x86::Mem::segment() constconstexprconstexprnoexcept◆ 

Returns the associated segment override as SReg operand.

uint32_t x86::Mem::segmentId() constconstexprconstexprnoexcept◆ 

Returns segment override register id, see SReg::Id.

void x86::Mem::setSegment(const SReg& seg)noexcept[1/2]◆ 

Sets the segment override to seg.

void x86::Mem::setSegment(uint32_t rId)noexcept[2/2]◆ 

Sets the segment override to id.

void x86::Mem::resetSegment()noexcept◆ 

Resets the segment override.

bool x86::Mem::hasShift() constconstexprconstexprnoexcept◆ 

Tests whether the memory operand has shift (aka scale) value.

uint32_t x86::Mem::shift() constconstexprconstexprnoexcept◆ 

Returns the memory operand's shift (aka scale) value.

void x86::Mem::setShift(uint32_t shift)noexcept◆ 

Sets the memory operand's shift (aka scale) value.

void x86::Mem::resetShift()noexcept◆ 

Resets the memory operand's shift (aka scale) value to zero.

bool x86::Mem::hasBroadcast() constconstexprconstexprnoexcept◆ 

Tests whether the memory operand has broadcast {1tox}.

Broadcast x86::Mem::getBroadcast() constconstexprconstexprnoexcept◆ 

Returns the memory operand's broadcast.

void x86::Mem::setBroadcast(Broadcast b)noexcept◆ 

Sets the memory operand's broadcast.

void x86::Mem::resetBroadcast()noexcept◆ 

Resets the memory operand's broadcast to none.

Mem x86::Mem::_1to1() constconstexprconstexprnoexcept◆ 

Returns a new Mem without a broadcast (the possible broadcast is cleared).

Mem x86::Mem::_1to2() constconstexprconstexprnoexcept◆ 

Returns a new Mem with {1to2} broadcast (AVX-512).

Mem x86::Mem::_1to4() constconstexprconstexprnoexcept◆ 

Returns a new Mem with {1to4} broadcast (AVX-512).

Mem x86::Mem::_1to8() constconstexprconstexprnoexcept◆ 

Returns a new Mem with {1to8} broadcast (AVX-512).

Mem x86::Mem::_1to16() constconstexprconstexprnoexcept◆ 

Returns a new Mem with {1to16} broadcast (AVX-512).

Mem x86::Mem::_1to32() constconstexprconstexprnoexcept◆ 

Returns a new Mem with {1to32} broadcast (AVX-512).

Mem x86::Mem::_1to64() constconstexprconstexprnoexcept◆ 

Returns a new Mem with {1to64} broadcast (AVX-512).

void BaseMem::setIndex(const BaseReg& index)noexcept◆ 

Sets the index register to type and id of the given index operand.