diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index 892dad94f6a..5ba9134909f 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -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]); diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 3c9ae1668ad..2bd2eebc83e 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -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 diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 49484b1d9cc..a9f3730b238 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -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); diff --git a/src/freedreno/ir3/ir3_merge_regs.c b/src/freedreno/ir3/ir3_merge_regs.c index 79b2fc918c0..30ed2b578c3 100644 --- a/src/freedreno/ir3/ir3_merge_regs.c +++ b/src/freedreno/ir3/ir3_merge_regs.c @@ -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); diff --git a/src/freedreno/ir3/ir3_print.c b/src/freedreno/ir3/ir3_print.c index 02c9474e2c1..db2190a565d 100644 --- a/src/freedreno/ir3/ir3_print.c +++ b/src/freedreno/ir3/ir3_print.c @@ -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"), 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, "), "); } } diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c index aaf14be93d2..2a43a21c0ef 100644 --- a/src/freedreno/ir3/ir3_ra.c +++ b/src/freedreno/ir3/ir3_ra.c @@ -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));