i965/cfg: Keep pointers to IF/ELSE/ENDIF instructions in the cfg.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_cfg.h
index 3b031df938b8dd7e05a207b288ef9c8b81b82cd4..ad54f869883140102c09c85a0d2e75d61a988395 100644 (file)
@@ -39,21 +39,14 @@ public:
 
 class bblock_t {
 public:
-   static void* operator new(size_t size, void *ctx)
-   {
-      void *node;
-
-      node = rzalloc_size(ctx, size);
-      assert(node != NULL);
-
-      return node;
-   }
+   DECLARE_RALLOC_CXX_OPERATORS(bblock_t)
 
    bblock_link *make_list(void *mem_ctx);
 
    bblock_t();
 
    void add_successor(void *mem_ctx, bblock_t *successor);
+   void dump(backend_visitor *v);
 
    backend_instruction *start;
    backend_instruction *end;
@@ -64,26 +57,34 @@ public:
    exec_list parents;
    exec_list children;
    int block_num;
+
+   /* If the current basic block ends in an IF, ELSE, or ENDIF instruction,
+    * these pointers will hold the locations of the other associated control
+    * flow instructions.
+    *
+    * Otherwise they are NULL.
+    */
+   backend_instruction *if_inst;
+   backend_instruction *else_inst;
+   backend_instruction *endif_inst;
 };
 
 class cfg_t {
 public:
-   static void* operator new(size_t size, void *ctx)
-   {
-      void *node;
-
-      node = rzalloc_size(ctx, size);
-      assert(node != NULL);
-
-      return node;
-   }
+   DECLARE_RALLOC_CXX_OPERATORS(cfg_t)
 
    cfg_t(backend_visitor *v);
+   cfg_t(void *mem_ctx, exec_list *instructions);
    ~cfg_t();
+
+   void create(void *mem_ctx, exec_list *instructions);
+
    bblock_t *new_block();
    void set_next_block(bblock_t *block);
    void make_block_array();
 
+   void dump(backend_visitor *v);
+
    /** @{
     *
     * Used while generating the block list.