Cleanup for correctly assigning bbs when tinkering with IRs.
authorDavid Given <dg@cowlark.com>
Mon, 12 Dec 2016 22:55:24 +0000 (23:55 +0100)
committerDavid Given <dg@cowlark.com>
Mon, 12 Dec 2016 22:55:24 +0000 (23:55 +0100)
mach/proto/mcg/build.lua
mach/proto/mcg/pass_groupirs.c
mach/proto/mcg/pass_returnvalues.c
mach/proto/mcg/pass_splitcriticaledges.c

index 387d14d..a2ed528 100644 (file)
@@ -44,7 +44,7 @@ definerule("build_mcg",
                                "util/mcgg+lib",
                                headers,
                                tables, -- for .h file
-                       }
+                       },
                }
        end
 )
index 57b850a..c126a1d 100644 (file)
@@ -28,6 +28,7 @@ static void collect_irs(void)
                {
                        struct ir* ir = bb->irs.item[j];
             addall(ir);
+                       ir->bb = bb;
                        array_append(&rootirs, ir);
                }
     }
@@ -63,6 +64,7 @@ static void recursively_mark_root(struct ir* node, struct ir* root)
                if (node->root)
                        return;
                node->root = root;
+               node->bb = root->bb;
        }
 
        if (node->left)
index 3be8014..ae5c8df 100644 (file)
@@ -74,6 +74,7 @@ static void find_call(struct basicblock* bb, int index, struct ir* lfr,
         struct ir* phi = new_ir0(IR_PHI, lfr->size);
 
         phi->root = phi;
+        phi->bb = bb;
         array_insert(&bb->irs, phi, 0);
 
         for (i=0; i<bb->prevs.count; i++)
index 27e832e..ffafe9e 100644 (file)
@@ -41,6 +41,7 @@ static void split_edge(struct basicblock* source, struct basicblock* sink)
                );
 
     jump->root = jump->left->root = jump;
+       jump->bb = jump->left->bb = bb;
        array_append(&bb->irs, jump);
 
        rwp.find = sink;