File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class basic_block {
1414 cfg_block successor;
1515 block::expr::Ptr branch_expr;
1616 block::stmt::Ptr parent;
17- unsigned int index ;
17+ unsigned int ast_index ;
1818 unsigned int id;
1919 std::string name;
2020};
Original file line number Diff line number Diff line change @@ -9,10 +9,11 @@ basic_block::cfg_block generate_basic_blocks(block::stmt_block::Ptr ast) {
99 int basic_block_count = 0 ;
1010
1111 // step 1: fill the work_list
12+ unsigned int ast_index_counter = 0 ;
1213 for (auto st: ast->stmts ) {
1314 auto bb = std::make_shared<basic_block>(std::to_string (basic_block_count));
1415 bb->parent = st;
15- // bb->index = ;
16+ bb->ast_index = ast_index_counter++ ;
1617 work_list.push_back (bb);
1718 basic_block_count++;
1819 }
@@ -27,6 +28,7 @@ basic_block::cfg_block generate_basic_blocks(block::stmt_block::Ptr ast) {
2728 auto bb = work_list.front ();
2829
2930 if (isa<block::stmt_block>(bb->parent )) {
31+ ast_index_counter = 0 ;
3032 stmt_block::Ptr stmt_block_ = to<stmt_block>(bb->parent );
3133 bb->name = " stmt" + bb->name ;
3234
@@ -37,6 +39,7 @@ basic_block::cfg_block generate_basic_blocks(block::stmt_block::Ptr ast) {
3739 for (auto st: stmt_block_->stmts ) {
3840 stmt_block_list.push_back (std::make_shared<basic_block>(std::to_string (basic_block_count++)));
3941 stmt_block_list.back ()->parent = st;
42+ stmt_block_list.back ()->ast_index = ast_index_counter++;
4043 }
4144
4245 // set the basic block successors
You can’t perform that action at this time.
0 commit comments