summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2021-06-18 16:31:03 +0200
committerMarge Bot <eric+marge@anholt.net>2021-06-23 17:20:29 +0000
commitdef96adaee49bed7473cb21488c19f6ab60ed6d3 (patch)
treed63fdd3e90769418e19b31e43f19f9d5b1d182ca /src
parent57aeef5c13538b78ad4fa88cfdc812442b64fb77 (diff)
ir3: Remove regs array
Now that everything is converted over, switch to separate src/dst arrays. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
Diffstat (limited to 'src')
-rw-r--r--src/freedreno/ir3/ir3.c38
-rw-r--r--src/freedreno/ir3/ir3.h5
-rw-r--r--src/freedreno/ir3/ir3_ra.c2
3 files changed, 14 insertions, 31 deletions
diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c
index 19e33465b3b..892dad94f6a 100644
--- a/src/freedreno/ir3/ir3.c
+++ b/src/freedreno/ir3/ir3.c
@@ -394,16 +394,16 @@ static struct ir3_instruction *instr_create(struct ir3_block *block,
if (1 <= opc_cat(opc))
nsrc += 2;
struct ir3_instruction *instr;
- unsigned sz = sizeof(*instr) + ((ndst + nsrc) * sizeof(instr->regs[0]));
+ unsigned sz = sizeof(*instr) + (ndst * sizeof(instr->dsts[0])) +
+ (nsrc * sizeof(instr->srcs[0]));
char *ptr = ir3_alloc(block->shader, sz);
instr = (struct ir3_instruction *)ptr;
ptr += sizeof(*instr);
- instr->regs = (struct ir3_register **)ptr;
instr->dsts = (struct ir3_register **)ptr;
+ instr->srcs = instr->dsts + ndst;
#ifdef DEBUG
- instr->regs_max = ndst + nsrc;
instr->dsts_max = ndst;
instr->srcs_max = nsrc;
#endif
@@ -425,21 +425,18 @@ struct ir3_instruction * ir3_instr_clone(struct ir3_instruction *instr)
{
struct ir3_instruction *new_instr = instr_create(instr->block, instr->opc,
instr->dsts_count, instr->srcs_count);
- struct ir3_register **regs, **dsts, **srcs;
+ struct ir3_register **dsts, **srcs;
unsigned i;
- regs = new_instr->regs;
dsts = new_instr->dsts;
srcs = new_instr->srcs;
*new_instr = *instr;
- new_instr->regs = regs;
new_instr->dsts = dsts;
new_instr->srcs = srcs;
insert_instr(instr->block, new_instr);
/* clone registers: */
- new_instr->regs_count = 0;
new_instr->dsts_count = 0;
new_instr->srcs_count = 0;
for (i = 0; i < instr->dsts_count; i++) {
@@ -469,40 +466,29 @@ void ir3_instr_add_dep(struct ir3_instruction *instr, struct ir3_instruction *de
array_insert(instr, instr->deps, dep);
}
-static struct ir3_register * ir3_reg_create(struct ir3_instruction *instr,
- int num, int flags)
-{
- struct ir3 *shader = instr->block->shader;
- struct ir3_register *reg = reg_create(shader, num, flags);
-#ifdef DEBUG
- debug_assert(instr->regs_count < instr->regs_max);
-#endif
- instr->regs[instr->regs_count++] = reg;
- return reg;
-}
-
struct ir3_register * ir3_src_create(struct ir3_instruction *instr,
int num, int flags)
{
assert(!(flags & IR3_REG_DEST));
+ struct ir3 *shader = instr->block->shader;
#ifdef DEBUG
debug_assert(instr->srcs_count < instr->srcs_max);
#endif
- if (instr->srcs_count == 0)
- instr->srcs = instr->regs + instr->dsts_count;
- instr->srcs_count++;
- return ir3_reg_create(instr, num, flags);
+ struct ir3_register *reg = reg_create(shader, num, flags);
+ instr->srcs[instr->srcs_count++] = reg;
+ return reg;
}
struct ir3_register * ir3_dst_create(struct ir3_instruction *instr,
int num, int flags)
{
- assert(instr->srcs_count == 0);
+ struct ir3 *shader = instr->block->shader;
#ifdef DEBUG
debug_assert(instr->dsts_count < instr->dsts_max);
#endif
- instr->dsts_count++;
- return ir3_reg_create(instr, num, flags | IR3_REG_DEST);
+ struct ir3_register *reg = reg_create(shader, num, flags | IR3_REG_DEST);
+ instr->dsts[instr->dsts_count++] = reg;
+ return reg;
}
struct ir3_register * ir3_reg_clone(struct ir3 *shader,
diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h
index fec6fe253c8..3c9ae1668ad 100644
--- a/src/freedreno/ir3/ir3.h
+++ b/src/freedreno/ir3/ir3.h
@@ -279,10 +279,9 @@ struct ir3_instruction {
uint8_t repeat;
uint8_t nop;
#ifdef DEBUG
- unsigned regs_max, srcs_max, dsts_max;
+ unsigned srcs_max, dsts_max;
#endif
- unsigned regs_count, srcs_count, dsts_count;
- struct ir3_register **regs;
+ unsigned srcs_count, dsts_count;
struct ir3_register **dsts;
struct ir3_register **srcs;
union {
diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c
index 34cb9717594..aaf14be93d2 100644
--- a/src/freedreno/ir3/ir3_ra.c
+++ b/src/freedreno/ir3/ir3_ra.c
@@ -1619,8 +1619,6 @@ insert_liveout_copy(struct ir3_block *block, physreg_t dst, physreg_t src,
dst_reg->size = reg->size;
assign_reg(pcopy, dst_reg, ra_physreg_to_num(dst, reg->flags));
- pcopy->srcs = pcopy->regs + pcopy->dsts_count;
-
for (unsigned i = 0; i < old_pcopy_srcs; i++) {
pcopy->srcs[pcopy->srcs_count++] = old_pcopy->srcs[i];
}