summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_cfg.cpp
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2014-05-17 11:53:45 -0700
committerMatt Turner <mattst88@gmail.com>2014-05-24 23:03:22 -0700
commitdd0e1c3aff0193bc130161e6f4d13042a7d83bae (patch)
treefefbb15f4b154ca9adeb51c6814244e28dc90e40 /src/mesa/drivers/dri/i965/brw_cfg.cpp
parent04ce3be4010305902cc5ae81e8e0c8550d043a1e (diff)
downloadexternal_mesa3d-dd0e1c3aff0193bc130161e6f4d13042a7d83bae.zip
external_mesa3d-dd0e1c3aff0193bc130161e6f4d13042a7d83bae.tar.gz
external_mesa3d-dd0e1c3aff0193bc130161e6f4d13042a7d83bae.tar.bz2
i965/cfg: Make DO instruction begin a basic block.
The DO instruction doesn't exist on Gen6+. Since before this commit, DO always ended a basic block, if it also happened to start one (e.g., a while loop inside an if statement) the block containing only the DO would actually contain no hardware instructions. Pre-Gen6's WHILE instructions jumps to the instruction following the DO, so strictly speaking we won't be modeling that properly, but I claim there is actually no functional difference. This will simplify an upcoming change where we want to mark the first hardware instruction in the loop as beginning a block, and the last instruction before the loop as ending one. Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_cfg.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_cfg.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index a806714..6bf99f1 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -98,7 +98,7 @@ cfg_t::cfg_t(exec_list *instructions)
bblock_t *cur_if = NULL; /**< BB ending with IF. */
bblock_t *cur_else = NULL; /**< BB ending with ELSE. */
bblock_t *cur_endif = NULL; /**< BB starting with ENDIF. */
- bblock_t *cur_do = NULL; /**< BB ending with DO. */
+ bblock_t *cur_do = NULL; /**< BB starting with DO. */
bblock_t *cur_while = NULL; /**< BB immediately following WHILE. */
exec_list if_stack, else_stack, do_stack, while_stack;
bblock_t *next;
@@ -205,15 +205,18 @@ cfg_t::cfg_t(exec_list *instructions)
*/
cur_while = new_block();
- /* Set up our immediately following block, full of "then"
- * instructions.
- */
- next = new_block();
- next->start = (backend_instruction *)inst->next;
- cur->add_successor(mem_ctx, next);
- cur_do = next;
+ if (cur->start == inst) {
+ /* New block was just created; use it. */
+ cur_do = cur;
+ } else {
+ cur_do = new_block();
+ cur_do->start = inst;
- set_next_block(&cur, next, ip);
+ cur->end = (backend_instruction *)inst->prev;
+ cur->add_successor(mem_ctx, cur_do);
+
+ set_next_block(&cur, cur_do, ip - 1);
+ }
break;
case BRW_OPCODE_CONTINUE: