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;
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);
}
assert(!so->ir);
- so->ir = ir3_shader_create();
+ so->ir = ir3_create();
assert(so->ir);
out:
if (ret) {
- ir3_shader_destroy(so->ir);
+ ir3_destroy(so->ir);
so->ir = NULL;
}
compile_free(&ctx);
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;
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)) {
assert(!so->ir);
- so->ir = ir3_shader_create();
+ so->ir = ir3_create();
assert(so->ir);
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);
}
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,
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;
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;
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):
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;
/* 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;
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;
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 };
}
static int emit_cat0(struct ir3_instruction *instr, void *ptr,
- struct ir3_shader_info *info)
+ struct ir3_info *info)
{
instr_cat0_t *cat0 = ptr;
}
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];
}
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];
}
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];
}
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];
}
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];
}
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];
}
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;
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 =
return reg;
}
-static void insert_instr(struct ir3_shader *shader,
+static void insert_instr(struct ir3 *shader,
struct ir3_instruction *instr)
{
#ifdef DEBUG
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;
/* 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
struct ir3_heap_chunk;
-struct ir3_shader {
+struct ir3 {
unsigned instrs_count, instrs_sz;
struct ir3_instruction **instrs;
unsigned heap_idx;
};
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;
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,
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
/* 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);
void ir3_block_cp(struct ir3_block *block)
{
- ir3_shader_clear_mark(block->shader);
+ ir3_clear_mark(block->shader);
block_cp(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]);
}
}
-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");
};
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]);
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;
};
int ret;
- ir3_shader_clear_mark(block->shader);
+ ir3_clear_mark(block->shader);
ret = block_ra(&ctx, block);
*has_samp = ctx.has_samp;
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);
}