|
|
@@ -446,7 +446,19 @@ static void bgnloop_emit( |
|
|
|
endloop_block, "LOOP"); |
|
|
|
LLVMBuildBr(gallivm->builder, loop_block); |
|
|
|
LLVMPositionBuilderAtEnd(gallivm->builder, loop_block); |
|
|
|
ctx->loop_depth++; |
|
|
|
|
|
|
|
if (++ctx->loop_depth > ctx->loop_depth_max) { |
|
|
|
unsigned new_max = ctx->loop_depth_max << 1; |
|
|
|
|
|
|
|
if (!new_max) |
|
|
|
new_max = RADEON_LLVM_INITIAL_CF_DEPTH; |
|
|
|
|
|
|
|
ctx->loop = REALLOC(ctx->loop, ctx->loop_depth_max * |
|
|
|
sizeof(ctx->loop[0]), |
|
|
|
new_max * sizeof(ctx->loop[0])); |
|
|
|
ctx->loop_depth_max = new_max; |
|
|
|
} |
|
|
|
|
|
|
|
ctx->loop[ctx->loop_depth - 1].loop_block = loop_block; |
|
|
|
ctx->loop[ctx->loop_depth - 1].endloop_block = endloop_block; |
|
|
|
} |
|
|
@@ -577,7 +589,18 @@ static void if_cond_emit( |
|
|
|
LLVMBuildCondBr(gallivm->builder, cond, if_block, else_block); |
|
|
|
LLVMPositionBuilderAtEnd(gallivm->builder, if_block); |
|
|
|
|
|
|
|
ctx->branch_depth++; |
|
|
|
if (++ctx->branch_depth > ctx->branch_depth_max) { |
|
|
|
unsigned new_max = ctx->branch_depth_max << 1; |
|
|
|
|
|
|
|
if (!new_max) |
|
|
|
new_max = RADEON_LLVM_INITIAL_CF_DEPTH; |
|
|
|
|
|
|
|
ctx->branch = REALLOC(ctx->branch, ctx->branch_depth_max * |
|
|
|
sizeof(ctx->branch[0]), |
|
|
|
new_max * sizeof(ctx->branch[0])); |
|
|
|
ctx->branch_depth_max = new_max; |
|
|
|
} |
|
|
|
|
|
|
|
ctx->branch[ctx->branch_depth - 1].endif_block = endif_block; |
|
|
|
ctx->branch[ctx->branch_depth - 1].if_block = if_block; |
|
|
|
ctx->branch[ctx->branch_depth - 1].else_block = else_block; |
|
|
@@ -1440,4 +1463,10 @@ void radeon_llvm_dispose(struct radeon_llvm_context * ctx) |
|
|
|
LLVMContextDispose(ctx->soa.bld_base.base.gallivm->context); |
|
|
|
FREE(ctx->temps); |
|
|
|
ctx->temps = NULL; |
|
|
|
FREE(ctx->loop); |
|
|
|
ctx->loop = NULL; |
|
|
|
ctx->loop_depth_max = 0; |
|
|
|
FREE(ctx->branch); |
|
|
|
ctx->branch = NULL; |
|
|
|
ctx->branch_depth_max = 0; |
|
|
|
} |