[Decompiler] Remove most IR1 Analysis (#207)

* temp

* remove some of ir1
This commit is contained in:
water111
2021-01-22 22:03:58 -05:00
committed by GitHub
parent 8135c18e91
commit 4a97e15b40
21 changed files with 6 additions and 4105 deletions
@@ -769,76 +769,6 @@ std::string LinkedObjectFile::print_disassembly() {
return result;
}
std::string LinkedObjectFile::print_type_analysis_debug() {
std::string result;
assert(segments <= 3);
for (int seg = segments; seg-- > 0;) {
// segment header
result += ";------------------------------------------\n; ";
result += segment_names[seg];
result += "\n;------------------------------------------\n\n";
// functions
for (auto& func : functions_by_seg.at(seg)) {
result += ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n";
result += "; .function " + func.guessed_name.to_string() + "\n";
result += ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n";
if (!func.warnings.empty()) {
result += ";; WARNING:\n" + func.warnings + "\n";
}
for (auto& block : func.basic_blocks) {
result += "\n";
if (!block.label_name.empty()) {
result += block.label_name + ":\n";
}
TypeState* init_types = &block.init_types;
for (int i = block.start_basic_op; i < block.end_basic_op; i++) {
result += " ";
// result += func.basic_ops.at(i)->print_with_reguse(*this);
// result += func.basic_ops.at(i)->print(*this);
if (func.attempted_type_analysis) {
result += fmt::format("[{:3d}] ", i);
auto& op = func.basic_ops.at(i);
result += op->print_with_types(*init_types, *this);
// temporary debug load path print
auto op_as_set = dynamic_cast<IR_Set_Atomic*>(op.get());
if (op_as_set) {
auto op_as_load = dynamic_cast<IR_Load*>(op_as_set->src.get());
if (op_as_load && op_as_load->load_path_set) {
if (op_as_load->load_path_addr_of) {
result += " (&->";
} else {
result += " (->";
}
result += ' ';
result += op_as_load->load_path_base->print(*this);
for (auto& tok : op_as_load->load_path) {
result += ' ';
result += tok;
}
result += ')';
}
}
result += "\n";
init_types = &func.basic_ops.at(i)->end_types;
} else {
result += fmt::format("[{:3d}] ", i);
result += func.basic_ops.at(i)->print(*this);
result += "\n";
}
}
}
}
}
return result;
}
/*!
* Hacky way to get a GOAL string object
*/