diff options
author | Jason Ekstrand <[email protected]> | 2015-01-22 14:15:27 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-29 17:07:45 -0800 |
commit | d8999bcdce6a3c8ab63f06c7028fd6e927bb9acb (patch) | |
tree | 6230d336d20d51c99af44b788093ceb31fd1659f /src/glsl/nir/nir_search.h | |
parent | 5ab1489ae62fa68e45664588d8809b3d667d7425 (diff) |
nir/search: Add support for matching unknown constants
There are some algebraic transformations that we want to do but only if
certain things are constants. For instance, we may want to replace
a * (b + c) with (a * b) + (a * c) as long as a and either b or c is constant.
While this generates more instructions, some of it will get constant
folded.
nir_algebraic.py doesn't handle this yet, but that's ok because the C
language will make sure that false is the default for now.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_search.h')
-rw-r--r-- | src/glsl/nir/nir_search.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_search.h b/src/glsl/nir/nir_search.h index 8ec58b07139..18aa28dcc66 100644 --- a/src/glsl/nir/nir_search.h +++ b/src/glsl/nir/nir_search.h @@ -47,6 +47,13 @@ typedef struct { /** The variable index; Must be less than NIR_SEARCH_MAX_VARIABLES */ unsigned variable; + + /** Indicates that the given variable must be a constant + * + * This is only alloed in search expressions and indicates that the + * given variable is only allowed to match constant values. + */ + bool is_constant; } nir_search_variable; typedef struct { |