i965: Make can_do_source_mods() a member of the instruction classes.

Pretty nonsensical to have it as a method of the visitor just for access
to brw.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Matt Turner 2014-06-23 21:57:31 -07:00
parent b4ef7c596b
commit 46659d46a8
6 changed files with 12 additions and 14 deletions

View File

@ -371,15 +371,15 @@ fs_inst::is_send_from_grf() const
}
bool
fs_visitor::can_do_source_mods(fs_inst *inst)
fs_inst::can_do_source_mods(struct brw_context *brw)
{
if (brw->gen == 6 && inst->is_math())
if (brw->gen == 6 && is_math())
return false;
if (inst->is_send_from_grf())
if (is_send_from_grf())
return false;
if (!inst->can_do_source_mods())
if (!backend_instruction::can_do_source_mods())
return false;
return true;

View File

@ -208,6 +208,7 @@ public:
bool is_send_from_grf() const;
bool is_partial_write() const;
int regs_read(fs_visitor *v, int arg) const;
bool can_do_source_mods(struct brw_context *brw);
bool reads_flag() const;
bool writes_flag() const;
@ -285,8 +286,6 @@ public:
uint32_t gather_channel(ir_texture *ir, int sampler);
void swizzle_result(ir_texture *ir, fs_reg orig_val, int sampler);
bool can_do_source_mods(fs_inst *inst);
fs_inst *emit(fs_inst *inst);
void emit(exec_list list);

View File

@ -314,7 +314,7 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry)
if ((has_source_modifiers || entry->src.file == UNIFORM ||
!entry->src.is_contiguous()) &&
!can_do_source_mods(inst))
!inst->can_do_source_mods(brw))
return false;
/* Bail if the result of composing both strides would exceed the

View File

@ -250,15 +250,15 @@ vec4_instruction::is_send_from_grf()
}
bool
vec4_visitor::can_do_source_mods(vec4_instruction *inst)
vec4_instruction::can_do_source_mods(struct brw_context *brw)
{
if (brw->gen == 6 && inst->is_math())
if (brw->gen == 6 && is_math())
return false;
if (inst->is_send_from_grf())
if (is_send_from_grf())
return false;
if (!inst->can_do_source_mods())
if (!backend_instruction::can_do_source_mods())
return false;
return true;

View File

@ -265,6 +265,7 @@ public:
bool is_send_from_grf();
bool can_reswizzle_dst(int dst_writemask, int swizzle, int swizzle_mask);
void reswizzle_dst(int dst_writemask, int swizzle);
bool can_do_source_mods(struct brw_context *brw);
bool reads_flag()
{
@ -430,8 +431,6 @@ public:
void opt_set_dependency_control();
void opt_schedule_instructions();
bool can_do_source_mods(vec4_instruction *inst);
vec4_instruction *emit(vec4_instruction *inst);
vec4_instruction *emit(enum opcode opcode);

View File

@ -263,7 +263,7 @@ vec4_visitor::try_copy_propagation(vec4_instruction *inst, int arg,
* instructions.
*/
if ((has_source_modifiers || value.file == UNIFORM ||
value.swizzle != BRW_SWIZZLE_XYZW) && !can_do_source_mods(inst))
value.swizzle != BRW_SWIZZLE_XYZW) && !inst->can_do_source_mods(brw))
return false;
if (has_source_modifiers && value.type != inst->src[arg].type)