i965/fs: use SSA values directly
[mesa.git] / src / mesa / drivers / dri / i965 / brw_vec4_live_variables.h
index 03cc813782e83e75ca0262a8b6c2a3ccbe3d738e..e7929ec2189f94d9da8c5c87deac0a6c70e4dacc 100644 (file)
@@ -25,7 +25,7 @@
  *
  */
 
-#include "main/bitset.h"
+#include "util/bitset.h"
 #include "brw_vec4.h"
 
 namespace brw {
@@ -49,28 +49,52 @@ struct block_data {
 
    /** Which defs reach the exit point of the block. */
    BITSET_WORD *liveout;
+
+   BITSET_WORD flag_def[1];
+   BITSET_WORD flag_use[1];
+   BITSET_WORD flag_livein[1];
+   BITSET_WORD flag_liveout[1];
 };
 
 class vec4_live_variables {
 public:
    DECLARE_RALLOC_CXX_OPERATORS(vec4_live_variables)
 
-   vec4_live_variables(vec4_visitor *v, cfg_t *cfg);
+   vec4_live_variables(const simple_allocator &alloc, cfg_t *cfg);
    ~vec4_live_variables();
 
    int num_vars;
    int bitset_words;
 
    /** Per-basic-block information on live variables */
-   struct block_data *bd;
+   struct block_data *block_data;
 
 protected:
    void setup_def_use();
    void compute_live_variables();
 
-   vec4_visitor *v;
+   const simple_allocator &alloc;
    cfg_t *cfg;
    void *mem_ctx;
 };
 
+inline unsigned
+var_from_reg(const simple_allocator &alloc, const src_reg &reg,
+             unsigned c = 0)
+{
+   assert(reg.file == GRF && reg.reg < alloc.count &&
+          reg.reg_offset < alloc.sizes[reg.reg] && c < 4);
+   return (4 * (alloc.offsets[reg.reg] + reg.reg_offset) +
+           BRW_GET_SWZ(reg.swizzle, c));
+}
+
+inline unsigned
+var_from_reg(const simple_allocator &alloc, const dst_reg &reg,
+             unsigned c = 0)
+{
+   assert(reg.file == GRF && reg.reg < alloc.count &&
+          reg.reg_offset < alloc.sizes[reg.reg] && c < 4);
+   return 4 * (alloc.offsets[reg.reg] + reg.reg_offset) + c;
+}
+
 } /* namespace brw */