diff options
author | Matt Turner <[email protected]> | 2014-07-11 22:31:39 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-08-18 18:56:30 -0700 |
commit | 596990d91e2a4c4a3a303c6c2da623bf1840771b (patch) | |
tree | 7b5c73946e88aebe1110ccbcad2654bd4f9c5dac /src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp | |
parent | d688667c7f8ab69b079b7c85dccc2b70e5863e32 (diff) |
i965: Add and use foreach_block macro.
Use this as an opportunity to rename 'block_num' to 'num'. block->num is
clear, and block->block_num has always been redundant.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp index 57f3ce47837..c964505c414 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp @@ -100,8 +100,8 @@ fs_live_variables::setup_one_read(bblock_t *block, fs_inst *inst, * channel) without having completely defined that variable within the * block. */ - if (!BITSET_TEST(bd[block->block_num].def, var)) - BITSET_SET(bd[block->block_num].use, var); + if (!BITSET_TEST(bd[block->num].def, var)) + BITSET_SET(bd[block->num].use, var); } void @@ -118,8 +118,8 @@ fs_live_variables::setup_one_write(bblock_t *block, fs_inst *inst, * screens off previous updates of that variable (VGRF channel). */ if (inst->dst.file == GRF && !inst->is_partial_write()) { - if (!BITSET_TEST(bd[block->block_num].use, var)) - BITSET_SET(bd[block->block_num].def, var); + if (!BITSET_TEST(bd[block->num].use, var)) + BITSET_SET(bd[block->num].def, var); } } @@ -137,12 +137,10 @@ fs_live_variables::setup_def_use() { int ip = 0; - for (int b = 0; b < cfg->num_blocks; b++) { - bblock_t *block = cfg->blocks[b]; - + foreach_block (block, cfg) { assert(ip == block->start_ip); - if (b > 0) - assert(cfg->blocks[b - 1]->end_ip == ip - 1); + if (block->num > 0) + assert(cfg->blocks[block->num - 1]->end_ip == ip - 1); foreach_inst_in_block(fs_inst, inst, block) { /* Set use[] for this instruction */ @@ -186,26 +184,27 @@ fs_live_variables::compute_live_variables() while (cont) { cont = false; - for (int b = 0; b < cfg->num_blocks; b++) { + foreach_block (block, cfg) { /* Update livein */ for (int i = 0; i < bitset_words; i++) { - BITSET_WORD new_livein = (bd[b].use[i] | - (bd[b].liveout[i] & ~bd[b].def[i])); - if (new_livein & ~bd[b].livein[i]) { - bd[b].livein[i] |= new_livein; + BITSET_WORD new_livein = (bd[block->num].use[i] | + (bd[block->num].liveout[i] & + ~bd[block->num].def[i])); + if (new_livein & ~bd[block->num].livein[i]) { + bd[block->num].livein[i] |= new_livein; cont = true; } } /* Update liveout */ - foreach_list_typed(bblock_link, link, link, &cfg->blocks[b]->children) { - bblock_t *block = link->block; + foreach_list_typed(bblock_link, child_link, link, &block->children) { + bblock_t *child = child_link->block; for (int i = 0; i < bitset_words; i++) { - BITSET_WORD new_liveout = (bd[block->block_num].livein[i] & - ~bd[b].liveout[i]); + BITSET_WORD new_liveout = (bd[child->num].livein[i] & + ~bd[block->num].liveout[i]); if (new_liveout) { - bd[b].liveout[i] |= new_liveout; + bd[block->num].liveout[i] |= new_liveout; cont = true; } } @@ -221,16 +220,16 @@ fs_live_variables::compute_live_variables() void fs_live_variables::compute_start_end() { - for (int b = 0; b < cfg->num_blocks; b++) { + foreach_block (block, cfg) { for (int i = 0; i < num_vars; i++) { - if (BITSET_TEST(bd[b].livein, i)) { - start[i] = MIN2(start[i], cfg->blocks[b]->start_ip); - end[i] = MAX2(end[i], cfg->blocks[b]->start_ip); + if (BITSET_TEST(bd[block->num].livein, i)) { + start[i] = MIN2(start[i], block->start_ip); + end[i] = MAX2(end[i], block->start_ip); } - if (BITSET_TEST(bd[b].liveout, i)) { - start[i] = MIN2(start[i], cfg->blocks[b]->end_ip); - end[i] = MAX2(end[i], cfg->blocks[b]->end_ip); + if (BITSET_TEST(bd[block->num].liveout, i)) { + start[i] = MIN2(start[i], block->end_ip); + end[i] = MAX2(end[i], block->end_ip); } } |