Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring ast_unit, ast_ctx, ast into dec_ctx #303

Merged
merged 4 commits into from
Sep 26, 2022
Merged

Conversation

frabert
Copy link
Collaborator

@frabert frabert commented Sep 20, 2022

No description provided.

@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3089130199

fizzbuzz.bc

typedefs_of_typedefs.bc

switch_loop.bc

func_cond_zero_arg.bc

fcmp.bc

conflicting_names.bc

struct.bc

issue_183_literal_structs.bc

issue_127_uint128_t_lit.bc

global_using_function_decl.bc

short.bc

init_list.bc

reg_test_structure_fields.bc

ret0.bc

goto_loop.bc

trunc.bc

bitops.bc

cast.bc

nullptr.bc

nested_struct.bc

array_swap.bc

bitmask.bc

binops.bc

float.bc

nested_while.bc

zeroinit.bc

funcptr.bc

struct_swap.bc

branch.bc

vectors.bc

issue_4.bc

conflicting_global.bc

issue_123_uint128_t.bc

fizzbuzz_stateful.bc

issue_94_strncmp.bc

bool.bc

zext.bc

byval_struct.bc

func_cond_two_arg.bc

inttoptr.bc

assert.bc

loop.bc

switch.bc

template_parameter_pack.bc

byval_tail_gep.ll

byval_tail_nogep.ll

@frabert frabert marked this pull request as ready for review September 20, 2022 12:03
@frabert frabert requested a review from surovic September 26, 2022 08:09
Copy link
Contributor

@surovic surovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nitpick. In cases like IRToASTVisitor and I think GenerateAST, where there are functions that used ast a lot, it's probably a good idea to do something like auto ast = dec_ctx.ast; rather than doing a plain search and replace and generating a huge diff and also longer expressions 👀

@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3126650618

fizzbuzz.bc

--- /dev/fd/63	2022-09-26 09:40:15.593380993 +0000
+++ /dev/fd/62	2022-09-26 09:40:15.593380993 +0000
@@ -11,14 +11,15 @@
     var1 = 0U;
     while ((int)var1 < 30)
         {
-            if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
-                if ((int)var1 % 3 != 0U) {
+            if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
+                if ((int)var1 % 3 != 0U && ((int)var1 % 3 != 0U || (int)var1 % 5 != 0U)) {
                     if ((int)var1 % 5 != 0U) {
                         printf("%d\n", var1);
                     } else {
                         printf("buzz\n");
                     }
-                } else {
+                }
+                if ((int)var1 % 3 == 0U && ((int)var1 % 3 != 0U || (int)var1 % 5 != 0U)) {
                     printf("fizz\n");
                 }
             } else {

typedefs_of_typedefs.bc

switch_loop.bc

func_cond_zero_arg.bc

fcmp.bc

conflicting_names.bc

struct.bc

issue_183_literal_structs.bc

issue_127_uint128_t_lit.bc

global_using_function_decl.bc

short.bc

init_list.bc

reg_test_structure_fields.bc

ret0.bc

goto_loop.bc

trunc.bc

bitops.bc

cast.bc

nullptr.bc

nested_struct.bc

array_swap.bc

bitmask.bc

binops.bc

float.bc

nested_while.bc

--- /dev/fd/63	2022-09-26 09:40:18.861330210 +0000
+++ /dev/fd/62	2022-09-26 09:40:18.861330210 +0000
@@ -18,14 +18,14 @@
                 printf("loop1 x: %d\n", var1);
             }
     }
-    if ((int)var1 <= 10 || (int)var1 >= 20) {
+    if ((int)var1 >= 20 || (int)var1 <= 10) {
         while ((int)var1 < 20)
             {
                 var1 = var1 + 1U;
                 printf("loop2 x: %d\n", var1);
             }
     }
-    if ((int)var1 >= 20 && ((int)var1 <= 10 || (int)var1 >= 20)) {
+    if (((int)var1 >= 20 || (int)var1 <= 10) && (int)var1 >= 20) {
         return var0;
     }
 }

zeroinit.bc

funcptr.bc

struct_swap.bc

branch.bc

vectors.bc

issue_4.bc

conflicting_global.bc

issue_123_uint128_t.bc

fizzbuzz_stateful.bc

issue_94_strncmp.bc

bool.bc

zext.bc

byval_struct.bc

func_cond_two_arg.bc

inttoptr.bc

assert.bc

loop.bc

switch.bc

template_parameter_pack.bc

byval_tail_gep.ll

byval_tail_nogep.ll

@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3126699465

fizzbuzz.bc

--- /dev/fd/63	2022-09-26 09:47:30.138880285 +0000
+++ /dev/fd/62	2022-09-26 09:47:30.138880285 +0000
@@ -11,7 +11,7 @@
     var1 = 0U;
     while ((int)var1 < 30)
         {
-            if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
+            if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
                 if ((int)var1 % 3 != 0U) {
                     if ((int)var1 % 5 != 0U) {
                         printf("%d\n", var1);

typedefs_of_typedefs.bc

switch_loop.bc

func_cond_zero_arg.bc

fcmp.bc

conflicting_names.bc

struct.bc

issue_183_literal_structs.bc

issue_127_uint128_t_lit.bc

global_using_function_decl.bc

short.bc

init_list.bc

reg_test_structure_fields.bc

ret0.bc

goto_loop.bc

trunc.bc

bitops.bc

cast.bc

nullptr.bc

nested_struct.bc

array_swap.bc

bitmask.bc

binops.bc

float.bc

nested_while.bc

zeroinit.bc

funcptr.bc

struct_swap.bc

branch.bc

vectors.bc

issue_4.bc

conflicting_global.bc

issue_123_uint128_t.bc

fizzbuzz_stateful.bc

issue_94_strncmp.bc

bool.bc

zext.bc

byval_struct.bc

func_cond_two_arg.bc

inttoptr.bc

assert.bc

loop.bc

switch.bc

template_parameter_pack.bc

byval_tail_gep.ll

byval_tail_nogep.ll

@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3126719012

fizzbuzz.bc

--- /dev/fd/63	2022-09-26 09:50:41.247001929 +0000
+++ /dev/fd/62	2022-09-26 09:50:41.247001929 +0000
@@ -11,7 +11,7 @@
     var1 = 0U;
     while ((int)var1 < 30)
         {
-            if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
+            if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
                 if ((int)var1 % 3 != 0U) {
                     if ((int)var1 % 5 != 0U) {
                         printf("%d\n", var1);

typedefs_of_typedefs.bc

switch_loop.bc

func_cond_zero_arg.bc

fcmp.bc

conflicting_names.bc

struct.bc

issue_183_literal_structs.bc

issue_127_uint128_t_lit.bc

global_using_function_decl.bc

short.bc

init_list.bc

reg_test_structure_fields.bc

ret0.bc

goto_loop.bc

trunc.bc

bitops.bc

cast.bc

nullptr.bc

nested_struct.bc

array_swap.bc

bitmask.bc

binops.bc

float.bc

nested_while.bc

zeroinit.bc

funcptr.bc

struct_swap.bc

branch.bc

vectors.bc

issue_4.bc

conflicting_global.bc

issue_123_uint128_t.bc

fizzbuzz_stateful.bc

issue_94_strncmp.bc

bool.bc

zext.bc

byval_struct.bc

func_cond_two_arg.bc

inttoptr.bc

assert.bc

loop.bc

switch.bc

template_parameter_pack.bc

byval_tail_gep.ll

byval_tail_nogep.ll

@frabert frabert merged commit 05c2835 into master Sep 26, 2022
@frabert frabert deleted the frabert/refactor-ctx branch September 26, 2022 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants