From: Rob Clark Date: Tue, 22 Oct 2019 16:22:58 +0000 (-0700) Subject: freedreno/ir3: split pre-coloring to it's own function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8449f6183ff37c87e865aaae508e0289fed51f1c;p=mesa.git freedreno/ir3: split pre-coloring to it's own function Signed-off-by: Rob Clark --- diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c index 39d34bb51d9..100ce422354 100644 --- a/src/freedreno/ir3/ir3_ra.c +++ b/src/freedreno/ir3/ir3_ra.c @@ -1089,8 +1089,12 @@ ra_block_alloc(struct ir3_ra_ctx *ctx, struct ir3_block *block) } } -static int -ra_alloc(struct ir3_ra_ctx *ctx, struct ir3_instruction **precolor, unsigned nprecolor) +/* handle pre-colored registers. This includes "arrays" (which could be of + * length 1, used for phi webs lowered to registers in nir), as well as + * special shader input values that need to be pinned to certain registers. + */ +static void +ra_precolor(struct ir3_ra_ctx *ctx, struct ir3_instruction **precolor, unsigned nprecolor) { unsigned num_precolor = 0; for (unsigned i = 0; i < nprecolor; i++) { @@ -1195,7 +1199,11 @@ retry: ra_set_node_reg(ctx->g, name, reg); } } +} +static int +ra_alloc(struct ir3_ra_ctx *ctx) +{ if (!ra_allocate(ctx->g)) return -1; @@ -1217,7 +1225,8 @@ int ir3_ra(struct ir3_shader_variant *v, struct ir3_instruction **precolor, unsi ra_init(&ctx); ra_add_interference(&ctx); - ret = ra_alloc(&ctx, precolor, nprecolor); + ra_precolor(&ctx, precolor, nprecolor); + ret = ra_alloc(&ctx); ra_destroy(&ctx); return ret;