AsmJit
Low-Latency Machine Code Generation
Base assembler.
This is a base class that provides interface used by architecture specific assembler implementations. Assembler doesn't hold any data, instead it's attached to CodeHolder, which provides all the data that Assembler needs and which can be altered by it.
Check out architecture specific assemblers for more details and examples:
Creates a new BaseAssembler
instance.
Destroys the BaseAssembler
instance.
Returns the capacity of the current CodeBuffer.
Returns the number of remaining bytes in the current CodeBuffer.
Returns the current position in the CodeBuffer.
Sets the current position in the CodeBuffer to offset
.
offset
cannot be greater than buffer size even if it's within the buffer's capacity. Returns the start of the CodeBuffer in the current section.
Returns the end (first invalid byte) in the current section.
Returns the current pointer in the CodeBuffer in the current section.
Returns the current section.
Switches the given section
.
Once switched, everything is added to the given section
.
Reimplemented from asmjit::BaseEmitter.
Creates a new label.
Reimplemented from asmjit::BaseEmitter.
SIZE_MAX
, LabelType type = LabelType::kGlobal
, uint32_t parentId = Globals::kInvalidId
)override◆ Creates a new named label.
Reimplemented from asmjit::BaseEmitter.
Binds the label
to the current position of the current section.
Reimplemented from asmjit::BaseEmitter.
Embeds raw data into the CodeBuffer.
Reimplemented from asmjit::BaseEmitter.
1
)override◆ Embeds a typed data array.
This is the most flexible function for embedding data as it allows to:
typeId
to the data, so the emitter knows the type of items stored in data
. Binary data should use TypeId::kUInt8.repeatCount
times, so the data can be used as a fill pattern for example, or as a pattern used by SIMD instructions. Reimplemented from asmjit::BaseEmitter.
Embeds a constant pool at the current offset by performing the following:
pool
alignment.Reimplemented from asmjit::BaseEmitter.
0
)override◆ Embeds an absolute label
address as data.
The dataSize
is an optional argument that can be used to specify the size of the address data. If it's zero (default) the address size is deduced from the target architecture (either 4 or 8 bytes).
Reimplemented from asmjit::BaseEmitter.
0
)override◆ Embeds a delta (distance) between the label
and base
calculating it as label - base
.
This function was designed to make it easier to embed lookup tables where each index is a relative distance of two labels.
Reimplemented from asmjit::BaseEmitter.
SIZE_MAX
)override◆ Emits a comment stored in data
with an optional size
parameter.
Reimplemented from asmjit::BaseEmitter.
Called after the emitter was attached to CodeHolder
.
Reimplemented from asmjit::BaseEmitter.
Reimplemented in asmjit::x86::Assembler.
Called after the emitter was detached from CodeHolder
.
Reimplemented from asmjit::BaseEmitter.
Reimplemented in asmjit::x86::Assembler.
Current section where the assembling happens.
Start of the CodeBuffer of the current section.
End (first invalid byte) of the current section.
Pointer in the CodeBuffer of the current section.