Add decompiler IR, basic operations, all-types file (#57)

* framework for basic op

* started IR framework

* check in type info file

* add some basic operations to the first pass ir conversion

* use a single condition system

* add more basic op decoding

* more ir
This commit is contained in:
water111
2020-09-29 20:24:15 -04:00
committed by GitHub
parent c9b53d51ff
commit 376c273845
37 changed files with 10346 additions and 392 deletions
@@ -483,6 +483,8 @@ void LinkedObjectFile::process_fp_relative_links() {
if (pprev_instr && pprev_instr->kind == InstructionKind::LUI) {
assert(pprev_instr->get_dst(0).get_reg() == offset_reg);
additional_offset = (1 << 16) * pprev_instr->get_imm_src().get_imm();
pprev_instr->get_imm_src().set_label(
get_label_id_for(seg, current_fp + atom.get_imm() + additional_offset));
}
atom.set_label(
get_label_id_for(seg, current_fp + atom.get_imm() + additional_offset));
@@ -554,6 +556,12 @@ std::string LinkedObjectFile::print_disassembly() {
auto& word = words_by_seg[seg].at(func.start_word + i);
append_word_to_string(result, word);
} else {
if (func.has_basic_ops() && func.instr_starts_basic_op(i)) {
if (line.length() < 40) {
line.append(40 - line.length(), ' ');
}
line += ";; " + func.get_basic_op_at_instr(i)->print(*this);
}
result += line + "\n";
}