mirror of
https://github.com/open-goal/jak-project
synced 2026-09-01 01:52:03 -04:00
clean up casts around conds with elses (#904)
This commit is contained in:
@@ -3345,6 +3345,9 @@ void CondNoElseElement::push_to_stack(const Env& env, FormPool& pool, FormStack&
|
||||
stack.push_value_to_reg(write_as_value, as_ppointer_to_process, true,
|
||||
env.get_variable_type(final_destination, false));
|
||||
} else {
|
||||
// fmt::print("func {} final destination {} type {}\n", env.func->name(),
|
||||
// final_destination.to_string(env),
|
||||
// env.get_variable_type(final_destination, false).print());
|
||||
stack.push_value_to_reg(write_as_value, pool.alloc_single_form(nullptr, this), true,
|
||||
env.get_variable_type(final_destination, false));
|
||||
}
|
||||
@@ -3437,7 +3440,9 @@ void CondWithElseElement::push_to_stack(const Env& env, FormPool& pool, FormStac
|
||||
rewrite_as_set = false;
|
||||
break;
|
||||
}
|
||||
source_types.push_back(last_in_body->src_type());
|
||||
// note: we use the dest type here because the rewrite will leave behind a cast to this.
|
||||
auto type = env.get_variable_type(last_in_body->dst(), true);
|
||||
source_types.push_back(type);
|
||||
}
|
||||
last_var = last_in_body->dst();
|
||||
}
|
||||
@@ -3507,10 +3512,12 @@ void CondWithElseElement::push_to_stack(const Env& env, FormPool& pool, FormStac
|
||||
// (set! x (if y z (expr))) and z requires a cast, but the move from z to x is
|
||||
// eliminated by GOAL's register allocator.
|
||||
|
||||
// fmt::print("checking:\n");
|
||||
// for (auto& t : source_types) {
|
||||
// fmt::print(" {}\n", t.print());
|
||||
// }
|
||||
// fmt::print("func: {}\n", env.func->name());
|
||||
|
||||
// fmt::print("checking:\n");
|
||||
// for (auto& t : source_types) {
|
||||
// fmt::print(" {}\n", t.print());
|
||||
// }
|
||||
|
||||
auto expected_type = env.get_variable_type(*last_var, true);
|
||||
// fmt::print("The expected type is {}\n", expected_type.print());
|
||||
|
||||
Reference in New Issue
Block a user