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;
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;
* 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);
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;
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);
* 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;
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);
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);
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);