File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -153,5 +153,12 @@ std::vector<std::shared_ptr<basic_block>> generate_basic_blocks(block::stmt_bloc
153153 }
154154 }
155155
156+ // step 5: populate the predecessors
157+ for (auto bb: return_list) {
158+ for (auto succ: bb->successor ) {
159+ succ->predecessor .push_back (bb);
160+ }
161+ }
162+
156163 return return_list;
157164}
Original file line number Diff line number Diff line change @@ -133,7 +133,11 @@ void loop_finder::visit(stmt_block::Ptr a) {
133133
134134 std::cout << " ++++++ basic blocks ++++++ \n " ;
135135 for (auto bb: BBs) {
136- std::cout << bb->name << " :" << " \n " ;
136+ std::cout << bb->name << " :" << " ; " ;
137+ for (auto pred: bb->predecessor ) {
138+ std::cout << pred->name << " , " ;
139+ }
140+ std::cout << " \n " ;
137141 if (bb->branch_expr ) {
138142 std::cout << " " ;
139143 bb->branch_expr ->dump (std::cout, 0 );
You can’t perform that action at this time.
0 commit comments