asmjit::Imm Class Reference

Immediate operand.

Immediate operand is usually part of instruction itself. It's inlined after or before the instruction opcode. Immediates can be only signed or unsigned integers.

To create an immediate operand use asmjit::imm() helper, which can be used with any type, not just the default 64-bit int.

Public Types

- Public Types inherited from asmjit::Operand_

Member Functions

Construction & Destruction
Overloaded Operators
Accessors
Utilities
- 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

Imm::Type : uint32_tenum

Type of the immediate.

ConstantDescription
kTypeInteger 

Immediate is integer.

kTypeDouble 

Immediate is a floating point stored as double-precision.

Constructor & Destructor Documentation

Imm::Imm()constexprconstexprnoexcept[1/4]

Creates a new immediate value (initial value is 0).

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

Creates a new immediate value from other.

Imm::Imm(const arm::Shift& shift)constexprconstexprnoexcept[3/4]

Creates a new immediate value from ARM/AArch64 specific shift.

template<typename T>
Imm::Imm(const T& val, const uint32_t predicate = 0)constexprconstexprnoexcept[4/4]

Creates a new signed immediate value, assigning the value to val and an architecture-specific predicate to predicate.

Note
Predicate is currently only used by ARM architectures.

Member Function Documentation

Imm& Imm::operator=(const Imm& other)noexcept

Assigns the value of the other operand to this immediate.

uint32_t Imm::type() constconstexprconstexprnoexcept

Returns immediate type, see Type.

void Imm::setType(uint32_t type)noexcept

Sets the immediate type to type, see Type.

void Imm::resetType()noexcept

Resets immediate type to kTypeInteger.

uint32_t Imm::predicate() constconstexprconstexprnoexcept

Returns operation predicate of the immediate.

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

void Imm::setPredicate(uint32_t predicate)noexcept

Sets operation predicate of the immediate to predicate.

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

void Imm::resetPredicate()noexcept

Resets the shift operation type of the immediate to the default value (no operation).

int64_t Imm::value() constconstexprconstexprnoexcept

Returns the immediate value as int64_t, which is the internal format Imm uses.

uint32_t Imm::isInteger() constconstexprconstexprnoexcept

Tests whether this immediate value is integer of any size.

uint32_t Imm::isDouble() constconstexprconstexprnoexcept

Tests whether this immediate value is a double precision floating point value.

bool Imm::isInt8() constconstexprconstexprnoexcept

Tests whether the immediate can be casted to 8-bit signed integer.

bool Imm::isUInt8() constconstexprconstexprnoexcept

Tests whether the immediate can be casted to 8-bit unsigned integer.

bool Imm::isInt16() constconstexprconstexprnoexcept

Tests whether the immediate can be casted to 16-bit signed integer.

bool Imm::isUInt16() constconstexprconstexprnoexcept

Tests whether the immediate can be casted to 16-bit unsigned integer.

bool Imm::isInt32() constconstexprconstexprnoexcept

Tests whether the immediate can be casted to 32-bit signed integer.

bool Imm::isUInt32() constconstexprconstexprnoexcept

Tests whether the immediate can be casted to 32-bit unsigned integer.

template<typename T>
T Imm::valueAs() constnoexcept

Returns the immediate value casted to T.

The value is masked before it's casted to T so the returned value is simply the representation of T considering the original value's lowest bits.

int32_t Imm::int32Lo() constconstexprconstexprnoexcept

Returns low 32-bit signed integer.

int32_t Imm::int32Hi() constconstexprconstexprnoexcept

Returns high 32-bit signed integer.

uint32_t Imm::uint32Lo() constconstexprconstexprnoexcept

Returns low 32-bit signed integer.

uint32_t Imm::uint32Hi() constconstexprconstexprnoexcept

Returns high 32-bit signed integer.

template<typename T>
void Imm::setValue(const T& val)noexcept

Sets immediate value to val, the value is casted to a signed 64-bit integer.

Imm Imm::clone() constconstexprconstexprnoexcept

Clones the immediate operand.