mirror of
https://github.com/open-goal/jak-project
synced 2026-08-09 10:54:39 -04:00
[goalc] reduce compiler memory usage (#2247)
This commit is contained in:
@@ -38,7 +38,12 @@ std::vector<u8> CodeGenerator::run(const TypeSystem* ts) {
|
||||
}
|
||||
auto rec =
|
||||
m_gen.add_function_to_seg(f->segment, &m_debug_info->add_function(f->name(), m_fe->name()));
|
||||
rec.debug->function = f;
|
||||
for (auto& x : f->code_source()) {
|
||||
rec.debug->code_sources.push_back(x.heap_obj);
|
||||
}
|
||||
for (auto& x : f->code()) {
|
||||
rec.debug->ir_strings.push_back(x->print());
|
||||
}
|
||||
}
|
||||
|
||||
// next, add all static objects.
|
||||
@@ -48,14 +53,14 @@ std::vector<u8> CodeGenerator::run(const TypeSystem* ts) {
|
||||
|
||||
// next, add instructions to functions
|
||||
for (size_t i = 0; i < m_fe->functions().size(); i++) {
|
||||
do_function(m_fe->functions().at(i), i);
|
||||
do_function(m_fe->functions().at(i).get(), i);
|
||||
}
|
||||
|
||||
// generate a v3 object.
|
||||
return m_gen.generate_data_v3(ts).to_vector();
|
||||
}
|
||||
|
||||
void CodeGenerator::do_function(const std::shared_ptr<FunctionEnv>& env, int f_idx) {
|
||||
void CodeGenerator::do_function(FunctionEnv* env, int f_idx) {
|
||||
if (env->is_asm_func) {
|
||||
do_asm_function(env, f_idx, env->asm_func_saved_regs);
|
||||
} else {
|
||||
@@ -67,7 +72,7 @@ void CodeGenerator::do_function(const std::shared_ptr<FunctionEnv>& env, int f_i
|
||||
* Add instructions to the function, specified by index.
|
||||
* Generates prologues / epilogues.
|
||||
*/
|
||||
void CodeGenerator::do_goal_function(const std::shared_ptr<FunctionEnv>& env, int f_idx) {
|
||||
void CodeGenerator::do_goal_function(FunctionEnv* env, int f_idx) {
|
||||
bool use_new_xmms = true;
|
||||
auto* debug = &m_debug_info->function_by_name(env->name());
|
||||
|
||||
@@ -275,9 +280,7 @@ void CodeGenerator::do_goal_function(const std::shared_ptr<FunctionEnv>& env, in
|
||||
m_gen.add_instr_no_ir(f_rec, IGen::ret(), InstructionInfo::Kind::EPILOGUE);
|
||||
}
|
||||
|
||||
void CodeGenerator::do_asm_function(const std::shared_ptr<FunctionEnv>& env,
|
||||
int f_idx,
|
||||
bool allow_saved_regs) {
|
||||
void CodeGenerator::do_asm_function(FunctionEnv* env, int f_idx, bool allow_saved_regs) {
|
||||
auto f_rec = m_gen.get_existing_function_record(f_idx);
|
||||
const auto& allocs = env->alloc_result();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user