summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvc0
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nvc0')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_pc_regalloc.c4
-rw-r--r--src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c b/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c
index f4afe083e2d..0515a0d77eb 100644
--- a/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c
+++ b/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c
@@ -504,7 +504,9 @@ pass_generate_phi_movs(struct nv_pc_pass *ctx, struct nv_basic_block *b)
}
if (pn != p && pn->exit) {
- ctx->pc->current_block = b->in[n ? 0 : 1];
+ assert(!b->in[!n]->exit || b->in[!n]->exit->terminator);
+ /* insert terminator (branch to ENDIF) in new else block */
+ ctx->pc->current_block = pn;
ni = new_instruction(ctx->pc, NV_OP_BRA);
ni->target = b;
ni->terminator = 1;
diff --git a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
index a44d330c731..53fd7e70fc9 100644
--- a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
+++ b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
@@ -259,6 +259,12 @@ fetch_by_bb(struct bld_register *reg,
fetch_by_bb(reg, vals, n, b->in[i]);
}
+static INLINE boolean
+nvc0_bblock_is_terminated(struct nv_basic_block *bb)
+{
+ return bb->exit && bb->exit->terminator;
+}
+
static INLINE struct nv_value *
bld_load_imm_u32(struct bld_context *bld, uint32_t u);
@@ -1637,8 +1643,7 @@ bld_instruction(struct bld_context *bld,
{
struct nv_basic_block *b = new_basic_block(bld->pc);
- if (bld->pc->current_block->exit &&
- !bld->pc->current_block->exit->terminator)
+ if (!nvc0_bblock_is_terminated(bld->pc->current_block))
bld_flow(bld, NV_OP_BRA, NULL, NV_CC_P, b, FALSE);
--bld->cond_lvl;