pan/midgard: De-special-case branching

It's not that special.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-07-30 12:20:24 -07:00
parent 3e47a1181b
commit 29416a8599
6 changed files with 11 additions and 30 deletions

View file

@ -193,7 +193,12 @@ v_alu_br_compact_cond(midgard_jmp_writeout_op op, unsigned tag, signed offset, u
.unit = ALU_ENAB_BR_COMPACT,
.prepacked_branch = true,
.compact_branch = true,
.br_compact = compact
.br_compact = compact,
.ssa_args = {
.dest = -1,
.src0 = -1,
.src1 = -1,
}
};
if (op == midgard_jmp_writeout_op_writeout)
@ -212,6 +217,11 @@ v_branch(bool conditional, bool invert)
.branch = {
.conditional = conditional,
.invert_conditional = invert
},
.ssa_args = {
.dest = -1,
.src0 = -1,
.src1 = -1
}
};
@ -1744,9 +1754,6 @@ inline_alu_constants(compiler_context *ctx)
/* If there is already a constant here, we can do nothing */
if (alu->has_constants) continue;
/* It makes no sense to inline constants on a branch */
if (alu->compact_branch || alu->prepacked_branch) continue;
CONDITIONAL_ATTACH(src0);
if (!alu->has_constants) {

View file

@ -31,9 +31,6 @@
static bool
midgard_is_live_in_instr(midgard_instruction *ins, int src)
{
if (ins->compact_branch)
return false;
if (ins->ssa_args.src0 == src)
return true;

View file

@ -63,8 +63,6 @@ midgard_opt_dead_move_eliminate(compiler_context *ctx, midgard_block *block)
bool overwritten = false;
mir_foreach_instr_in_block_from(block, q, mir_next_op(ins)) {
if (q->compact_branch) continue;
/* Check if used */
if (mir_has_arg(q, ins->ssa_args.dest))
break;

View file

@ -418,8 +418,6 @@ mir_lower_special_reads(compiler_context *ctx)
/* Pass #1 is analysis, a linear scan to fill out the bitfields */
mir_foreach_instr_global(ctx, ins) {
if (ins->compact_branch) continue;
switch (ins->type) {
case TAG_ALU_4:
mark_node_class(aluw, ins->ssa_args.dest);
@ -497,7 +495,6 @@ mir_lower_special_reads(compiler_context *ctx)
/* Insert move after each write */
mir_foreach_instr_global_safe(ctx, pre_use) {
if (pre_use->compact_branch) continue;
if (pre_use->ssa_args.dest != i)
continue;
@ -561,7 +558,6 @@ allocate_registers(compiler_context *ctx, bool *spilled)
unsigned *found_class = calloc(sizeof(unsigned), ctx->temp_count);
mir_foreach_instr_global(ctx, ins) {
if (ins->compact_branch) continue;
if (ins->ssa_args.dest < 0) continue;
if (ins->ssa_args.dest >= SSA_FIXED_MINIMUM) continue;
@ -583,8 +579,6 @@ allocate_registers(compiler_context *ctx, bool *spilled)
* nodes (TODO) */
mir_foreach_instr_global(ctx, ins) {
if (ins->compact_branch) continue;
/* Check if this operation imposes any classes */
if (ins->type == TAG_LOAD_STORE_4) {
@ -608,8 +602,6 @@ allocate_registers(compiler_context *ctx, bool *spilled)
/* Check that the semantics of the class are respected */
mir_foreach_instr_global(ctx, ins) {
if (ins->compact_branch) continue;
assert(check_write_class(found_class, ins->type, ins->ssa_args.dest));
assert(check_read_class(found_class, ins->type, ins->ssa_args.src0));
@ -637,8 +629,6 @@ allocate_registers(compiler_context *ctx, bool *spilled)
mir_foreach_block(ctx, block) {
mir_foreach_instr_in_block(block, ins) {
if (ins->compact_branch) continue;
if (ins->ssa_args.dest < SSA_FIXED_MINIMUM) {
/* If this destination is not yet live, it is
* now since we just wrote it */
@ -864,7 +854,6 @@ install_registers(compiler_context *ctx, struct ra_graph *g)
{
mir_foreach_block(ctx, block) {
mir_foreach_instr_in_block(block, ins) {
if (ins->compact_branch) continue;
install_registers_instr(ctx, g, ins);
}
}

View file

@ -48,11 +48,6 @@ mir_pipeline_ins(
midgard_instruction *ins = bundle->instructions[i];
unsigned dest = ins->ssa_args.dest;
/* Check to make sure we're legal */
if (ins->compact_branch)
return false;
/* We could be pipelining a register, so we need to make sure that all
* of the components read in this bundle are written in this bundle,
* and that no components are written before this bundle */

View file

@ -686,8 +686,6 @@ mir_squeeze_index(compiler_context *ctx)
ctx->hash_to_temp = _mesa_hash_table_u64_create(NULL);
mir_foreach_instr_global(ctx, ins) {
if (ins->compact_branch) continue;
ins->ssa_args.dest = find_or_allocate_temp(ctx, ins->ssa_args.dest);
ins->ssa_args.src0 = find_or_allocate_temp(ctx, ins->ssa_args.src0);
@ -808,7 +806,6 @@ schedule_program(compiler_context *ctx)
if (!is_special || is_special_w) {
mir_foreach_instr_global_safe(ctx, ins) {
if (ins->compact_branch) continue;
if (ins->ssa_args.dest != spill_node) continue;
midgard_instruction st;
@ -843,8 +840,6 @@ schedule_program(compiler_context *ctx)
unsigned consecutive_index = 0;
mir_foreach_instr_in_block(block, ins) {
if (ins->compact_branch) continue;
/* We can't rewrite the move used to spill in the first place */
if (ins == spill_move) continue;