aboutsummaryrefslogtreecommitdiffstats
path: root/src/broadcom/compiler
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-12-29 11:00:25 -0800
committerEric Anholt <[email protected]>2018-12-30 08:03:51 -0800
commitebde5afb93ef4db9fcfc53a561cef7d3e0a630f6 (patch)
tree4d49f50a6842f61b47be2c0ac5e432922d62f715 /src/broadcom/compiler
parent39b1112189402affc341f2a85105a9cb68077edd (diff)
v3d: Move "does this instruction have flags" from sched to generic helpers.
I wanted to reuse it for DCE of flags updates.
Diffstat (limited to 'src/broadcom/compiler')
-rw-r--r--src/broadcom/compiler/qpu_schedule.c43
-rw-r--r--src/broadcom/compiler/v3d_compiler.h1
-rw-r--r--src/broadcom/compiler/vir.c11
-rw-r--r--src/broadcom/compiler/vir_opt_dead_code.c5
4 files changed, 5 insertions, 55 deletions
diff --git a/src/broadcom/compiler/qpu_schedule.c b/src/broadcom/compiler/qpu_schedule.c
index 95494a1412a..be794a88c14 100644
--- a/src/broadcom/compiler/qpu_schedule.c
+++ b/src/broadcom/compiler/qpu_schedule.c
@@ -246,30 +246,6 @@ process_waddr_deps(struct schedule_state *state, struct schedule_node *n,
}
}
-static void
-process_cond_deps(struct schedule_state *state, struct schedule_node *n,
- enum v3d_qpu_cond cond)
-{
- if (cond != V3D_QPU_COND_NONE)
- add_read_dep(state, state->last_sf, n);
-}
-
-static void
-process_pf_deps(struct schedule_state *state, struct schedule_node *n,
- enum v3d_qpu_pf pf)
-{
- if (pf != V3D_QPU_PF_NONE)
- add_write_dep(state, &state->last_sf, n);
-}
-
-static void
-process_uf_deps(struct schedule_state *state, struct schedule_node *n,
- enum v3d_qpu_uf uf)
-{
- if (uf != V3D_QPU_UF_NONE)
- add_write_dep(state, &state->last_sf, n);
-}
-
/**
* Common code for dependencies that need to be tracked both forward and
* backward.
@@ -350,15 +326,6 @@ calculate_deps(struct schedule_state *state, struct schedule_node *n)
add_write_dep(state, &state->last_tlb, n);
break;
- case V3D_QPU_A_FLAPUSH:
- case V3D_QPU_A_FLBPUSH:
- case V3D_QPU_A_VFLA:
- case V3D_QPU_A_VFLNA:
- case V3D_QPU_A_VFLB:
- case V3D_QPU_A_VFLNB:
- add_read_dep(state, state->last_sf, n);
- break;
-
default:
break;
}
@@ -441,12 +408,10 @@ calculate_deps(struct schedule_state *state, struct schedule_node *n)
if (qinst->uniform != ~0)
add_write_dep(state, &state->last_unif, n);
- process_cond_deps(state, n, inst->flags.ac);
- process_cond_deps(state, n, inst->flags.mc);
- process_pf_deps(state, n, inst->flags.apf);
- process_pf_deps(state, n, inst->flags.mpf);
- process_uf_deps(state, n, inst->flags.auf);
- process_uf_deps(state, n, inst->flags.muf);
+ if (v3d_qpu_reads_flags(inst))
+ add_read_dep(state, state->last_sf, n);
+ if (v3d_qpu_writes_flags(inst))
+ add_write_dep(state, &state->last_sf, n);
}
static void
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 2d9167a27a0..c7f2f148ac0 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -769,7 +769,6 @@ bool vir_is_tex(struct qinst *inst);
bool vir_is_add(struct qinst *inst);
bool vir_is_mul(struct qinst *inst);
bool vir_is_float_input(struct qinst *inst);
-bool vir_depends_on_flags(struct qinst *inst);
bool vir_writes_r3(const struct v3d_device_info *devinfo, struct qinst *inst);
bool vir_writes_r4(const struct v3d_device_info *devinfo, struct qinst *inst);
struct qreg vir_follow_movs(struct v3d_compile *c, struct qreg reg);
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index 8880a282045..f49140bcb90 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -204,17 +204,6 @@ vir_is_tex(struct qinst *inst)
}
bool
-vir_depends_on_flags(struct qinst *inst)
-{
- if (inst->qpu.type == V3D_QPU_INSTR_TYPE_BRANCH) {
- return (inst->qpu.branch.cond != V3D_QPU_BRANCH_COND_ALWAYS);
- } else {
- return (inst->qpu.flags.ac != V3D_QPU_COND_NONE &&
- inst->qpu.flags.mc != V3D_QPU_COND_NONE);
- }
-}
-
-bool
vir_writes_r3(const struct v3d_device_info *devinfo, struct qinst *inst)
{
for (int i = 0; i < vir_get_nsrc(inst); i++) {
diff --git a/src/broadcom/compiler/vir_opt_dead_code.c b/src/broadcom/compiler/vir_opt_dead_code.c
index 4aedbb6540f..9c93846e9b8 100644
--- a/src/broadcom/compiler/vir_opt_dead_code.c
+++ b/src/broadcom/compiler/vir_opt_dead_code.c
@@ -47,10 +47,7 @@ dce(struct v3d_compile *c, struct qinst *inst)
vir_dump_inst(c, inst);
fprintf(stderr, "\n");
}
- assert(inst->qpu.flags.apf == V3D_QPU_PF_NONE);
- assert(inst->qpu.flags.mpf == V3D_QPU_PF_NONE);
- assert(inst->qpu.flags.auf == V3D_QPU_UF_NONE);
- assert(inst->qpu.flags.muf == V3D_QPU_UF_NONE);
+ assert(!v3d_qpu_writes_flags(&inst->qpu));
vir_remove_instruction(c, inst);
}