Files
jak-project/goalc/compiler/CodeGenerator.h
T
Parker de25f39439 arm64: Apple Silicon support (#4390)
Got OpenGOAL building and running natively on Apple Silicon.

This is the rest of the port after the smaller arm64 emitter PRs. I was
told pushing one big PR was okay. This covers goalc, the runtime,
linker, kernel and the GOAL asm.

The new paths have native tests. I also found four more emitter bugs
while running it. They're in scalar sqrt, 128-bit stores, scalar max and
indexed stores above 4 GB.

Spent a while cleaning it up so it's easier to read. 4am gotta sleep lol

Closes #3841

---------

Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2026-08-24 23:22:47 -04:00

37 lines
1.0 KiB
C++

/*!
* @file CodeGenerator.h
* Generate object files from a FileEnv using an emitter::ObjectGenerator.
* Populates a DebugInfo.
* Currently owns the logic for emitting the function prologues.
*/
#pragma once
#include "Env.h"
#include "common/versions/versions.h"
#include "goalc/emitter/ObjectGenerator.h"
class DebugInfo;
class TypeSystem;
class CodeGenerator {
public:
CodeGenerator(FileEnv* env,
DebugInfo* debug_info,
GameVersion version,
emitter::InstructionSet instruction_set);
std::vector<u8> run(const TypeSystem* ts);
emitter::ObjectGeneratorStats get_obj_stats() const { return m_gen.get_stats(); }
private:
void do_function(FunctionEnv* env, int f_idx);
void do_goal_function_x86(FunctionEnv* env, int f_idx);
void do_goal_function_arm64(FunctionEnv* env, int f_idx);
void do_asm_function(FunctionEnv* env, int f_idx, bool allow_saved_regs);
emitter::ObjectGenerator m_gen;
FileEnv* m_fe = nullptr;
DebugInfo* m_debug_info = nullptr;
};