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 <jason.ekstrand@intel.com>
This commit is contained in:
Eduardo Lima Mitev 2015-10-22 15:25:23 +02:00
parent 96b22fb080
commit 94ff35204d
6 changed files with 10 additions and 9 deletions

View file

@ -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 \

View file

@ -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);

View file

@ -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 \

View file

@ -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);
}

View file

@ -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

View file

@ -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;