ir3: Remove IR3_REG_DEST

This was needed because code iterating the regs array needed to know
what was a destination and what wasn't, but now we have separate srcs
and dsts arrays so it's not needed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
This commit is contained in:
Connor Abbott 2021-06-18 17:44:15 +02:00 committed by Marge Bot
parent def96adaee
commit 3dc8c59858
6 changed files with 17 additions and 20 deletions

View File

@ -469,7 +469,6 @@ void ir3_instr_add_dep(struct ir3_instruction *instr, struct ir3_instruction *de
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);
@ -486,7 +485,7 @@ struct ir3_register * ir3_dst_create(struct ir3_instruction *instr,
#ifdef DEBUG
debug_assert(instr->dsts_count < instr->dsts_max);
#endif
struct ir3_register *reg = reg_create(shader, num, flags | IR3_REG_DEST);
struct ir3_register *reg = reg_create(shader, num, flags);
instr->dsts[instr->dsts_count++] = reg;
return reg;
}
@ -505,10 +504,8 @@ void ir3_reg_set_last_array(struct ir3_instruction *instr,
struct ir3_register *last_write)
{
assert(reg->flags & IR3_REG_ARRAY);
assert(reg->flags & IR3_REG_DEST);
struct ir3_register *new_reg = ir3_src_create(instr, 0, 0);
*new_reg = *reg;
new_reg->flags &= ~IR3_REG_DEST;
new_reg->def = last_write;
ir3_reg_tie(reg, new_reg);
}
@ -523,7 +520,7 @@ ir3_instr_set_address(struct ir3_instruction *instr,
debug_assert(instr->block == addr->block);
instr->address = ir3_src_create(instr, addr->dsts[0]->num,
addr->dsts[0]->flags & ~IR3_REG_DEST);
addr->dsts[0]->flags);
instr->address->def = addr->dsts[0];
debug_assert(reg_num(addr->dsts[0]) == REG_A0);
unsigned comp = reg_comp(addr->dsts[0]);

View File

@ -129,10 +129,9 @@ struct ir3_register {
IR3_REG_SSA = 0x4000, /* 'instr' is ptr to assigning instr */
IR3_REG_ARRAY = 0x8000,
IR3_REG_DEST = 0x10000,
IR3_REG_KILL = 0x20000,
IR3_REG_FIRST_KILL = 0x40000,
IR3_REG_UNUSED = 0x80000,
IR3_REG_KILL = 0x10000,
IR3_REG_FIRST_KILL = 0x20000,
IR3_REG_UNUSED = 0x40000,
} flags;
/* used for cat5 instructions, but also for internal/IR level

View File

@ -2791,7 +2791,7 @@ resolve_phis(struct ir3_context *ctx, struct ir3_block *block)
if (get_block(ctx, nsrc->pred) == pred) {
if (nsrc->src.ssa->parent_instr->type == nir_instr_type_ssa_undef) {
/* Create an ir3 undef */
ir3_src_create(phi, INVALID_REG, phi->dsts[0]->flags & ~IR3_REG_DEST);
ir3_src_create(phi, INVALID_REG, phi->dsts[0]->flags);
} else {
struct ir3_instruction *src = ir3_get_src(ctx, &nsrc->src)[0];
__ssa_src(phi, src, 0);

View File

@ -449,7 +449,7 @@ create_parallel_copy(struct ir3_block *block)
!phi->srcs[pred_idx]->def)
continue;
phi->srcs[pred_idx]->def = pcopy->dsts[j];
phi->srcs[pred_idx]->flags = pcopy->dsts[j]->flags & ~IR3_REG_DEST;
phi->srcs[pred_idx]->flags = pcopy->dsts[j]->flags;
j++;
}
assert(j == phi_count);

View File

@ -185,7 +185,8 @@ static void print_ssa_name(struct log_stream *stream, struct ir3_register *reg,
mesa_log_stream_printf(stream, "("SYN_REG("r%u.%c")")", reg_num(reg), "xyzw"[reg_comp(reg)]);
}
static void print_reg_name(struct log_stream *stream, struct ir3_instruction *instr, struct ir3_register *reg)
static void print_reg_name(struct log_stream *stream, struct ir3_instruction *instr,
struct ir3_register *reg, bool dest)
{
if ((reg->flags & (IR3_REG_FABS | IR3_REG_SABS)) &&
(reg->flags & (IR3_REG_FNEG | IR3_REG_SNEG | IR3_REG_BNOT)))
@ -219,7 +220,7 @@ static void print_reg_name(struct log_stream *stream, struct ir3_instruction *in
mesa_log_stream_printf(stream, SYN_IMMED("imm[%f,%d,0x%x]"), reg->fim_val, reg->iim_val, reg->iim_val);
} else if (reg->flags & IR3_REG_ARRAY) {
if (reg->flags & IR3_REG_SSA) {
print_ssa_name(stream, reg, reg->flags & IR3_REG_DEST);
print_ssa_name(stream, reg, dest);
mesa_log_stream_printf(stream, ":");
}
mesa_log_stream_printf(stream, SYN_ARRAY("arr[id=%u, offset=%d, size=%u]"), reg->array.id,
@ -228,7 +229,7 @@ static void print_reg_name(struct log_stream *stream, struct ir3_instruction *in
mesa_log_stream_printf(stream, "("SYN_REG("r%u.%c")")", reg->array.base >> 2,
"xyzw"[reg->array.base & 0x3]);
} else if (reg->flags & IR3_REG_SSA) {
print_ssa_name(stream, reg, reg->flags & IR3_REG_DEST);
print_ssa_name(stream, reg, dest);
} else if (reg->flags & IR3_REG_RELATIV) {
if (reg->flags & IR3_REG_CONST)
mesa_log_stream_printf(stream, SYN_CONST("c<a0.x + %d>"), reg->array.offset);
@ -280,14 +281,14 @@ print_instr(struct log_stream *stream, struct ir3_instruction *instr, int lvl)
continue;
if (!first)
mesa_log_stream_printf(stream, ", ");
print_reg_name(stream, instr, reg);
print_reg_name(stream, instr, reg, true);
first = false;
}
for (unsigned i = 0; i < instr->srcs_count; i++) {
struct ir3_register *reg = instr->srcs[i];
if (!first)
mesa_log_stream_printf(stream, ", ");
print_reg_name(stream, instr, reg);
print_reg_name(stream, instr, reg, false);
first = false;
}
}
@ -337,14 +338,14 @@ print_instr(struct log_stream *stream, struct ir3_instruction *instr, int lvl)
mesa_log_stream_printf(stream, " %sp0.%c (",
instr->cat0.inv1 ? "!" : "",
"xyzw"[instr->cat0.comp1 & 0x3]);
print_reg_name(stream, instr, instr->srcs[0]);
print_reg_name(stream, instr, instr->srcs[0], false);
mesa_log_stream_printf(stream, "), ");
}
if (brinfo[instr->cat0.brtype].nsrc >= 2) {
mesa_log_stream_printf(stream, " %sp0.%c (",
instr->cat0.inv2 ? "!" : "",
"xyzw"[instr->cat0.comp2 & 0x3]);
print_reg_name(stream, instr, instr->srcs[1]);
print_reg_name(stream, instr, instr->srcs[1], false);
mesa_log_stream_printf(stream, "), ");
}
}

View File

@ -1179,7 +1179,7 @@ insert_parallel_copy_instr(struct ra_ctx *ctx, struct ir3_instruction *instr)
struct ra_parallel_copy *entry = &ctx->parallel_copies[i];
struct ir3_register *reg =
ir3_src_create(pcopy, INVALID_REG,
entry->interval->interval.reg->flags & ~(IR3_REG_DEST | IR3_REG_SSA));
entry->interval->interval.reg->flags & ~IR3_REG_SSA);
reg->size = entry->interval->interval.reg->size;
reg->wrmask = entry->interval->interval.reg->wrmask;
assign_reg(pcopy, reg, ra_physreg_to_num(entry->src, reg->flags));
@ -1624,7 +1624,7 @@ insert_liveout_copy(struct ir3_block *block, physreg_t dst, physreg_t src,
}
struct ir3_register *src_reg =
ir3_src_create(pcopy, INVALID_REG, reg->flags & ~(IR3_REG_DEST | IR3_REG_SSA));
ir3_src_create(pcopy, INVALID_REG, reg->flags & ~IR3_REG_SSA);
src_reg->wrmask = reg->wrmask;
src_reg->size = reg->size;
assign_reg(pcopy, src_reg, ra_physreg_to_num(src, reg->flags));