[Mesa-dev] [PATCH 01/13] i965 vs: Remove dead code from the vec4_visitor class.

Paul Berry stereotype441 at gmail.com
Wed Nov 16 11:07:08 PST 2011


This patch removes two unused functions from vec4_visitor:
implied_mrf_writes() and emit_bool_comparison().  implied_mrf_writes()
is part of instruction scheduling, which has not been implemented for
vec4_visitor yet.  emit_bool_comparison() has never been used.

It also removes two declarations that did't have any functions
associated with them: reladdr_to_temp() and process_move_condition().
These functions appear to be a copy-paste error from when the
vec4_visitor class was first introduced.

Since later patches in this series refactor the vec4_visitor class
into two classes, it seems sensible to eliminate dead code first, so
that the refactoring job will be smaller.
---
 src/mesa/drivers/dri/i965/brw_vec4.cpp         |   37 ------------------------
 src/mesa/drivers/dri/i965/brw_vec4.h           |    7 ----
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |   14 ---------
 3 files changed, 0 insertions(+), 58 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 54ef9b6..3971532 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -45,43 +45,6 @@ vec4_instruction::is_math()
 	   opcode == SHADER_OPCODE_INT_REMAINDER ||
 	   opcode == SHADER_OPCODE_POW);
 }
-/**
- * Returns how many MRFs an opcode will write over.
- *
- * Note that this is not the 0 or 1 implied writes in an actual gen
- * instruction -- the generate_* functions generate additional MOVs
- * for setup.
- */
-int
-vec4_visitor::implied_mrf_writes(vec4_instruction *inst)
-{
-   if (inst->mlen == 0)
-      return 0;
-
-   switch (inst->opcode) {
-   case SHADER_OPCODE_RCP:
-   case SHADER_OPCODE_RSQ:
-   case SHADER_OPCODE_SQRT:
-   case SHADER_OPCODE_EXP2:
-   case SHADER_OPCODE_LOG2:
-   case SHADER_OPCODE_SIN:
-   case SHADER_OPCODE_COS:
-      return 1;
-   case SHADER_OPCODE_POW:
-      return 2;
-   case VS_OPCODE_URB_WRITE:
-      return 1;
-   case VS_OPCODE_PULL_CONSTANT_LOAD:
-      return 2;
-   case VS_OPCODE_SCRATCH_READ:
-      return 2;
-   case VS_OPCODE_SCRATCH_WRITE:
-      return 3;
-   default:
-      assert(!"not reached");
-      return inst->mlen;
-   }
-}
 
 bool
 src_reg::equals(src_reg *r)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 93ccda9..c03bcad 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -338,8 +338,6 @@ public:
 
    dst_reg *variable_storage(ir_variable *var);
 
-   void reladdr_to_temp(ir_instruction *ir, src_reg *reg, int *num_reladdr);
-
    src_reg src_reg_for_float(float val);
 
    /**
@@ -444,8 +442,6 @@ public:
    vec4_instruction *SCRATCH_READ(dst_reg dst, src_reg index);
    vec4_instruction *SCRATCH_WRITE(dst_reg dst, src_reg src, src_reg index);
 
-   int implied_mrf_writes(vec4_instruction *inst);
-
    bool try_rewrite_rhs_to_dst(ir_assignment *ir,
 			       dst_reg dst,
 			       src_reg src,
@@ -456,7 +452,6 @@ public:
    void visit_instructions(const exec_list *list);
 
    void emit_bool_to_cond_code(ir_rvalue *ir, uint32_t *predicate);
-   void emit_bool_comparison(unsigned int op, dst_reg dst, src_reg src0, src_reg src1);
    void emit_if_gen6(ir_if *ir);
 
    void emit_block_move(dst_reg *dst, src_reg *src,
@@ -512,8 +507,6 @@ public:
    bool try_emit_sat(ir_expression *ir);
    void resolve_ud_negate(src_reg *reg);
 
-   bool process_move_condition(ir_rvalue *ir);
-
    void generate_code();
    void generate_vs_instruction(vec4_instruction *inst,
 				struct brw_reg dst,
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 853c3ee..3327eef 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1015,20 +1015,6 @@ vec4_visitor::try_emit_sat(ir_expression *ir)
 }
 
 void
-vec4_visitor::emit_bool_comparison(unsigned int op,
-				 dst_reg dst, src_reg src0, src_reg src1)
-{
-   /* original gen4 does destination conversion before comparison. */
-   if (intel->gen < 5)
-      dst.type = src0.type;
-
-   emit(CMP(dst, src0, src1, brw_conditional_for_comparison(op)));
-
-   dst.type = BRW_REGISTER_TYPE_D;
-   emit(AND(dst, src_reg(dst), src_reg(0x1)));
-}
-
-void
 vec4_visitor::visit(ir_expression *ir)
 {
    unsigned int operand;
-- 
1.7.6.4



More information about the mesa-dev mailing list