nv50: minor compiler fixes and cleanups
This commit is contained in:
@@ -237,6 +237,7 @@ nv_pc_free_refs(struct nv_pc *pc)
|
||||
int i;
|
||||
for (i = 0; i < pc->num_refs; i += 64)
|
||||
FREE(pc->refs[i]);
|
||||
FREE(pc->refs);
|
||||
}
|
||||
|
||||
static const char *
|
||||
@@ -525,7 +526,8 @@ out:
|
||||
|
||||
for (i = 0; i < pc->num_blocks; ++i)
|
||||
FREE(pc->bb_list[i]);
|
||||
|
||||
if (pc->root)
|
||||
FREE(pc->root);
|
||||
if (ret) { /* on success, these will be referenced by nv50_program */
|
||||
if (pc->emit)
|
||||
FREE(pc->emit);
|
||||
|
||||
@@ -888,6 +888,10 @@ nv_pc_pass1(struct nv_pc *pc, struct nv_basic_block *root)
|
||||
ctx->pc = pc;
|
||||
|
||||
ctx->insns = CALLOC(NV_PC_MAX_INSTRUCTIONS, sizeof(struct nv_instruction *));
|
||||
if (!ctx->insns) {
|
||||
FREE(ctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pc->pass_seq++;
|
||||
ret = pass_generate_phi_movs(ctx, root);
|
||||
@@ -941,6 +945,7 @@ nv_pc_pass1(struct nv_pc *pc, struct nv_basic_block *root)
|
||||
NV50_DBGMSG("REGISTER ALLOCATION - leaving\n");
|
||||
|
||||
out:
|
||||
FREE(ctx->insns);
|
||||
FREE(ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ nv50_transfer_constbuf(struct nv50_context *nv50,
|
||||
if (!map)
|
||||
return;
|
||||
|
||||
count = buf->width0; /* MIN2(buf->width0, size); */
|
||||
count = (buf->width0 + 3) / 4;
|
||||
start = 0;
|
||||
|
||||
while (count) {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#define BLD_MAX_PREDS 4
|
||||
#define BLD_MAX_IMMDS 128
|
||||
|
||||
#define BLD_MAX_COND_NESTING 4
|
||||
#define BLD_MAX_COND_NESTING 8
|
||||
#define BLD_MAX_LOOP_NESTING 4
|
||||
#define BLD_MAX_CALL_NESTING 2
|
||||
|
||||
@@ -70,14 +70,14 @@ bld_vals_del_val(struct bld_value_stack *stk, struct nv_value *val)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = stk->size - 1; i >= 0; --i)
|
||||
if (stk->body[i] == val)
|
||||
for (i = stk->size; i > 0; --i)
|
||||
if (stk->body[i - 1] == val)
|
||||
break;
|
||||
if (i < 0)
|
||||
if (!i)
|
||||
return FALSE;
|
||||
|
||||
if (i != stk->size - 1)
|
||||
stk->body[i] = stk->body[stk->size - 1];
|
||||
if (i != stk->size)
|
||||
stk->body[i - 1] = stk->body[stk->size - 1];
|
||||
|
||||
--stk->size; /* XXX: old size in REALLOC */
|
||||
return TRUE;
|
||||
@@ -1643,6 +1643,8 @@ bld_instruction(struct bld_context *bld,
|
||||
{
|
||||
struct nv_basic_block *b = new_basic_block(bld->pc);
|
||||
|
||||
assert(bld->cond_lvl < BLD_MAX_COND_NESTING);
|
||||
|
||||
nvbb_attach_block(bld->pc->current_block, b, CFG_EDGE_FORWARD);
|
||||
|
||||
bld->join_bb[bld->cond_lvl] = bld->pc->current_block;
|
||||
@@ -1695,6 +1697,8 @@ bld_instruction(struct bld_context *bld,
|
||||
struct nv_basic_block *bl = new_basic_block(bld->pc);
|
||||
struct nv_basic_block *bb = new_basic_block(bld->pc);
|
||||
|
||||
assert(bld->loop_lvl < BLD_MAX_LOOP_NESTING);
|
||||
|
||||
bld->loop_bb[bld->loop_lvl] = bl;
|
||||
bld->brkt_bb[bld->loop_lvl] = bb;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user