mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 15:28:58 -04:00
[Decompiler] WIP: Stack Spills (#382)
* set up types * cleaned up type analysis and got things working through atomic ops * expression working, need types * improved types and names * getting close * finish up dma-disasm * fix
This commit is contained in:
@@ -2291,6 +2291,52 @@ void VectorFloatLoadStoreElement::collect_vf_regs(RegSet& regs) const {
|
||||
regs.insert(m_vf_reg);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// StackSpillStoreElement
|
||||
////////////////////////////////
|
||||
|
||||
StackSpillStoreElement::StackSpillStoreElement(RegisterAccess value,
|
||||
int size,
|
||||
int stack_offset,
|
||||
const std::optional<TypeSpec>& cast_type)
|
||||
: m_value(value), m_size(size), m_stack_offset(stack_offset), m_cast_type(cast_type) {}
|
||||
|
||||
goos::Object StackSpillStoreElement::to_form_internal(const Env& env) const {
|
||||
return pretty_print::build_list(
|
||||
fmt::format("set! {}", env.get_spill_slot_var_name(m_stack_offset)), m_value.to_form(env));
|
||||
}
|
||||
|
||||
void StackSpillStoreElement::apply(const std::function<void(FormElement*)>& f) {
|
||||
f(this);
|
||||
}
|
||||
|
||||
void StackSpillStoreElement::apply_form(const std::function<void(Form*)>&) {}
|
||||
|
||||
void StackSpillStoreElement::collect_vars(RegAccessSet& vars, bool) const {
|
||||
vars.insert(m_value);
|
||||
}
|
||||
|
||||
void StackSpillStoreElement::get_modified_regs(RegSet&) const {}
|
||||
|
||||
////////////////////////////////
|
||||
// StackSpillValueElement
|
||||
////////////////////////////////
|
||||
|
||||
StackSpillValueElement::StackSpillValueElement(int size, int stack_offset, bool is_signed)
|
||||
: m_size(size), m_stack_offset(stack_offset), m_is_signed(is_signed) {}
|
||||
|
||||
goos::Object StackSpillValueElement::to_form_internal(const Env& env) const {
|
||||
return pretty_print::to_symbol(env.get_spill_slot_var_name(m_stack_offset));
|
||||
}
|
||||
|
||||
void StackSpillValueElement::apply(const std::function<void(FormElement*)>& f) {
|
||||
f(this);
|
||||
}
|
||||
|
||||
void StackSpillValueElement::apply_form(const std::function<void(Form*)>&) {}
|
||||
void StackSpillValueElement::collect_vars(RegAccessSet&, bool) const {}
|
||||
void StackSpillValueElement::get_modified_regs(RegSet&) const {}
|
||||
|
||||
////////////////////////////////
|
||||
// Utilities
|
||||
////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user