i965: Move must_use/has_separate_stencil fields to brw_context.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_cfg.cpp
index 8382764ce34a334cf199c49dc0b483d21d212c52..f4cfcd5687595b2d8ec125ec03ee7f47e404c6d9 100644 (file)
@@ -66,9 +66,20 @@ bblock_t::make_list(void *mem_ctx)
    return new(mem_ctx) bblock_link(this);
 }
 
-cfg_t::cfg_t(fs_visitor *v)
+cfg_t::cfg_t(backend_visitor *v)
 {
-   mem_ctx = ralloc_context(v->mem_ctx);
+   create(v->mem_ctx, &v->instructions);
+}
+
+cfg_t::cfg_t(void *mem_ctx, exec_list *instructions)
+{
+   create(mem_ctx, instructions);
+}
+
+void
+cfg_t::create(void *parent_mem_ctx, exec_list *instructions)
+{
+   mem_ctx = ralloc_context(parent_mem_ctx);
    block_list.make_empty();
    num_blocks = 0;
    ip = 0;
@@ -82,10 +93,10 @@ cfg_t::cfg_t(fs_visitor *v)
 
    set_next_block(entry);
 
-   entry->start = (fs_inst *)v->instructions.get_head();
+   entry->start = (backend_instruction *) instructions->get_head();
 
-   foreach_list(node, &v->instructions) {
-      fs_inst *inst = (fs_inst *)node;
+   foreach_list(node, instructions) {
+      backend_instruction *inst = (backend_instruction *)node;
 
       cur->end = inst;
 
@@ -112,7 +123,7 @@ cfg_t::cfg_t(fs_visitor *v)
          * instructions.
          */
         next = new_block();
-        next->start = (fs_inst *)inst->next;
+        next->start = (backend_instruction *)inst->next;
         cur_if->add_successor(mem_ctx, next);
 
         set_next_block(next);
@@ -122,7 +133,7 @@ cfg_t::cfg_t(fs_visitor *v)
         cur->add_successor(mem_ctx, cur_endif);
 
         next = new_block();
-        next->start = (fs_inst *)inst->next;
+        next->start = (backend_instruction *)inst->next;
         cur_if->add_successor(mem_ctx, next);
         cur_else = next;
 
@@ -130,7 +141,7 @@ cfg_t::cfg_t(fs_visitor *v)
         break;
 
       case BRW_OPCODE_ENDIF:
-        cur_endif->start = (fs_inst *)inst->next;
+        cur_endif->start = (backend_instruction *)inst->next;
         cur->add_successor(mem_ctx, cur_endif);
         set_next_block(cur_endif);
 
@@ -159,7 +170,7 @@ cfg_t::cfg_t(fs_visitor *v)
          * instructions.
          */
         next = new_block();
-        next->start = (fs_inst *)inst->next;
+        next->start = (backend_instruction *)inst->next;
         cur->add_successor(mem_ctx, next);
         cur_do = next;
 
@@ -170,7 +181,7 @@ cfg_t::cfg_t(fs_visitor *v)
         cur->add_successor(mem_ctx, cur_do);
 
         next = new_block();
-        next->start = (fs_inst *)inst->next;
+        next->start = (backend_instruction *)inst->next;
         if (inst->predicate)
            cur->add_successor(mem_ctx, next);
 
@@ -181,7 +192,7 @@ cfg_t::cfg_t(fs_visitor *v)
         cur->add_successor(mem_ctx, cur_while);
 
         next = new_block();
-        next->start = (fs_inst *)inst->next;
+        next->start = (backend_instruction *)inst->next;
         if (inst->predicate)
            cur->add_successor(mem_ctx, next);
 
@@ -189,7 +200,7 @@ cfg_t::cfg_t(fs_visitor *v)
         break;
 
       case BRW_OPCODE_WHILE:
-        cur_while->start = (fs_inst *)inst->next;
+        cur_while->start = (backend_instruction *)inst->next;
 
         cur->add_successor(mem_ctx, cur_do);
         set_next_block(cur_while);