Mesa (master): freedreno/a3xx/compiler: rename ir3_shader to ir3

Rob Clark robclark at kemper.freedesktop.org
Fri Jul 25 17:31:26 UTC 2014


Module: Mesa
Branch: master
Commit: 7d7e6ae9c3544ce1889aa9b8a34545c6f42017e7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d7e6ae9c3544ce1889aa9b8a34545c6f42017e7

Author: Rob Clark <robclark at freedesktop.org>
Date:   Fri Jul 25 10:56:23 2014 -0400

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 at freedesktop.org>

---

 src/gallium/drivers/freedreno/a3xx/fd3_compiler.c  |    8 ++---
 .../drivers/freedreno/a3xx/fd3_compiler_old.c      |    6 ++--
 src/gallium/drivers/freedreno/a3xx/fd3_program.c   |    8 ++---
 src/gallium/drivers/freedreno/a3xx/fd3_program.h   |    4 +--
 src/gallium/drivers/freedreno/a3xx/ir3.c           |   38 ++++++++++----------
 src/gallium/drivers/freedreno/a3xx/ir3.h           |   28 +++++++--------
 src/gallium/drivers/freedreno/a3xx/ir3_cp.c        |    2 +-
 src/gallium/drivers/freedreno/a3xx/ir3_depth.c     |    2 +-
 src/gallium/drivers/freedreno/a3xx/ir3_dump.c      |    6 ++--
 src/gallium/drivers/freedreno/a3xx/ir3_flatten.c   |    2 +-
 src/gallium/drivers/freedreno/a3xx/ir3_ra.c        |    4 +--
 src/gallium/drivers/freedreno/a3xx/ir3_sched.c     |    2 +-
 12 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
index 3a388f8..0c22e55 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
@@ -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);
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_compiler_old.c b/src/gallium/drivers/freedreno/a3xx/fd3_compiler_old.c
index 0f7044b..66f724b 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_compiler_old.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_compiler_old.c
@@ -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);
 
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.c b/src/gallium/drivers/freedreno/a3xx/fd3_program.c
index 17f3dcf..164b152 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_program.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.c
@@ -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;
 
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.h b/src/gallium/drivers/freedreno/a3xx/fd3_program.h
index 28ad52e..e2ed1cc 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_program.h
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.h
@@ -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):
diff --git a/src/gallium/drivers/freedreno/a3xx/ir3.c b/src/gallium/drivers/freedreno/a3xx/ir3.c
index 5768718..ea2a925 100644
--- a/src/gallium/drivers/freedreno/a3xx/ir3.c
+++ b/src/gallium/drivers/freedreno/a3xx/ir3.c
@@ -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;
diff --git a/src/gallium/drivers/freedreno/a3xx/ir3.h b/src/gallium/drivers/freedreno/a3xx/ir3.h
index 9f95abd..9ed914b 100644
--- a/src/gallium/drivers/freedreno/a3xx/ir3.h
+++ b/src/gallium/drivers/freedreno/a3xx/ir3.h
@@ -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);
diff --git a/src/gallium/drivers/freedreno/a3xx/ir3_cp.c b/src/gallium/drivers/freedreno/a3xx/ir3_cp.c
index 0faed89..73c2a27 100644
--- a/src/gallium/drivers/freedreno/a3xx/ir3_cp.c
+++ b/src/gallium/drivers/freedreno/a3xx/ir3_cp.c
@@ -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);
 }
diff --git a/src/gallium/drivers/freedreno/a3xx/ir3_depth.c b/src/gallium/drivers/freedreno/a3xx/ir3_depth.c
index b84629b..dcc0362 100644
--- a/src/gallium/drivers/freedreno/a3xx/ir3_depth.c
+++ b/src/gallium/drivers/freedreno/a3xx/ir3_depth.c
@@ -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]);
diff --git a/src/gallium/drivers/freedreno/a3xx/ir3_dump.c b/src/gallium/drivers/freedreno/a3xx/ir3_dump.c
index a186d62..1a6f49d 100644
--- a/src/gallium/drivers/freedreno/a3xx/ir3_dump.c
+++ b/src/gallium/drivers/freedreno/a3xx/ir3_dump.c
@@ -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");
diff --git a/src/gallium/drivers/freedreno/a3xx/ir3_flatten.c b/src/gallium/drivers/freedreno/a3xx/ir3_flatten.c
index 00a2bf1..9389227 100644
--- a/src/gallium/drivers/freedreno/a3xx/ir3_flatten.c
+++ b/src/gallium/drivers/freedreno/a3xx/ir3_flatten.c
@@ -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]);
diff --git a/src/gallium/drivers/freedreno/a3xx/ir3_ra.c b/src/gallium/drivers/freedreno/a3xx/ir3_ra.c
index ce9e500..b916dd5 100644
--- a/src/gallium/drivers/freedreno/a3xx/ir3_ra.c
+++ b/src/gallium/drivers/freedreno/a3xx/ir3_ra.c
@@ -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;
 
diff --git a/src/gallium/drivers/freedreno/a3xx/ir3_sched.c b/src/gallium/drivers/freedreno/a3xx/ir3_sched.c
index b396284..3ef6773 100644
--- a/src/gallium/drivers/freedreno/a3xx/ir3_sched.c
+++ b/src/gallium/drivers/freedreno/a3xx/ir3_sched.c
@@ -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);
 }




More information about the mesa-commit mailing list