8000
Skip to content

goalc: Get CodeTester tests passing on Arm64 (only testing on macOS atm)#3290

Merged
xTVaser merged 26 commits 10000 intoopen-goal:masterfrom
xTVaser:v/arm-work-2
Mar 31, 2026
Merged

goalc: Get CodeTester tests passing on Arm64 (only testing on macOS atm)#3290
xTVaser merged 26 commits intoopen-goal:masterfrom
xTVaser:v/arm-work-2

Conversation

@xTVaser
Copy link
Copy Markdown
Member
@xTVaser xTVaser commented Jan 3, 2024

This PR does the following:

  • Designs a mechanism by which arm64 instructions can be encoded and emitted
  • Dispatch our higher-level instruction emitting calls to either x86 or arm64 instructions depending on what the compiler is set to (defaults to x86)
  • Bare minimum scaffolding to get the arm64 instructions successfully executing atleast on apple silicon
  • Implement enough instructions to get the codetester test suite passing on arm

@xTVaser xTVaser changed the title goalc: Some more MacOS ARM64 work goalc: Some more macOS ARM64 work Jan 4, 2024
@xTVaser xTVaser marked this pull request as ready for review January 6, 2024 22:19
@xTVaser xTVaser requested a review from water111 January 9, 2024 21:51
Copy link
Copy Markdown
Collaborator
@water111 water111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I think this is a good start.

My main concern at this point is that ARM is actually quite a bit different from x86, so it will be hard to fit the ARM instructions into the existing pattern. I also think that using ifdefs to change between arm/x86 code generation will make it harder to maintain.

I'm looking through the compiler code now, and I'm wondering if we should just do the division at the codegen_object_file level - just totally new code for x86 and ARM at that point. We'll need a new linking format, different logic for picking instructions, different function prologues/epilogues, etc. With this approach, we'd probably want each IR to support an do_codegen_x86 and do_codegen_arm version, which would give a x86Instruction on x86 or ArmInstruction on ARM. I haven't thought this through fully yet.

Comment thread goalc/compiler/CodeGenerator.cpp Outdated
Comment thread goalc/compiler/CodeGenerator.cpp Outdated
Comment thread goalc/compiler/IR.cpp Outdated
Comment thread goalc/compiler/compilation/Function.cpp Outdated
Comment thread goalc/debugger/disassemble.h Outdated
Comment thread goalc/emitter/CodeTester.cpp Outdated
Comment thread goalc/emitter/CodeTester.cpp
Comment thread goalc/emitter/IGen.h Outdated
Comment thread goalc/emitter/IGenX86.cpp
Comment thread goalc/emitter/IGenX86.cpp Outdated
@xTVaser xTVaser marked this pull request as draft February 17, 2024 18:38
@xTVaser xTVaser changed the title goalc: Some more macOS ARM64 work goalc: Get CodeTester tests passing on Arm64 (only testing on macOS atm) Mar 17, 2026
@xTVaser xTVaser marked this pull request as ready for review March 17, 2026 05:46
@xTVaser xTVaser merged commit 64bcd8c into open-goal:master Mar 31, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants

0