From 311d3d60156fbe76d3f9570eda1cf92b714ecc68 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 11 Dec 2020 22:33:09 -0500 Subject: [PATCH] pan/bi: Implement jumps with the builder Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 34327fedf1a..a8262928aaa 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -70,6 +70,26 @@ bi_init_builder(bi_context *ctx) static bi_block *emit_cf_list(bi_context *ctx, struct exec_list *list); static bi_instruction *bi_emit_branch(bi_context *ctx); +static void +bi_emit_jump(bi_builder *b, nir_jump_instr *instr) +{ + bi_instr *branch = bi_jump_to(b, bi_null(), bi_zero()); + + switch (instr->type) { + case nir_jump_break: + branch->branch_target = b->shader->break_block; + break; + case nir_jump_continue: + branch->branch_target = b->shader->continue_block; + break; + default: + unreachable("Unhandled jump type"); + } + + pan_block_add_successor(&b->shader->current_block->base, &branch->branch_target->base); + b->shader->current_block->base.unconditional_jumps = true; +} + static void emit_jump(bi_context *ctx, nir_jump_instr *instr) {