[Decompiler] Implement IR2 Type Analysis Pass (#193)

* type analysis setup

* more framework

* update printing

* wip

* add type analysis pass

* fix tests
This commit is contained in:
water111
2021-01-10 20:46:49 -05:00
committed by GitHub
parent 45d37733a8
commit fe693b5da2
19 changed files with 1358 additions and 103 deletions
+2 -1
View File
@@ -418,7 +418,8 @@ TEST(DecompilerAtomicOpBuilder, DSUBU_DADDIU_MOVZ) {
TEST(DecompilerAtomicOpBuilder, JALR_SLL) {
test_case(assembly_from_list({"jalr ra, t9", "sll v0, ra, 0"}), {"(call!)"}, {{}}, {{"t9"}},
{{}});
{{"a0", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9",
"at", "v1"}});
}
TEST(DecompilerAtomicOpBuilder, LB) {
+6
View File
@@ -196,6 +196,12 @@ TEST(TypeSystem, AddMethodAndLookupMethod) {
EXPECT_EQ(ts.lookup_method("basic", "test-method-1").defined_in_type, "structure");
EXPECT_EQ(ts.lookup_method("basic", "test-method-1").type.print(), "(function integer string)");
EXPECT_EQ(ts.lookup_method("basic", "test-method-1").name, "test-method-1");
auto id = ts.lookup_method("basic", "test-method-1").id;
MethodInfo info;
EXPECT_TRUE(ts.try_lookup_method("basic", id, &info));
EXPECT_FALSE(ts.try_lookup_method("not-a-real-type-name", id, &info));
EXPECT_FALSE(ts.try_lookup_method("basic", id * 2, &info));
}
TEST(TypeSystem, NewMethod) {