Aarch64 IR backend#931
Closed
bmdhacks wants to merge 70 commits into
Closed
Conversation
Adds an AArch64 codegen backend that plugs into the new IR pipeline
(jit.c -> jit_regs.c -> jit_aarch64.c), mirroring the role of
jit_x86_64.c. Targets Linux AAPCS64 (with the hooks needed for Apple
ARM64 ABI: X16/X17 reserved, 16-byte stack-arg packing).
Backend surface:
hl_jit_init_regs AAPCS64 register classes (X0..X15 scratch
minus X16/X17, X19..X28 persist; V0..V7
scratch+arg, V8..V15 persist, V16..V31 scratch)
hl_codegen_init module preamble: null-access stubs, c2hl/hl2c
trampolines
hl_codegen_function IR einstr stream -> AArch64 machine code
hl_codegen_flush_consts ADRP+LDR patching for the per-module pool
(distinguishes LDR Xt/Dt/St for correct imm12
scaling)
hl_codegen_final BL relocations, jump-table absolute fixups
Encoding layer (jit_aarch64_emit.c/h) supplies the instruction encoders
shared with the trampolines.
regs_config gains a stack_arg_size field so the IR's stack-argument
accounting agrees with the backend's 16-byte-per-push convention
required by AAPCS64 stack alignment.
module.c: on AArch64, walk the X29 frame-pointer chain in
module_capture_stack instead of the heuristic stack scanner. The
scanner produces false-positive frames from callee-saved STP X19,X20
spills that look like (stack_addr, code_addr) pairs.
Build: CMake selects src/jit_aarch64.c when the target processor is
aarch64/arm64; the Makefile gains an ARCH=arm64 branch.
Validated against unit.hl with all tests passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Correct PR here: #932