
AsmJit Project
Low-Latency Machine Code Generation
Base class representing an operand in AsmJit (non-default constructed version).
Contains no initialization code and can be used safely to define an array of operands that won't be initialized. This is a Operand base structure designed to be statically initialized, static const, or to be used by user code to define an array of operands without having them default initialized at construction time.
Tests whether the given id
is a valid virtual register id.
Since AsmJit supports both physical and virtual registers it must be able to distinguish between these two. The idea is that physical registers are always limited in size, so virtual identifiers start from kVirtIdMin
and end at kVirtIdMax
.
Converts a real-id into a packed-id that can be stored in Operand.
Converts a packed-id back to real-id.
Initializes the operand from other
operand (used by operator overloads).
Resets the Operand
to none.
None operand is defined the following way:
0
.0
.In other words, reset operands have all members set to zero. Reset operand must match the Operand state right after its construction. Alternatively, if you have an array of operands, you can simply use memset()
.
Tests whether this operand is the same as other
.
Tests whether this operand is not the same as other
.
Casts this operand to T
type.
Casts this operand to T
type (const).
Tests whether the operand's signature matches the signature of the other
operand.
Tests whether the operand's signature matches the given signature sign
.
Returns operand signature as unsigned 32-bit integer.
Signature is first 4 bytes of the operand data. It's used mostly for operand checking as it's much faster to check packed 4 bytes at once than having to check these bytes individually.
Sets the operand signature, see signature()
.
setSignature()
can lead to hard-to-debug errors. Returns the type of the operand, see OpType
.
Tests whether the operand is none (OperandType::kNone
).
Tests whether the operand is a register (OperandType::kReg
).
Tests whether the operand is a memory location (OperandType::kMem
).
Tests whether the operand is an immediate (OperandType::kImm
).
Tests whether the operand is a label (OperandType::kLabel
).
Tests whether the operand is a physical register.
Tests whether the operand is a virtual register.
Tests whether the operand specifies a size (i.e. the size is not zero).
Tests whether the size of the operand matches size
.
Returns the size of the operand in bytes.
The value returned depends on the operand type:
x86::CReg
and x86::DReg
) the size returned should be the greatest possible (so it should return 64-bit size in such case).Returns the operand id.
The value returned should be interpreted accordingly to the operand type:
0
.0
.newLabel()
or Globals::kInvalidId
if the label is invalid or not initialized. Tests whether the operand is 100% equal to other
operand.
Tests whether the operand is a register matching the given register type
.
Tests whether the operand is register and of register type
and id
.
Tests whether the operand is a register or memory.
Provides operand type and additional payload.
Either base id as used by memory operand or any id as used by others.
Data specific to the operand type.
The reason we don't use union is that we have constexpr
constructors that construct operands and other constexpr
functions that return whether another Operand or something else. These cannot generally work with unions so we also cannot use union
if we want to be standard compliant.