*/
struct ir3_postsched_ctx {
- struct ir3_context *ctx;
+ struct ir3 *ir;
void *mem_ctx;
struct ir3_block *block; /* the current block */
struct list_head unscheduled_list; /* unscheduled instructions */
- bool error;
-
int sfu_delay;
int tex_delay;
};
}
struct ir3_postsched_deps_state {
- struct ir3_context *ctx;
+ struct ir3_postsched_ctx *ctx;
enum { F, R } direction;
calculate_forward_deps(struct ir3_postsched_ctx *ctx)
{
struct ir3_postsched_deps_state state = {
- .ctx = ctx->ctx,
+ .ctx = ctx,
.direction = F,
- .merged = ctx->ctx->compiler->gpu_id >= 600,
+ .merged = ctx->ir->compiler->gpu_id >= 600,
};
foreach_instr (instr, &ctx->unscheduled_list) {
calculate_reverse_deps(struct ir3_postsched_ctx *ctx)
{
struct ir3_postsched_deps_state state = {
- .ctx = ctx->ctx,
+ .ctx = ctx,
.direction = R,
- .merged = ctx->ctx->compiler->gpu_id >= 600,
+ .merged = ctx->ir->compiler->gpu_id >= 600,
};
foreach_instr_rev (instr, &ctx->unscheduled_list) {
schedule(ctx, instr);
while (!list_is_empty(&ctx->unscheduled_list)) {
- struct ir3_instruction *instr;
-
- instr = choose_instr(ctx);
-
- /* this shouldn't happen: */
- if (!instr) {
- ctx->error = true;
- break;
- }
+ struct ir3_instruction *instr = choose_instr(ctx);
unsigned delay = ir3_delay_calc(ctx->block, instr, false, false);
d("delay=%u", delay);
}
}
-int
-ir3_postsched(struct ir3_context *cctx)
+bool
+ir3_postsched(struct ir3 *ir)
{
struct ir3_postsched_ctx ctx = {
- .ctx = cctx,
+ .ir = ir,
};
- ir3_remove_nops(cctx->ir);
- cleanup_self_movs(cctx->ir);
+ ir3_remove_nops(ir);
+ cleanup_self_movs(ir);
- foreach_block (block, &cctx->ir->block_list) {
+ foreach_block (block, &ir->block_list) {
sched_block(&ctx, block);
}
- if (ctx.error)
- return -1;
-
- return 0;
+ return true;
}