IndexUniversal JITasmjit::ujit::UniCompiler

asmjit::ujit::UniCompiler Class Reference [¶]

Universal compiler.

Classes

Public Types

Constants

Member Functions

Construction & Destruction

Allocators

Constant Table

CPU Architecture, Features and Optimization Options

CPU SIMD Width and SIMD Width Utilities

Labels

Align

Embed

Comment

Function Management

Function Finalization

Function Invocation

Virtual Registers & Memory (Target Independent)

Miscellaneous Helpers

Constants (X86|X86_64)

Emit - General Purpose Instructions

Emit - Vector Instructions

Memory Loads & Stores

Memory Loads & Stores with Parameterized Size

Utilities

ujit::UniCompiler::UniCompiler(
const CpuFeatures& features,
CpuHints cpu_hints,
)noexcept[1/2][¶]

Creates UniCompiler that would use the existing BackendCompiler (it would keep the pointer to it).

ujit::UniCompiler::UniCompiler(
const CpuFeatures& features,
CpuHints cpu_hints
)noexcept[2/2][¶]

Creates UniCompiler that would use the existing BackendCompiler (it would keep the pointer to it).

ujit::UniCompiler::~UniCompiler()noexcept[¶]

Destroys UniCompiler - the existing BackendCompiler would be untouched.

Arena& ujit::UniCompiler::arena()noexcept[¶]

Returns the arena used by UniCompiler.

ScalarOpBehavior ujit::UniCompiler::scalar_op_behavior() constnoexcept[¶]

Returns the behavior of scalar operations (mostly floating point).

FMinFMaxOpBehavior ujit::UniCompiler::fmin_fmax_op_behavior() constnoexcept[¶]

Returns the behavior of floating point min/max operations.

FMAddOpBehavior ujit::UniCompiler::fmadd_op_behavior() constnoexcept[¶]

Returns the behavior of floating point mul+add (madd) operations.

FloatToIntOutsideRangeBehavior ujit::UniCompiler::float_to_int_outside_range_behavior() constnoexcept[¶]

Returns the behavior of float-to-integer conversion when the floating point is outside of the integer representable range, infinite, or NaN.

bool ujit::UniCompiler::is_scalar_op_zeroing() constnoexcept[¶]

Tests whether a scalar operation is zeroing the rest of the destination register (AArch64).

bool ujit::UniCompiler::is_scalar_op_preserving_vec128() constnoexcept[¶]

Tests whether a scalar operation is preserving the low 128-bit part of the destination register (X86|X86_64).

bool ujit::UniCompiler::is_fmin_fmax_finite() constnoexcept[¶]

Tests whether a floating point min/max operation selects a finite value if one of the values is NaN (AArch64).

bool ujit::UniCompiler::is_fmin_fmax_ternary() constnoexcept[¶]

Tests whether a floating point min/max operation works as a ternary if - if a <|> b ? a : b (X86|X86_64).

bool ujit::UniCompiler::is_fmadd_fused() constnoexcept[¶]

Tests whether a floating point mul+add operation is fused (uses FMA).

bool ujit::UniCompiler::is_fma_storing_to_any_register() constnoexcept[¶]

Tests whether a FMA operation is available and that it can store the result to any register (true of X86).

bool ujit::UniCompiler::is_fma_storing_to_any_accumulator() constnoexcept[¶]

Tests whether a FMA operation is available and that it only stores the result to accumulator register.

CpuHints ujit::UniCompiler::cpu_hints() constnoexcept[¶]

Returns CPU hints.

bool ujit::UniCompiler::has_cpu_hint() constnoexcept[¶]

Tests whether a CPU hint hint is enabled.

OperandSignature ujit::UniCompiler::gp_signature() constnoexcept[¶]

Returns a native register signature, either 32-bit or 64-bit depending on the target architecture).

Gp ujit::UniCompiler::gpz(
const Gp& reg
) constnoexcept[¶]

Clones the given reg register into a native register (either 32-bit or 64-bit depending on the target architecture).

VecWidth ujit::UniCompiler::vec_width() constnoexcept[¶]

Returns the current SIMD width (in bytes) that this compiler and all its parts must use.

Note

The returned width is in bytes and it's calculated from the maximum supported widths of all pipeline parts. This means that SIMD width returned could be actually lower than a SIMD width supported by the target CPU.

bool ujit::UniCompiler::use_256bit_simd() constnoexcept[¶]

Returns whether the compiler and all parts use 256-bit SIMD.

bool ujit::UniCompiler::use_512bit_simd() constnoexcept[¶]

Returns whether the compiler and all parts use 512-bit SIMD.

uint32_t ujit::UniCompiler::vec_multiplier() constnoexcept[¶]

Returns a constant that can be used to multiply a baseline SIMD width to get the value returned by vec_width().

Note

A baseline SIMD width would be 16 bytes on most platforms.

Label ujit::UniCompiler::new_label()nodiscard[¶]

Creates a new anonymous label.

See BaseEmitter::new_label() for more details.

Label ujit::UniCompiler::new_named_label(
const char* name,
size_t name_size = SIZE_MAX,
uint32_t parent_id = Globals::kInvalidId
)nodiscard[1/2][¶]

Creates a new named label.

See BaseEmitter::new_named_label() for more details.

Label ujit::UniCompiler::new_named_label(
Span<const char> name,
uint32_t parent_id = Globals::kInvalidId
)nodiscard[2/2][¶]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Label ujit::UniCompiler::new_anonymous_label(
const char* name,
size_t name_size = SIZE_MAX
)nodiscard[1/2][¶]

Creates a new anonymous label with a name, which can only be used for debugging purposes.

See BaseEmitter::new_anonymous_label() for more details.

Label ujit::UniCompiler::new_anonymous_label(
Span<const char> name
)nodiscard[2/2][¶]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Label ujit::UniCompiler::new_external_label(
const char* name,
size_t name_size = SIZE_MAX
)nodiscard[1/2][¶]

Creates a new external label.

See BaseEmitter::new_external_label() for more details.

Label ujit::UniCompiler::new_external_label(
Span<const char> name
)nodiscard[2/2][¶]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Error ujit::UniCompiler::bind(
const Label& label
)[¶]

Binds the label to the current position of the current section.

See BaseEmitter::bind() for more details.

Error ujit::UniCompiler::align(
AlignMode align_mode,
uint32_t alignment
)[¶]

Aligns the current position to the alignment specified.

See BaseEmitter::align() for more details.

Error ujit::UniCompiler::embed(
const void* data,
size_t data_size
)[¶]

Embeds raw data into the instruction stream.

See BaseEmitter::embed() for more details.

Error ujit::UniCompiler::embed_data_array(
TypeId type_id,
const void* data,
size_t item_count,
size_t repeat_count = 1
)[¶]

Embeds a typed data array.

See BaseEmitter::embed_data_array() for more details.

Error ujit::UniCompiler::embed_int8(
int8_t value,
size_t repeat_count = 1
)[¶]

Embeds int8_t value repeated by repeat_count.

Error ujit::UniCompiler::embed_uint8(
uint8_t value,
size_t repeat_count = 1
)[¶]

Embeds uint8_t value repeated by repeat_count.

Error ujit::UniCompiler::embed_int16(
int16_t value,
size_t repeat_count = 1
)[¶]

Embeds int16_t value repeated by repeat_count.

Error ujit::UniCompiler::embed_uint16(
uint16_t value,
size_t repeat_count = 1
)[¶]

Embeds uint16_t value repeated by repeat_count.

Error ujit::UniCompiler::embed_int32(
int32_t value,
size_t repeat_count = 1
)[¶]

Embeds int32_t value repeated by repeat_count.

Error ujit::UniCompiler::embed_uint32(
uint32_t value,
size_t repeat_count = 1
)[¶]

Embeds uint32_t value repeated by repeat_count.

Error ujit::UniCompiler::embed_int64(
int64_t value,
size_t repeat_count = 1
)[¶]

Embeds int64_t value repeated by repeat_count.

Error ujit::UniCompiler::embed_uint64(
uint64_t value,
size_t repeat_count = 1
)[¶]

Embeds uint64_t value repeated by repeat_count.

Error ujit::UniCompiler::embed_float(
float value,
size_t repeat_count = 1
)[¶]

Embeds a 32-bit floating point value repeated by repeat_count.

Error ujit::UniCompiler::embed_double(
double value,
size_t repeat_count = 1
)[¶]

Embeds a 64-bit floating point value repeated by repeat_count.

Error ujit::UniCompiler::embed_const_pool(
const Label& label,
const ConstPool& pool
)[¶]

Embeds a constant pool at the current offset.

See BaseEmitter::embed_const_pool() for more details.

Error ujit::UniCompiler::embed_label(
const Label& label,
size_t data_size = 0
)[¶]

Embeds an absolute label address as data.

See BaseEmitter::embed_label() for more details.

Error ujit::UniCompiler::embed_label_delta(
const Label& label,
const Label& base,
size_t data_size = 0
)[¶]

Embeds a delta (distance) between the label and base calculating it as label - base.

See BaseEmitter::embed_label_delta() for more details.

Error ujit::UniCompiler::comment(
const char* data,
size_t size = SIZE_MAX
)[1/2][¶]

Emits a comment stored in data with an optional size parameter.

Error ujit::UniCompiler::comment(
Span<const char> data
)[2/2][¶]

Emits a comment passed via a data span.

template<typename... Args>
Error ujit::UniCompiler::commentf(
const char* fmt,
Args&&... args
)[¶]

Emits a formatted comment specified by fmt and variable number of arguments.

Error ujit::UniCompiler::commentv(
const char* fmt,
va_list ap
)[¶]

Emits a formatted comment specified by fmt and ap.

FuncNode* ujit::UniCompiler::func() constnodiscardnoexcept[¶]

Returns the function being generated.

This is just a convenience wrapper that calls BaseCompiler::func().

void ujit::UniCompiler::hook_func()noexcept[¶]

Hooks a function that is being generated by BaseCompiler.

This function is called automatically by add_func_node() and add_func(). However, if BaseCompiler was called instead of UniCompiler to add the function node to the instruction stream, then it has to be hooked manually.

void ujit::UniCompiler::unhook_func()noexcept[¶]

Unhooks a function.

In general this mostly does a cleanup of UniCompiler.

Error ujit::UniCompiler::new_func_node(
Out<FuncNode*> out,
const FuncSignature& signature
)[¶]

Creates a new FuncNode.

This is just a convenience wrapper that calls BaseCompiler::new_func_node().

Error ujit::UniCompiler::add_func_node(
Out<FuncNode*> out,
const FuncSignature& signature
)[¶]

Creates a new FuncNode adds it to the instruction stream.

This is just a convenience wrapper that calls BaseCompiler::add_func_node().

FuncNode* ujit::UniCompiler::add_func(
const FuncSignature& signature
)[1/2][¶]

Creates a new FuncNode with the given signature, adds it to the instruction stream by using add_func(FuncNode* func) overload, and returns the node.

FuncNode* ujit::UniCompiler::add_func(
FuncNode* ASMJIT_NONNULL func
)[2/2][¶]

Adds a function node to the instruction stream.

Error ujit::UniCompiler::new_func_ret_node(
const Operand_& o0,
const Operand_& o1
)[¶]

Creates a new FuncRetNode.

This is just a convenience wrapper that calls BaseCompiler::new_func_ret_node().

Error ujit::UniCompiler::add_func_ret_node(
const Operand_& o0,
const Operand_& o1
)[¶]

Creates a new FuncRetNode and adds it to the instruction stream.

This is just a convenience wrapper that calls BaseCompiler::add_func_ret_node().

Error ujit::UniCompiler::end_func()[¶]

Ends the current function by emitting a sentinel that marks the end of it.

Error ujit::UniCompiler::ret()[1/3][¶]

Return from function, a convenience function that calls BaseCompiler::ret().

Note

This doesn't end the function - it just emits a return.

Error ujit::UniCompiler::ret(
const Reg& o0
)[2/3][¶]

Return from function - one value.

Note

This doesn't end the function - it just emits a return.

Error ujit::UniCompiler::ret(
const Reg& o0,
const Reg& o1
)[3/3][¶]

Return from function - two values / register pair.

Note

This doesn't end the function - it just emits a return.

Error ujit::UniCompiler::finalize()[¶]

Error ujit::UniCompiler::new_invoke_node(
Out<InvokeNode*> out,
InstId inst_id,
const Operand_& o0,
const FuncSignature& signature
)[¶]

Creates a new InvokeNode.

Error ujit::UniCompiler::add_invoke_node(
Out<InvokeNode*> out,
InstId inst_id,
const Operand_& o0,
const FuncSignature& signature
)[¶]

Creates a new InvokeNode and adds it to the instruction stream.

template<typename RegT, typename... Args>
RegT ujit::UniCompiler::new_reg(
TypeId type_id,
Args&&... args
)nodiscardnoexcept[¶]

Wraps BackendCompiler::new_reg(type_id, args...).

template<typename RegT, typename... Args>
RegT ujit::UniCompiler::new_similar_reg(
const RegT& ref,
Args&&... args
)nodiscardnoexcept[¶]

Wraps BackendCompiler::new_similar_reg(ref, args...).

template<typename... Args>
Gp ujit::UniCompiler::new_gp32(
Args&&... args
)nodiscardnoexcept[¶]

Wraps BackendCompiler::new_gp32(args...).

template<typename... Args>
Gp ujit::UniCompiler::new_gp64(
Args&&... args
)nodiscardnoexcept[¶]

Wraps BackendCompiler::new_gp64(args...).

template<typename... Args>
Gp ujit::UniCompiler::new_gpz(
Args&&... args
)nodiscardnoexcept[¶]

Wraps BackendCompiler::new_gpz(args...).

template<typename... Args>
Gp ujit::UniCompiler::new_gp_ptr(
Args&&... args
)nodiscardnoexcept[¶]

Wraps BackendCompiler::new_gpz(args...).

BackendCompiler* ujit::UniCompiler::cc = nullptr[¶]

AsmJit compiler.

VecConstTableRef ujit::UniCompiler::_ct_ref[¶]

Reference to a table that provides global constants.

Note

This table can be extended by users so it fits a particular use-case, see UniCompiler constructor.

ScalarOpBehavior ujit::UniCompiler::_scalar_op_behavior {}[¶]

The behavior of scalar operations (mostly floating point).

FMinFMaxOpBehavior ujit::UniCompiler::_fmin_fmax_op_behavior {}[¶]

The behavior of floating point min/max operation.

FMAddOpBehavior ujit::UniCompiler::_fmadd_op_behavior {}[¶]

The behavior of floating point madd operation.

FloatToIntOutsideRangeBehavior ujit::UniCompiler::_float_to_int_outside_range_behavior {}[¶]

The behavior of a float-to-int conversion when the float is out of integer range, infinite, or NaN.

CpuFeatures ujit::UniCompiler::_features {}[¶]

Target CPU features.

CpuHints ujit::UniCompiler::_cpu_hints {}[¶]

Optimization flags.

uint32_t ujit::UniCompiler::_vec_reg_count = 0[¶]

Number of available vector registers.

VecWidth ujit::UniCompiler::_vec_width = VecWidth::k128[¶]

SIMD width.

uint8_t ujit::UniCompiler::_vec_multiplier = 0[¶]

SIMD multiplier, derived from _vec_width (1, 2, 4).

RegType ujit::UniCompiler::_vec_reg_type = RegType::kNone[¶]

SIMD register type (AsmJit).

TypeId ujit::UniCompiler::_vec_type_id = TypeId::kVoid[¶]

SIMD type id (AsmJit).

BaseNode* ujit::UniCompiler::_func_init_hook = nullptr[¶]

Function initialization hook.

Gp ujit::UniCompiler::_gp_none[¶]

Invalid GP register.

Mem ujit::UniCompiler::_tmp_stack[size_t(StackId::kMaxValue) +1][¶]

Temporary stack used to transfer SIMD regs to GP.

int32_t ujit::UniCompiler::_common_table_offset = 0[¶]

Offset to the first constant to the commonTable global.

Gp ujit::UniCompiler::_common_table_ptr[¶]

Pointer to the commonTable constant pool (only used in 64-bit mode).