Selaa lähdekoodia

i965: Add and use foreach_inst_in_block macros.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
tags/10.3-branchpoint
Matt Turner 11 vuotta sitten
vanhempi
commit
bc2fbbafd2

+ 10
- 0
src/mesa/drivers/dri/i965/brw_cfg.h Näytä tiedosto

@@ -105,4 +105,14 @@ public:
};
#endif

#define foreach_inst_in_block(__type, __inst, __block) \
for (__type *__inst = (__type *)__block->start; \
__inst != __block->end->next; \
__inst = (__type *)__inst->next)

#define foreach_inst_in_block_reverse(__type, __inst, __block) \
for (__type *__inst = (__type *)__block->end; \
__inst != __block->start->prev; \
__inst = (__type *)__inst->prev)

#endif /* BRW_CFG_H */

+ 2
- 7
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp Näytä tiedosto

@@ -157,9 +157,7 @@ fs_copy_prop_dataflow::setup_initial_values()
for (int b = 0; b < cfg->num_blocks; b++) {
bblock_t *block = cfg->blocks[b];

for (fs_inst *inst = (fs_inst *)block->start;
inst != block->end->next;
inst = (fs_inst *)inst->next) {
foreach_inst_in_block(fs_inst, inst, block) {
if (inst->dst.file != GRF)
continue;

@@ -532,10 +530,7 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block,
{
bool progress = false;

for (fs_inst *inst = (fs_inst *)block->start;
inst != block->end->next;
inst = (fs_inst *)inst->next) {

foreach_inst_in_block(fs_inst, inst, block) {
/* Try propagating into this instruction. */
for (int i = 0; i < inst->sources; i++) {
if (inst->src[i].file != GRF)

+ 1
- 4
src/mesa/drivers/dri/i965/brw_fs_cse.cpp Näytä tiedosto

@@ -173,10 +173,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
void *cse_ctx = ralloc_context(NULL);

int ip = block->start_ip;
for (fs_inst *inst = (fs_inst *)block->start;
inst != block->end->next;
inst = (fs_inst *) inst->next) {

foreach_inst_in_block(fs_inst, inst, block) {
/* Skip some cases. */
if (is_expression(inst) && !inst->is_partial_write() &&
(inst->dst.file != HW_REG || inst->dst.is_null()))

+ 1
- 3
src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp Näytä tiedosto

@@ -51,9 +51,7 @@ fs_visitor::dead_code_eliminate()
memcpy(live, live_intervals->bd[b].liveout,
sizeof(BITSET_WORD) * BITSET_WORDS(num_vars));

for (fs_inst *inst = (fs_inst *)block->end;
inst != block->start->prev;
inst = (fs_inst *)inst->prev) {
foreach_inst_in_block_reverse(fs_inst, inst, block) {
if (inst->dst.file == GRF &&
!inst->has_side_effects() &&
!inst->writes_flag()) {

+ 1
- 4
src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp Näytä tiedosto

@@ -144,10 +144,7 @@ fs_live_variables::setup_def_use()
if (b > 0)
assert(cfg->blocks[b - 1]->end_ip == ip - 1);

for (fs_inst *inst = (fs_inst *)block->start;
inst != block->end->next;
inst = (fs_inst *)inst->next) {

foreach_inst_in_block(fs_inst, inst, block) {
/* Set use[] for this instruction */
for (unsigned int i = 0; i < inst->sources; i++) {
fs_reg reg = inst->src[i];

+ 1
- 3
src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp Näytä tiedosto

@@ -34,9 +34,7 @@ opt_saturate_propagation_local(fs_visitor *v, bblock_t *block)
bool progress = false;
int ip = block->start_ip - 1;

for (fs_inst *inst = (fs_inst *)block->start;
inst != block->end->next;
inst = (fs_inst *) inst->next) {
foreach_inst_in_block(fs_inst, inst, block) {
ip++;

if (inst->opcode != BRW_OPCODE_MOV ||

+ 1
- 4
src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp Näytä tiedosto

@@ -72,10 +72,7 @@ vec4_live_variables::setup_def_use()
if (b > 0)
assert(cfg->blocks[b - 1]->end_ip == ip - 1);

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) {
/* Set use[] for this instruction */
for (unsigned int i = 0; i < 3; i++) {
if (inst->src[i].file == GRF) {

Loading…
Peruuta
Tallenna