diff options
author | Eric Anholt <[email protected]> | 2014-07-03 13:18:49 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-08-08 18:59:47 -0700 |
commit | 1d23d55ae97d07b6eb70a3e37a91ecb7de38d8d2 (patch) | |
tree | 60fb2fe8be2c61e2681c81c65bca060ad2c4b6b3 /src/gallium/drivers/vc4/vc4_qir.c | |
parent | 4c53087c67a266d81653459baa08ece5c1b418d8 (diff) |
vc4: Add an initial pass of algebraic optimization.
There was a lot of extra noise in my piglit shader dumps because of silly
CMPs.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_qir.c')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_qir.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c index b8a8a7ca7dc..308154ff34a 100644 --- a/src/gallium/drivers/vc4/vc4_qir.c +++ b/src/gallium/drivers/vc4/vc4_qir.c @@ -171,6 +171,12 @@ qir_emit(struct qcompile *c, struct qinst *inst) insert_at_tail(&c->instructions, &inst->link); } +bool +qir_reg_equals(struct qreg a, struct qreg b) +{ + return a.file == b.file && a.index == b.index; +} + struct qcompile * qir_compile_init(void) { @@ -198,3 +204,34 @@ qir_get_stage_name(enum qstage stage) return names[stage]; } + +#define OPTPASS(func) \ + do { \ + bool stage_progress = func(c); \ + if (stage_progress) { \ + progress = true; \ + if (print_opt_debug) { \ + fprintf(stderr, \ + "QIR opt pass %2d: %s progress\n", \ + pass, #func); \ + } \ + } \ + } while (0) + +void +qir_optimize(struct qcompile *c) +{ + bool print_opt_debug = false; + int pass = 1; + + while (true) { + bool progress = false; + + OPTPASS(qir_opt_algebraic); + + if (!progress) + break; + + pass++; + } +} |