Machine Code Generation for C++
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
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
offsetcannot 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.
Creates a new label.
SIZE_MAX, uint32_t type =
Label::kTypeGlobal, uint32_t parentId =
Creates a new named label.
label to the current position of the current section.
Embeds a typed data array.
This is the most flexible function for embedding data as it allows to:
typeIdto the data, so the emitter knows the type of items stored in
data. Binary data should use Type::kIdU8.
repeatCounttimes, so the data can be used as a fill pattern for example, or as a pattern used by SIMD instructions.
Embeds a constant pool at the current offset by performing the following:
Embeds an absolute
label address as data.
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).
Embeds a delta (distance) between the
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.
Emits a comment stored in
data with an optional
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.