i965: Use typed foreach_in_list_safe instead of foreach_list_safe.

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Matt Turner 2014-06-24 16:31:38 -07:00
parent c5030ac0ac
commit 266109736a
11 changed files with 20 additions and 55 deletions

View 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) {

View 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();
}

View 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.
*/

View 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();
}

View 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();
}

View 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,

View 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);
}

View 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();
}

View 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++;

View 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;

View 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);
}