From: Matt Turner Date: Tue, 24 Jun 2014 04:57:31 +0000 (-0700) Subject: i965: Make can_do_source_mods() a member of the instruction classes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=46659d46a8c2f7bbc8deb472faff2dccbde92d29;p=mesa.git 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 --- diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 185a1f68c08..929379a7f4d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index b86a31c3771..0da79ba1c4e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp index cc6e86f55e4..0a7b8b8952a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -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 diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index ee5be56b713..24903f952d1 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index 20d717a77fb..366ef02a510 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp index abafe47a759..11571ad3b0a 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp @@ -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)