i965/vec4: Use foreach_inst_in_block a couple more places.
authorMatt Turner <mattst88@gmail.com>
Sat, 12 Jul 2014 18:21:21 +0000 (11:21 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 21 Jul 2014 17:35:41 +0000 (10:35 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4_cse.cpp

index 49a4e9b62742118c8a53b92f0512c828dc764021..045e1c5d413e1b529bf68f2911359fe89f375892 100644 (file)
@@ -755,14 +755,11 @@ vec4_visitor::opt_set_dependency_control()
 
    for (int i = 0; i < cfg->num_blocks; i++) {
       bblock_t *bblock = cfg->blocks[i];
-      vec4_instruction *inst;
 
       memset(last_grf_write, 0, sizeof(last_grf_write));
       memset(last_mrf_write, 0, sizeof(last_mrf_write));
 
-      for (inst = (vec4_instruction *)bblock->start;
-           inst != (vec4_instruction *)bblock->end->next;
-           inst = (vec4_instruction *)inst->next) {
+      foreach_inst_in_block (vec4_instruction, inst, bblock) {
          /* If we read from a register that we were doing dependency control
           * on, don't do dependency control across the read.
           */
index 86360d25d2abfa0bf1c2a9c211e07ea07806f3d0..29d2e026205bbcb9b98096512d4ce2d6fdd761a1 100644 (file)
@@ -132,10 +132,7 @@ vec4_visitor::opt_cse_local(bblock_t *block)
    void *cse_ctx = ralloc_context(NULL);
 
    int ip = block->start_ip;
-   for (vec4_instruction *inst = (vec4_instruction *)block->start;
-        inst != block->end->next;
-        inst = (vec4_instruction *) inst->next) {
-
+   foreach_inst_in_block (vec4_instruction, inst, block) {
       /* Skip some cases. */
       if (is_expression(inst) && !inst->predicate && inst->mlen == 0 &&
           (inst->dst.file != HW_REG || inst->dst.is_null()))