#include "brw_wm.h"
}
#include "brw_fs.h"
+#include "brw_cfg.h"
#include "brw_dead_control_flow.h"
#include "main/uniforms.h"
#include "brw_fs_live_variables.h"
}
}
}
- invalidate_live_intervals();
+ invalidate_live_intervals(false);
}
/**
if (remap_table[i] != -1) {
remap_table[i] = new_index;
virtual_grf_sizes[new_index] = virtual_grf_sizes[i];
- invalidate_live_intervals();
+ invalidate_live_intervals(false);
++new_index;
}
}
void
fs_visitor::demote_pull_constants()
{
- foreach_in_list(fs_inst, inst, &instructions) {
+ calculate_cfg();
+
+ foreach_block_and_inst (block, fs_inst, inst, cfg) {
for (int i = 0; i < inst->sources; i++) {
if (inst->src[i].file != UNIFORM)
continue;
surf_index,
*inst->src[i].reladdr,
pull_index);
- inst->insert_before(&list);
+ inst->insert_before(block, &list);
inst->src[i].reladdr = NULL;
} else {
fs_reg offset = fs_reg((unsigned)(pull_index * 4) & ~15);
fs_inst *pull =
new(mem_ctx) fs_inst(FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD,
dst, surf_index, offset);
- inst->insert_before(pull);
+ inst->insert_before(block, pull);
inst->src[i].set_smear(pull_index & 3);
}
inst->src[i].reg_offset = 0;
}
}
- invalidate_live_intervals();
+ invalidate_live_intervals(false);
}
bool
}
if (progress)
- invalidate_live_intervals();
+ invalidate_live_intervals(false);
return progress;
}
memset(last_mrf_move, 0, sizeof(last_mrf_move));
- foreach_in_list_safe(fs_inst, inst, &instructions) {
+ calculate_cfg();
+
+ foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
if (inst->is_control_flow()) {
memset(last_mrf_move, 0, sizeof(last_mrf_move));
}
inst->dst.file == MRF) {
fs_inst *prev_inst = last_mrf_move[inst->dst.reg];
if (prev_inst && inst->equals(prev_inst)) {
- inst->remove();
+ inst->remove(block);
progress = true;
continue;
}
void
fs_visitor::lower_uniform_pull_constant_loads()
{
- foreach_in_list(fs_inst, inst, &instructions) {
+ calculate_cfg();
+
+ foreach_block_and_inst (block, fs_inst, inst, cfg) {
if (inst->opcode != FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD)
continue;
setup->ir = inst->ir;
setup->annotation = inst->annotation;
- inst->insert_before(setup);
+ inst->insert_before(block, setup);
/* Similarly, this will only populate the first 4 channels of the
* result register (since we only use smear values from 0-3), but we
inst->opcode = FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD_GEN7;
inst->src[1] = payload;
- invalidate_live_intervals();
+ invalidate_live_intervals(false);
} else {
/* Before register allocation, we didn't tell the scheduler about the
* MRF we use. We know it's safe to use this MRF because nothing
{
bool progress = false;
- foreach_in_list_safe(fs_inst, inst, &instructions) {
+ calculate_cfg();
+
+ foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
fs_reg dst = inst->dst;
/* src[0] represents the (optional) message header. */
if (inst->src[0].file != BAD_FILE) {
- inst->insert_before(MOV(dst, inst->src[0]));
+ inst->insert_before(block, MOV(dst, inst->src[0]));
}
dst.reg_offset++;
for (int i = 1; i < inst->sources; i++) {
- inst->insert_before(MOV(dst, inst->src[i]));
+ inst->insert_before(block, MOV(dst, inst->src[i]));
dst.reg_offset++;
}
- inst->remove();
+ inst->remove(block);
progress = true;
}
}
if (progress)
- invalidate_live_intervals();
+ invalidate_live_intervals(false);
return progress;
}
void
fs_visitor::calculate_register_pressure()
{
- invalidate_live_intervals();
+ invalidate_live_intervals(false);
calculate_live_intervals();
unsigned num_instructions = instructions.length();
entry->tmp.swizzle = BRW_SWIZZLE_XYZW;
vec4_instruction *copy = MOV(entry->generator->dst, entry->tmp);
- entry->generator->insert_after(copy);
+ entry->generator->insert_after(block, copy);
entry->generator->dst = dst_reg(entry->tmp);
}
assert(inst->dst.type == entry->tmp.type);
vec4_instruction *copy = MOV(inst->dst, entry->tmp);
copy->force_writemask_all = inst->force_writemask_all;
- inst->insert_before(copy);
+ inst->insert_before(block, copy);
}
/* Set our iterator so that next time through the loop inst->next
*/
vec4_instruction *prev = (vec4_instruction *)inst->prev;
- inst->remove();
+ inst->remove(block);
/* Appending an instruction may have changed our bblock end. */
if (inst == block->end) {
}
if (progress)
- invalidate_live_intervals();
+ invalidate_live_intervals(false);
return progress;
}