aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Lima Mitev <[email protected]>2015-10-22 15:25:23 +0200
committerEduardo Lima Mitev <[email protected]>2015-11-10 21:13:35 +0100
commit94ff35204dba0ddbd7f5c4342206c8acba22d32f (patch)
tree24ffbd63b7184b28da364307da7837c2295f1eac
parent96b22fb080894ba1840af2372f28a46cc0f40c76 (diff)
nir/nir_opt_peephole_ffma: Move this lowering pass to the i965 driver
Because the next patch will add an optimization that is specific to i965, we want to move this loweing pass to that driver altogether. This is safe because i965 is the only consumer. Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/glsl/Makefile.sources1
-rw-r--r--src/glsl/nir/nir.h1
-rw-r--r--src/mesa/drivers/dri/i965/Makefile.sources1
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c (renamed from src/glsl/nir/nir_opt_peephole_ffma.c)12
6 files changed, 10 insertions, 9 deletions
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index 78d295b8e91..d4b02c17b0d 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -67,7 +67,6 @@ NIR_FILES = \
nir/nir_opt_dead_cf.c \
nir/nir_opt_gcm.c \
nir/nir_opt_global_to_local.c \
- nir/nir_opt_peephole_ffma.c \
nir/nir_opt_peephole_select.c \
nir/nir_opt_remove_phis.c \
nir/nir_opt_undef.c \
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 13ebbcae564..4ed2cbd2b67 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -2029,7 +2029,6 @@ bool nir_opt_dead_cf(nir_shader *shader);
void nir_opt_gcm(nir_shader *shader);
bool nir_opt_peephole_select(nir_shader *shader);
-bool nir_opt_peephole_ffma(nir_shader *shader);
bool nir_opt_remove_phis(nir_shader *shader);
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
index 434583defe3..f5e84cb7f65 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -46,6 +46,7 @@ i965_compiler_FILES = \
brw_nir.h \
brw_nir.c \
brw_nir_analyze_boolean_resolves.c \
+ brw_nir_opt_peephole_ffma.c \
brw_nir_uniforms.cpp \
brw_packed_float.c \
brw_predicated_break.cpp \
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
index dece208233f..fe5cad4e435 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -293,7 +293,7 @@ brw_create_nir(struct brw_context *brw,
if (brw->gen >= 6) {
/* Try and fuse multiply-adds */
- nir_opt_peephole_ffma(nir);
+ brw_nir_opt_peephole_ffma(nir);
nir_validate_shader(nir);
}
diff --git a/src/mesa/drivers/dri/i965/brw_nir.h b/src/mesa/drivers/dri/i965/brw_nir.h
index b4a6dc0f825..e7c93684fb3 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.h
+++ b/src/mesa/drivers/dri/i965/brw_nir.h
@@ -94,6 +94,8 @@ void brw_nir_setup_glsl_uniforms(nir_shader *shader,
void brw_nir_setup_arb_uniforms(nir_shader *shader, struct gl_program *prog,
struct brw_stage_prog_data *stage_prog_data);
+bool brw_nir_opt_peephole_ffma(nir_shader *shader);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/glsl/nir/nir_opt_peephole_ffma.c b/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c
index 4f0f0dae04e..a8448e73a3f 100644
--- a/src/glsl/nir/nir_opt_peephole_ffma.c
+++ b/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c
@@ -25,7 +25,7 @@
*
*/
-#include "nir.h"
+#include "brw_nir.h"
/*
* Implements a small peephole optimization that looks for a multiply that
@@ -134,7 +134,7 @@ get_mul_for_src(nir_alu_src *src, int num_components,
}
static bool
-nir_opt_peephole_ffma_block(nir_block *block, void *void_state)
+brw_nir_opt_peephole_ffma_block(nir_block *block, void *void_state)
{
struct peephole_ffma_state *state = void_state;
@@ -237,7 +237,7 @@ nir_opt_peephole_ffma_block(nir_block *block, void *void_state)
}
static bool
-nir_opt_peephole_ffma_impl(nir_function_impl *impl)
+brw_nir_opt_peephole_ffma_impl(nir_function_impl *impl)
{
struct peephole_ffma_state state;
@@ -245,7 +245,7 @@ nir_opt_peephole_ffma_impl(nir_function_impl *impl)
state.impl = impl;
state.progress = false;
- nir_foreach_block(impl, nir_opt_peephole_ffma_block, &state);
+ nir_foreach_block(impl, brw_nir_opt_peephole_ffma_block, &state);
if (state.progress)
nir_metadata_preserve(impl, nir_metadata_block_index |
@@ -255,13 +255,13 @@ nir_opt_peephole_ffma_impl(nir_function_impl *impl)
}
bool
-nir_opt_peephole_ffma(nir_shader *shader)
+brw_nir_opt_peephole_ffma(nir_shader *shader)
{
bool progress = false;
nir_foreach_overload(shader, overload) {
if (overload->impl)
- progress |= nir_opt_peephole_ffma_impl(overload->impl);
+ progress |= brw_nir_opt_peephole_ffma_impl(overload->impl);
}
return progress;