[decompiler] handle pointer to symbol value, clean up prints on offline test (#1978)

- fix issue described in
https://github.com/open-goal/jak-project/issues/1939
- fix `text`, which was manually patched with the wrong offset (was
reading the symbol value off by one byte)
- clean up some random useless prints
- make the offline tests keep trying if there's a comparison error,
clean up the output a bit so the diffs are all at the end.
This commit is contained in:
water111
2022-10-16 18:19:59 -04:00
committed by GitHub
parent e7bb0fb68d
commit ddd60fca48
21 changed files with 291 additions and 509 deletions
+13 -10
View File
@@ -30,6 +30,8 @@ std::string InstructionAtom::to_string(const std::vector<DecompilerLabel>& label
return "Q";
case IMM_SYM:
return sym;
case IMM_SYM_VAL_PTR:
return sym;
case VF_FIELD:
ASSERT(imm >= 0 && imm < 4);
return fmt::format(".{}", "xyzw"[imm]);
@@ -79,9 +81,17 @@ void InstructionAtom::set_vu_q() {
/*!
* Make this atom a symbol.
*/
void InstructionAtom::set_sym(std::string _sym) {
void InstructionAtom::set_sym(const std::string& _sym) {
kind = IMM_SYM;
sym = std::move(_sym);
sym = _sym;
}
/*!
* Make this atom a symbol value pointer.
*/
void InstructionAtom::set_sym_val_ptr(const std::string& _sym) {
kind = IMM_SYM_VAL_PTR;
sym = _sym;
}
/*!
@@ -129,17 +139,10 @@ int InstructionAtom::get_label() const {
* Get as symbol, or error if not a symbol.
*/
std::string InstructionAtom::get_sym() const {
ASSERT(kind == IMM_SYM);
ASSERT(kind == IMM_SYM || kind == IMM_SYM_VAL_PTR);
return sym;
}
/*!
* True if this atom is some sort of constant that doesn't involve linking.
*/
bool InstructionAtom::is_link_or_label() const {
return kind == IMM_SYM || kind == LABEL;
}
bool InstructionAtom::operator==(const InstructionAtom& other) const {
if (kind != other.kind) {
return false;