i965: Use typed foreach_in_list_safe instead of foreach_list_safe.
authorMatt Turner <mattst88@gmail.com>
Tue, 24 Jun 2014 23:31:38 +0000 (16:31 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 1 Jul 2014 15:55:51 +0000 (08:55 -0700)
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
src/mesa/drivers/dri/i965/brw_fs_cse.cpp
src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
src/mesa/drivers/dri/i965/intel_resolve_map.c

index 4be9161659df354b0eb3f22ea6d570623a12fa90..5a3d1d3125cc4c844a13593dd2f81eabf61489b4 100644 (file)
@@ -1800,9 +1800,7 @@ fs_visitor::move_uniform_array_access_to_pull_constants()
     * Note that we don't move constant-indexed accesses to arrays.  No
     * testing has been done of the performance impact of this choice.
     */
-   foreach_list_safe(node, &this->instructions) {
-      fs_inst *inst = (fs_inst *)node;
-
+   foreach_in_list_safe(fs_inst, inst, &instructions) {
       for (int i = 0 ; i < inst->sources; i++) {
          if (inst->src[i].file != UNIFORM || !inst->src[i].reladdr)
             continue;
@@ -2079,9 +2077,7 @@ fs_visitor::compute_to_mrf()
 
    calculate_live_intervals();
 
-   foreach_list_safe(node, &this->instructions) {
-      fs_inst *inst = (fs_inst *)node;
-
+   foreach_in_list_safe(fs_inst, inst, &instructions) {
       int ip = next_ip;
       next_ip++;
 
@@ -2251,9 +2247,7 @@ fs_visitor::remove_duplicate_mrf_writes()
 
    memset(last_mrf_move, 0, sizeof(last_mrf_move));
 
-   foreach_list_safe(node, &this->instructions) {
-      fs_inst *inst = (fs_inst *)node;
-
+   foreach_in_list_safe(fs_inst, inst, &instructions) {
       if (inst->is_control_flow()) {
         memset(last_mrf_move, 0, sizeof(last_mrf_move));
       }
@@ -2505,9 +2499,7 @@ fs_visitor::insert_gen4_send_dependency_workarounds()
     * have a .reg_offset of 0.
     */
 
-   foreach_list_safe(node, &this->instructions) {
-      fs_inst *inst = (fs_inst *)node;
-
+   foreach_in_list_safe(fs_inst, inst, &instructions) {
       if (inst->mlen != 0 && inst->dst.file == GRF) {
          insert_gen4_pre_send_dependency_workarounds(inst);
          insert_gen4_post_send_dependency_workarounds(inst);
@@ -2590,9 +2582,7 @@ fs_visitor::lower_load_payload()
 {
    bool progress = false;
 
-   foreach_list_safe(node, &instructions) {
-      fs_inst *inst = (fs_inst *)node;
-
+   foreach_in_list_safe(fs_inst, inst, &instructions) {
       if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
          fs_reg dst = inst->dst;
 
@@ -2986,9 +2976,7 @@ fs_visitor::opt_drop_redundant_mov_to_flags()
 {
    bool flag_mov_found[2] = {false};
 
-   foreach_list_safe(node, &this->instructions) {
-      fs_inst *inst = (fs_inst *)node;
-
+   foreach_in_list_safe(fs_inst, inst, &instructions) {
       if (inst->is_control_flow()) {
          memset(flag_mov_found, 0, sizeof(flag_mov_found));
       } else if (inst->opcode == FS_OPCODE_MOV_DISPATCH_TO_FLAGS) {
index 7db5df403e05e1ce96a6fc2eb0eebf8c161b0258..72329e15ed63f692562d1ac9825829efa7d2e108 100644 (file)
@@ -545,9 +545,7 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block,
 
       /* kill the destination from the ACP */
       if (inst->dst.file == GRF) {
-        foreach_list_safe(entry_node, &acp[inst->dst.reg % ACP_HASH_SIZE]) {
-           acp_entry *entry = (acp_entry *)entry_node;
-
+        foreach_in_list_safe(acp_entry, entry, &acp[inst->dst.reg % ACP_HASH_SIZE]) {
            if (inst->overwrites_reg(entry->dst)) {
               entry->remove();
            }
@@ -557,8 +555,7 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block,
           * the source, so walk across the entire table.
           */
          for (int i = 0; i < ACP_HASH_SIZE; i++) {
-            foreach_list_safe(entry_node, &acp[i]) {
-               acp_entry *entry = (acp_entry *)entry_node;
+            foreach_in_list_safe(acp_entry, entry, &acp[i]) {
                if (inst->overwrites_reg(entry->src))
                   entry->remove();
             }
index e4068fc708790db7cdb66c75237bea5366d32804..381c5697f1056a60880e88a9214b61e4d83333f7 100644 (file)
@@ -264,9 +264,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
          }
       }
 
-      foreach_list_safe(entry_node, aeb) {
-         aeb_entry *entry = (aeb_entry *)entry_node;
-
+      foreach_in_list_safe(aeb_entry, entry, aeb) {
          /* Kill all AEB entries that write a different value to or read from
           * the flag register if we just wrote it.
           */
index 3fefe81fa225e77c520eb69fccbcd768858ff036..7b2d4aa9b72bbc14a8c546cff985a65992f6806f 100644 (file)
@@ -103,9 +103,7 @@ fs_visitor::dead_code_eliminate()
    ralloc_free(live);
 
    if (progress) {
-      foreach_list_safe(node, &this->instructions) {
-         fs_inst *inst = (fs_inst *)node;
-
+      foreach_in_list_safe(fs_inst, inst, &instructions) {
          if (inst->opcode == BRW_OPCODE_NOP) {
             inst->remove();
          }
index 7b2b0d11aec57aff3843c73d1e8cfb1b7d3c9734..e242e4fbccd9a631d7918ad9d99f43192c7a59e5 100644 (file)
@@ -272,9 +272,7 @@ fs_visitor::register_coalesce()
    }
 
    if (progress) {
-      foreach_list_safe(node, &this->instructions) {
-         fs_inst *inst = (fs_inst *)node;
-
+      foreach_in_list_safe(fs_inst, inst, &instructions) {
          if (inst->opcode == BRW_OPCODE_NOP) {
             inst->remove();
          }
index a048b3dc0e5b54b71ed8d921a8c3d450c73056b2..5ddd6e82e985e012d7d1d828f5e26e207db43750 100644 (file)
@@ -336,9 +336,7 @@ brw_do_vector_splitting(exec_list *instructions)
    visit_list_elements(&refs, instructions);
 
    /* Trim out variables we can't split. */
-   foreach_list_safe(node, &refs.variable_list) {
-      variable_entry *entry = (variable_entry *)node;
-
+   foreach_in_list_safe(variable_entry, entry, &refs.variable_list) {
       if (debug) {
         fprintf(stderr, "vector %s@%p: whole_access %d\n",
                  entry->var->name, (void *) entry->var,
index ce7075f7940c879c764ff8143b7c94dd33ca8548..8de4d9d72d8bc1118cf4c5d78e4e918640a41ced 100644 (file)
@@ -2510,8 +2510,7 @@ fs_visitor::emit(fs_inst *inst)
 void
 fs_visitor::emit(exec_list list)
 {
-   foreach_list_safe(node, &list) {
-      fs_inst *inst = (fs_inst *)node;
+   foreach_in_list_safe(fs_inst, inst, &list) {
       inst->remove();
       emit(inst);
    }
index cc136a5b9485267e2a64352d8de1f71be7b4ed68..245df2a6fbf511ce4a75f06b7dba55ac119e02c8 100644 (file)
@@ -1352,8 +1352,7 @@ instruction_scheduler::schedule_instructions(backend_instruction *next_block_hea
    time = 0;
 
    /* Remove non-DAG heads from the list. */
-   foreach_list_safe(node, &instructions) {
-      schedule_node *n = (schedule_node *)node;
+   foreach_in_list_safe(schedule_node, n, &instructions) {
       if (n->parent_count != 0)
         n->remove();
    }
index bcd1b3a8a79000a0345da675c6db02eb95486df7..14bcb1171860cf8b0a97ff97eee4d221af7262b0 100644 (file)
@@ -392,9 +392,7 @@ vec4_visitor::dead_code_eliminate()
 
    calculate_live_intervals();
 
-   foreach_list_safe(node, &this->instructions) {
-      vec4_instruction *inst = (vec4_instruction *)node;
-
+   foreach_in_list_safe(vec4_instruction, inst, &instructions) {
       pc++;
 
       bool inst_writes_flag = false;
@@ -755,9 +753,7 @@ vec4_visitor::move_push_constants_to_pull_constants()
    /* Now actually rewrite usage of the things we've moved to pull
     * constants.
     */
-   foreach_list_safe(node, &this->instructions) {
-      vec4_instruction *inst = (vec4_instruction *)node;
-
+   foreach_in_list_safe(vec4_instruction, inst, &instructions) {
       for (int i = 0 ; i < 3; i++) {
         if (inst->src[i].file != UNIFORM ||
             pull_constant_loc[inst->src[i].reg] == -1)
@@ -987,9 +983,7 @@ vec4_visitor::opt_register_coalesce()
 
    calculate_live_intervals();
 
-   foreach_list_safe(node, &this->instructions) {
-      vec4_instruction *inst = (vec4_instruction *)node;
-
+   foreach_in_list_safe(vec4_instruction, inst, &instructions) {
       int ip = next_ip;
       next_ip++;
 
index dea7ae4bf1d539f7ce81b3b86907d93579c4aae5..0d04b8294e6e6b1e687cfee771ea5f89c5a07b60 100644 (file)
@@ -3254,9 +3254,7 @@ vec4_visitor::move_grf_array_access_to_scratch()
     * we may generate a new scratch_write instruction after the one
     * we're processing.
     */
-   foreach_list_safe(node, &this->instructions) {
-      vec4_instruction *inst = (vec4_instruction *)node;
-
+   foreach_in_list_safe(vec4_instruction, inst, &instructions) {
       /* Set up the annotation tracking for new generated instructions. */
       base_ir = inst->ir;
       current_annotation = inst->annotation;
@@ -3340,9 +3338,7 @@ vec4_visitor::move_uniform_array_access_to_pull_constants()
     * Note that we don't move constant-indexed accesses to arrays.  No
     * testing has been done of the performance impact of this choice.
     */
-   foreach_list_safe(node, &this->instructions) {
-      vec4_instruction *inst = (vec4_instruction *)node;
-
+   foreach_in_list_safe(vec4_instruction, inst, &instructions) {
       for (int i = 0 ; i < 3; i++) {
         if (inst->src[i].file != UNIFORM || !inst->src[i].reladdr)
            continue;
index a37afa684ddb3552be7a965f4b697dc702dc2ee7..bf6bcf257a9c834fc044779dc454b112c4c74403 100644 (file)
@@ -87,7 +87,7 @@ intel_resolve_map_remove(struct intel_resolve_map *elem)
 void
 intel_resolve_map_clear(struct exec_list *resolve_map)
 {
-   foreach_list_safe(node, resolve_map) {
+   foreach_in_list_safe(struct exec_node, node, resolve_map) {
       free(node);
    }