mirror of
https://github.com/open-goal/jak-project
synced 2026-08-14 12:34:36 -04:00
add stack var support
This commit is contained in:
+18
-4
@@ -7,6 +7,7 @@
|
||||
#include "common/type_system/TypeSystem.h"
|
||||
#include "common/util/print_float.h"
|
||||
|
||||
#include "decompiler/IR2/Env.h"
|
||||
#include "decompiler/ObjectFile/LinkedObjectFile.h"
|
||||
#include "decompiler/util/DecompilerTypeSystem.h"
|
||||
#include "decompiler/util/data_decompile.h"
|
||||
@@ -2801,11 +2802,22 @@ 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) {}
|
||||
StackSpillValueElement::StackSpillValueElement(int size,
|
||||
int stack_offset,
|
||||
bool is_signed,
|
||||
std::optional<TypeSpec> read_type)
|
||||
: m_size(size),
|
||||
m_stack_offset(stack_offset),
|
||||
m_is_signed(is_signed),
|
||||
m_read_type(std::move(read_type)) {}
|
||||
|
||||
goos::Object StackSpillValueElement::to_form_internal(const Env& env) const {
|
||||
return pretty_print::to_symbol(env.get_spill_slot_var_name(m_stack_offset));
|
||||
auto var = make_stack_slot_access(m_stack_offset);
|
||||
auto base = pretty_print::to_symbol(env.get_spill_slot_var_name(m_stack_offset));
|
||||
if (m_read_type && env.get_variable_type(var, true) != *m_read_type) {
|
||||
return pretty_print::build_list("the-as", m_read_type->print(), base);
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
void StackSpillValueElement::apply(const std::function<void(FormElement*)>& f) {
|
||||
@@ -2813,7 +2825,9 @@ void StackSpillValueElement::apply(const std::function<void(FormElement*)>& f) {
|
||||
}
|
||||
|
||||
void StackSpillValueElement::apply_form(const std::function<void(Form*)>&) {}
|
||||
void StackSpillValueElement::collect_vars(RegAccessSet&, bool) const {}
|
||||
void StackSpillValueElement::collect_vars(RegAccessSet& vars, bool) const {
|
||||
vars.insert(make_stack_slot_access(m_stack_offset));
|
||||
}
|
||||
void StackSpillValueElement::get_modified_regs(RegSet&) const {}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user