Files
jak-project/goalc/compiler/CodeGenerator.h
T
water111 aa58d146c2 [goalc] register allocator v2 (#731)
* clean up allocator interface to be simpler

* working on functions without spills

* working for all

* fix missing includes for windows

* more windows includes

* initialize regs to zero so printing value unintiailized by game code is repeatable
2021-08-01 17:46:55 -04:00

30 lines
816 B
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 "goalc/emitter/ObjectGenerator.h"
class DebugInfo;
class TypeSystem;
class CodeGenerator {
public:
CodeGenerator(FileEnv* env, DebugInfo* debug_info);
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(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;
};