freedreno/a3xx/compiler: rename ir3_shader to ir3
First step of reoganization split out compiler (so it can be shared between a3xx and a4xx). Rename ir3_shader -> ir3 (since we'll want the name ir3_shader for a higher level object). Signed-off-by: Rob Clark <robclark@freedesktop.org>
This commit is contained in:
parent
faaeddb55e
commit
7d7e6ae9c3
|
@ -50,7 +50,7 @@
|
|||
struct fd3_compile_context {
|
||||
const struct tgsi_token *tokens;
|
||||
bool free_tokens;
|
||||
struct ir3_shader *ir;
|
||||
struct ir3 *ir;
|
||||
struct fd3_shader_variant *so;
|
||||
|
||||
struct ir3_block *block;
|
||||
|
@ -2484,7 +2484,7 @@ compile_dump(struct fd3_compile_context *ctx)
|
|||
if (!f)
|
||||
return;
|
||||
ir3_block_depth(ctx->block);
|
||||
ir3_shader_dump(ctx->ir, name, ctx->block, f);
|
||||
ir3_dump(ctx->ir, name, ctx->block, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
@ -2500,7 +2500,7 @@ fd3_compile_shader(struct fd3_shader_variant *so,
|
|||
|
||||
assert(!so->ir);
|
||||
|
||||
so->ir = ir3_shader_create();
|
||||
so->ir = ir3_create();
|
||||
|
||||
assert(so->ir);
|
||||
|
||||
|
@ -2629,7 +2629,7 @@ fd3_compile_shader(struct fd3_shader_variant *so,
|
|||
|
||||
out:
|
||||
if (ret) {
|
||||
ir3_shader_destroy(so->ir);
|
||||
ir3_destroy(so->ir);
|
||||
so->ir = NULL;
|
||||
}
|
||||
compile_free(&ctx);
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
struct fd3_compile_context {
|
||||
const struct tgsi_token *tokens;
|
||||
bool free_tokens;
|
||||
struct ir3_shader *ir;
|
||||
struct ir3 *ir;
|
||||
struct ir3_block *block;
|
||||
struct fd3_shader_variant *so;
|
||||
|
||||
|
@ -1427,7 +1427,7 @@ decl_samp(struct fd3_compile_context *ctx, struct tgsi_full_declaration *decl)
|
|||
static void
|
||||
compile_instructions(struct fd3_compile_context *ctx)
|
||||
{
|
||||
struct ir3_shader *ir = ctx->ir;
|
||||
struct ir3 *ir = ctx->ir;
|
||||
int nop = 0;
|
||||
|
||||
while (!tgsi_parse_end_of_tokens(&ctx->parser)) {
|
||||
|
@ -1509,7 +1509,7 @@ fd3_compile_shader_old(struct fd3_shader_variant *so,
|
|||
|
||||
assert(!so->ir);
|
||||
|
||||
so->ir = ir3_shader_create();
|
||||
so->ir = ir3_create();
|
||||
|
||||
assert(so->ir);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
static void
|
||||
delete_variant(struct fd3_shader_variant *v)
|
||||
{
|
||||
ir3_shader_destroy(v->ir);
|
||||
ir3_destroy(v->ir);
|
||||
fd_bo_del(v->bo);
|
||||
free(v);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ assemble_variant(struct fd3_shader_variant *so)
|
|||
struct fd_context *ctx = fd_context(so->so->pctx);
|
||||
uint32_t sz, *bin;
|
||||
|
||||
bin = ir3_shader_assemble(so->ir, &so->info);
|
||||
bin = ir3_assemble(so->ir, &so->info);
|
||||
sz = so->info.sizedwords * 4;
|
||||
|
||||
so->bo = fd_bo_new(ctx->dev, sz,
|
||||
|
@ -242,7 +242,7 @@ fd3_vp_state_delete(struct pipe_context *pctx, void *hwcso)
|
|||
static void
|
||||
emit_shader(struct fd_ringbuffer *ring, const struct fd3_shader_variant *so)
|
||||
{
|
||||
const struct ir3_shader_info *si = &so->info;
|
||||
const struct ir3_info *si = &so->info;
|
||||
enum adreno_state_block sb;
|
||||
enum adreno_state_src src;
|
||||
uint32_t i, sz, *bin;
|
||||
|
@ -329,7 +329,7 @@ fd3_program_emit(struct fd_ringbuffer *ring,
|
|||
struct fd_program_stateobj *prog, struct fd3_shader_key key)
|
||||
{
|
||||
const struct fd3_shader_variant *vp, *fp;
|
||||
const struct ir3_shader_info *vsi, *fsi;
|
||||
const struct ir3_info *vsi, *fsi;
|
||||
uint32_t pos_regid, posz_regid, psize_regid, color_regid;
|
||||
int i, j, k;
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ struct fd3_shader_variant {
|
|||
|
||||
struct fd3_shader_key key;
|
||||
|
||||
struct ir3_shader_info info;
|
||||
struct ir3_shader *ir;
|
||||
struct ir3_info info;
|
||||
struct ir3 *ir;
|
||||
|
||||
/* the instructions length is in units of instruction groups
|
||||
* (4 instructions, 8 dwords):
|
||||
|
|
|
@ -40,7 +40,7 @@ struct ir3_heap_chunk {
|
|||
uint32_t heap[CHUNK_SZ];
|
||||
};
|
||||
|
||||
static void grow_heap(struct ir3_shader *shader)
|
||||
static void grow_heap(struct ir3 *shader)
|
||||
{
|
||||
struct ir3_heap_chunk *chunk = calloc(1, sizeof(*chunk));
|
||||
chunk->next = shader->chunk;
|
||||
|
@ -51,7 +51,7 @@ static void grow_heap(struct ir3_shader *shader)
|
|||
/* simple allocator to carve allocations out of an up-front allocated heap,
|
||||
* so that we can free everything easily in one shot.
|
||||
*/
|
||||
void * ir3_alloc(struct ir3_shader *shader, int sz)
|
||||
void * ir3_alloc(struct ir3 *shader, int sz)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
|
@ -66,15 +66,15 @@ void * ir3_alloc(struct ir3_shader *shader, int sz)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
struct ir3_shader * ir3_shader_create(void)
|
||||
struct ir3 * ir3_create(void)
|
||||
{
|
||||
struct ir3_shader *shader =
|
||||
calloc(1, sizeof(struct ir3_shader));
|
||||
struct ir3 *shader =
|
||||
calloc(1, sizeof(struct ir3));
|
||||
grow_heap(shader);
|
||||
return shader;
|
||||
}
|
||||
|
||||
void ir3_shader_destroy(struct ir3_shader *shader)
|
||||
void ir3_destroy(struct ir3 *shader)
|
||||
{
|
||||
while (shader->chunk) {
|
||||
struct ir3_heap_chunk *chunk = shader->chunk;
|
||||
|
@ -90,7 +90,7 @@ void ir3_shader_destroy(struct ir3_shader *shader)
|
|||
return -1; \
|
||||
} } while (0)
|
||||
|
||||
static uint32_t reg(struct ir3_register *reg, struct ir3_shader_info *info,
|
||||
static uint32_t reg(struct ir3_register *reg, struct ir3_info *info,
|
||||
uint32_t repeat, uint32_t valid_flags)
|
||||
{
|
||||
reg_t val = { .dummy32 = 0 };
|
||||
|
@ -124,7 +124,7 @@ static uint32_t reg(struct ir3_register *reg, struct ir3_shader_info *info,
|
|||
}
|
||||
|
||||
static int emit_cat0(struct ir3_instruction *instr, void *ptr,
|
||||
struct ir3_shader_info *info)
|
||||
struct ir3_info *info)
|
||||
{
|
||||
instr_cat0_t *cat0 = ptr;
|
||||
|
||||
|
@ -147,7 +147,7 @@ static uint32_t type_flags(type_t type)
|
|||
}
|
||||
|
||||
static int emit_cat1(struct ir3_instruction *instr, void *ptr,
|
||||
struct ir3_shader_info *info)
|
||||
struct ir3_info *info)
|
||||
{
|
||||
struct ir3_register *dst = instr->regs[0];
|
||||
struct ir3_register *src = instr->regs[1];
|
||||
|
@ -192,7 +192,7 @@ static int emit_cat1(struct ir3_instruction *instr, void *ptr,
|
|||
}
|
||||
|
||||
static int emit_cat2(struct ir3_instruction *instr, void *ptr,
|
||||
struct ir3_shader_info *info)
|
||||
struct ir3_info *info)
|
||||
{
|
||||
struct ir3_register *dst = instr->regs[0];
|
||||
struct ir3_register *src1 = instr->regs[1];
|
||||
|
@ -273,7 +273,7 @@ static int emit_cat2(struct ir3_instruction *instr, void *ptr,
|
|||
}
|
||||
|
||||
static int emit_cat3(struct ir3_instruction *instr, void *ptr,
|
||||
struct ir3_shader_info *info)
|
||||
struct ir3_info *info)
|
||||
{
|
||||
struct ir3_register *dst = instr->regs[0];
|
||||
struct ir3_register *src1 = instr->regs[1];
|
||||
|
@ -368,7 +368,7 @@ static int emit_cat3(struct ir3_instruction *instr, void *ptr,
|
|||
}
|
||||
|
||||
static int emit_cat4(struct ir3_instruction *instr, void *ptr,
|
||||
struct ir3_shader_info *info)
|
||||
struct ir3_info *info)
|
||||
{
|
||||
struct ir3_register *dst = instr->regs[0];
|
||||
struct ir3_register *src = instr->regs[1];
|
||||
|
@ -416,7 +416,7 @@ static int emit_cat4(struct ir3_instruction *instr, void *ptr,
|
|||
}
|
||||
|
||||
static int emit_cat5(struct ir3_instruction *instr, void *ptr,
|
||||
struct ir3_shader_info *info)
|
||||
struct ir3_info *info)
|
||||
{
|
||||
struct ir3_register *dst = instr->regs[0];
|
||||
struct ir3_register *src1 = instr->regs[1];
|
||||
|
@ -470,7 +470,7 @@ static int emit_cat5(struct ir3_instruction *instr, void *ptr,
|
|||
}
|
||||
|
||||
static int emit_cat6(struct ir3_instruction *instr, void *ptr,
|
||||
struct ir3_shader_info *info)
|
||||
struct ir3_info *info)
|
||||
{
|
||||
struct ir3_register *dst = instr->regs[0];
|
||||
struct ir3_register *src = instr->regs[1];
|
||||
|
@ -534,11 +534,11 @@ static int emit_cat6(struct ir3_instruction *instr, void *ptr,
|
|||
}
|
||||
|
||||
static int (*emit[])(struct ir3_instruction *instr, void *ptr,
|
||||
struct ir3_shader_info *info) = {
|
||||
struct ir3_info *info) = {
|
||||
emit_cat0, emit_cat1, emit_cat2, emit_cat3, emit_cat4, emit_cat5, emit_cat6,
|
||||
};
|
||||
|
||||
void * ir3_shader_assemble(struct ir3_shader *shader, struct ir3_shader_info *info)
|
||||
void * ir3_assemble(struct ir3 *shader, struct ir3_info *info)
|
||||
{
|
||||
uint32_t *ptr, *dwords;
|
||||
uint32_t i;
|
||||
|
@ -572,7 +572,7 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct ir3_register * reg_create(struct ir3_shader *shader,
|
||||
static struct ir3_register * reg_create(struct ir3 *shader,
|
||||
int num, int flags)
|
||||
{
|
||||
struct ir3_register *reg =
|
||||
|
@ -583,7 +583,7 @@ static struct ir3_register * reg_create(struct ir3_shader *shader,
|
|||
return reg;
|
||||
}
|
||||
|
||||
static void insert_instr(struct ir3_shader *shader,
|
||||
static void insert_instr(struct ir3 *shader,
|
||||
struct ir3_instruction *instr)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -598,7 +598,7 @@ static void insert_instr(struct ir3_shader *shader,
|
|||
shader->instrs[shader->instrs_count++] = instr;
|
||||
}
|
||||
|
||||
struct ir3_block * ir3_block_create(struct ir3_shader *shader,
|
||||
struct ir3_block * ir3_block_create(struct ir3 *shader,
|
||||
unsigned ntmp, unsigned nin, unsigned nout)
|
||||
{
|
||||
struct ir3_block *block;
|
||||
|
|
|
@ -32,13 +32,13 @@
|
|||
|
||||
/* low level intermediate representation of an adreno shader program */
|
||||
|
||||
struct ir3_shader;
|
||||
struct ir3;
|
||||
struct ir3_instruction;
|
||||
struct ir3_block;
|
||||
|
||||
struct ir3_shader * fd_asm_parse(const char *src);
|
||||
struct ir3 * fd_asm_parse(const char *src);
|
||||
|
||||
struct ir3_shader_info {
|
||||
struct ir3_info {
|
||||
uint16_t sizedwords;
|
||||
uint16_t instrs_count; /* expanded to account for rpt's */
|
||||
/* NOTE: max_reg, etc, does not include registers not touched
|
||||
|
@ -219,7 +219,7 @@ struct ir3_instruction {
|
|||
|
||||
struct ir3_heap_chunk;
|
||||
|
||||
struct ir3_shader {
|
||||
struct ir3 {
|
||||
unsigned instrs_count, instrs_sz;
|
||||
struct ir3_instruction **instrs;
|
||||
unsigned heap_idx;
|
||||
|
@ -227,7 +227,7 @@ struct ir3_shader {
|
|||
};
|
||||
|
||||
struct ir3_block {
|
||||
struct ir3_shader *shader;
|
||||
struct ir3 *shader;
|
||||
unsigned ntemporaries, ninputs, noutputs;
|
||||
/* maps TGSI_FILE_TEMPORARY index back to the assigning instruction: */
|
||||
struct ir3_instruction **temporaries;
|
||||
|
@ -239,13 +239,13 @@ struct ir3_block {
|
|||
struct ir3_instruction *head;
|
||||
};
|
||||
|
||||
struct ir3_shader * ir3_shader_create(void);
|
||||
void ir3_shader_destroy(struct ir3_shader *shader);
|
||||
void * ir3_shader_assemble(struct ir3_shader *shader,
|
||||
struct ir3_shader_info *info);
|
||||
void * ir3_alloc(struct ir3_shader *shader, int sz);
|
||||
struct ir3 * ir3_create(void);
|
||||
void ir3_destroy(struct ir3 *shader);
|
||||
void * ir3_assemble(struct ir3 *shader,
|
||||
struct ir3_info *info);
|
||||
void * ir3_alloc(struct ir3 *shader, int sz);
|
||||
|
||||
struct ir3_block * ir3_block_create(struct ir3_shader *shader,
|
||||
struct ir3_block * ir3_block_create(struct ir3 *shader,
|
||||
unsigned ntmp, unsigned nin, unsigned nout);
|
||||
|
||||
struct ir3_instruction * ir3_instr_create(struct ir3_block *block,
|
||||
|
@ -265,7 +265,7 @@ static inline bool ir3_instr_check_mark(struct ir3_instruction *instr)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline void ir3_shader_clear_mark(struct ir3_shader *shader)
|
||||
static inline void ir3_clear_mark(struct ir3 *shader)
|
||||
{
|
||||
/* TODO would be nice to drop the instruction array.. for
|
||||
* new compiler, _clear_mark() is all we use it for, and
|
||||
|
@ -388,8 +388,8 @@ static inline bool reg_gpr(struct ir3_register *r)
|
|||
|
||||
/* dump: */
|
||||
#include <stdio.h>
|
||||
void ir3_shader_dump(struct ir3_shader *shader, const char *name,
|
||||
struct ir3_block *block /* XXX maybe 'block' ptr should move to ir3_shader? */,
|
||||
void ir3_dump(struct ir3 *shader, const char *name,
|
||||
struct ir3_block *block /* XXX maybe 'block' ptr should move to ir3? */,
|
||||
FILE *f);
|
||||
void ir3_dump_instr_single(struct ir3_instruction *instr);
|
||||
void ir3_dump_instr_list(struct ir3_instruction *instr);
|
||||
|
|
|
@ -153,6 +153,6 @@ static void block_cp(struct ir3_block *block)
|
|||
|
||||
void ir3_block_cp(struct ir3_block *block)
|
||||
{
|
||||
ir3_shader_clear_mark(block->shader);
|
||||
ir3_clear_mark(block->shader);
|
||||
block_cp(block);
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ void ir3_block_depth(struct ir3_block *block)
|
|||
|
||||
block->head = NULL;
|
||||
|
||||
ir3_shader_clear_mark(block->shader);
|
||||
ir3_clear_mark(block->shader);
|
||||
for (i = 0; i < block->noutputs; i++)
|
||||
if (block->outputs[i])
|
||||
ir3_instr_depth(block->outputs[i]);
|
||||
|
|
|
@ -372,14 +372,14 @@ static void ir3_block_dump(struct ir3_dump_ctx *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
void ir3_shader_dump(struct ir3_shader *shader, const char *name,
|
||||
struct ir3_block *block /* XXX maybe 'block' ptr should move to ir3_shader? */,
|
||||
void ir3_dump(struct ir3 *shader, const char *name,
|
||||
struct ir3_block *block /* XXX maybe 'block' ptr should move to ir3? */,
|
||||
FILE *f)
|
||||
{
|
||||
struct ir3_dump_ctx ctx = {
|
||||
.f = f,
|
||||
};
|
||||
ir3_shader_clear_mark(shader);
|
||||
ir3_clear_mark(shader);
|
||||
fprintf(ctx.f, "digraph G {\n");
|
||||
fprintf(ctx.f, "rankdir=RL;\n");
|
||||
fprintf(ctx.f, "nodesep=0.25;\n");
|
||||
|
|
|
@ -146,7 +146,7 @@ int ir3_block_flatten(struct ir3_block *block)
|
|||
};
|
||||
unsigned i;
|
||||
|
||||
ir3_shader_clear_mark(block->shader);
|
||||
ir3_clear_mark(block->shader);
|
||||
for(i = 0; i < block->noutputs; i++)
|
||||
if (block->outputs[i])
|
||||
ir3_instr_flatten(&ctx, block->outputs[i]);
|
||||
|
|
|
@ -588,7 +588,7 @@ static void ir3_instr_ra(struct ir3_ra_ctx *ctx,
|
|||
static void legalize(struct ir3_ra_ctx *ctx, struct ir3_block *block)
|
||||
{
|
||||
struct ir3_instruction *n;
|
||||
struct ir3_shader *shader = block->shader;
|
||||
struct ir3 *shader = block->shader;
|
||||
struct ir3_instruction *end =
|
||||
ir3_instr_create(block, 0, OPC_END);
|
||||
struct ir3_instruction *last_input = NULL;
|
||||
|
@ -782,7 +782,7 @@ int ir3_block_ra(struct ir3_block *block, enum shader_t type,
|
|||
};
|
||||
int ret;
|
||||
|
||||
ir3_shader_clear_mark(block->shader);
|
||||
ir3_clear_mark(block->shader);
|
||||
ret = block_ra(&ctx, block);
|
||||
*has_samp = ctx.has_samp;
|
||||
|
||||
|
|
|
@ -396,6 +396,6 @@ static void block_sched(struct ir3_sched_ctx *ctx, struct ir3_block *block)
|
|||
void ir3_block_sched(struct ir3_block *block)
|
||||
{
|
||||
struct ir3_sched_ctx ctx = {0};
|
||||
ir3_shader_clear_mark(block->shader);
|
||||
ir3_clear_mark(block->shader);
|
||||
block_sched(&ctx, block);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue