v3.gen.arm64 #
ARM64 Instruction Encoding Helpers These functions provide type-safe instruction encoding for the ARM64 backend.
fn Gen.new #
fn Gen.new(m &ssa.Module) &Gen
new creates a Gen value for arm64.
fn MachOObject.new #
fn MachOObject.new() &MachOObject
new creates a MachOObject value for arm64.
struct Gen #
struct Gen {
mut:
m &ssa.Module = unsafe { nil }
macho &MachOObject = unsafe { nil }
text_words []u32
stack_offsets []i32
alloca_offsets []i32
alloca_sizes []i32
alloca_alignments []i32
slot_value_indices []int
slot_value_base int
slot_value_count int
stack_size int
transient_stack_size int
block_offsets []i32
block_offset_indices []int
block_offset_base int
block_offset_count int
pending_jmps []PendingJmp
fn_offsets map[string]int
string_cache map[string]int
cur_func_ret_type ssa.TypeID
cur_func_sret_offset int
}
Gen stores state for ARM64 code generation.
fn (Gen) gen #
fn (mut g Gen) gen()
gen supports gen handling for Gen.
fn (Gen) gen_parallel #
fn (mut g Gen) gen_parallel()
gen_parallel emits independent contiguous function ranges concurrently and merges their text, symbols, strings, and relocations in source order.
fn (Gen) write_and_link #
fn (mut g Gen) write_and_link(output string)
write_and_link writes and link output for arm64.
struct MachOObject #
struct MachOObject {
pub mut:
text_data []u8
str_data []u8
data_data []u8
relocs []RelocationInfo
symbols []Symbol
str_table []u8
sym_by_name map[string]int // symbol name → index in symbols
}
MachOObject represents mach oobject data used by arm64.
fn (MachOObject) add_symbol #
fn (mut m MachOObject) add_symbol(name string, addr u64, is_ext bool, sect u8) int
add_symbol updates add symbol state for MachOObject.
fn (MachOObject) add_undefined #
fn (mut m MachOObject) add_undefined(name string) int
add_undefined updates add undefined state for MachOObject.
fn (MachOObject) add_reloc #
fn (mut m MachOObject) add_reloc(addr int, sym_idx int, typ int, pcrel bool)
add_reloc updates add reloc state for MachOObject.
fn (MachOObject) write #
fn (mut m MachOObject) write(path string)
write supports write handling for MachOObject.