summaryrefslogtreecommitdiff
path: root/src/glsl/nir/nir.h
AgeCommit message (Collapse)AuthorFilesLines
2015-01-15util: Move main/set to util/hash_setJason Ekstrand1-1/+1
Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2015-01-15nir: Add a pass for lowering copy instructionsJason Ekstrand1-0/+3
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Rename lower_variables to lower_vars_to_ssaJason Ekstrand1-1/+1
The original name wasn't particularly descriptive. This one indicates that it actually gives you SSA values as opposed to the old pass which lowered variables to registers. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir/tex_instr: Add a nir_tex_src struct and dynamically allocate the src arrayJason Ekstrand1-10/+14
This solves a number of problems. First is the ability to change the number of sources that a texture instruction has. Second, it solves the delema that may occur if a texture instruction has more than 4 sources. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir/validate: Only build in debug modeJason Ekstrand1-0/+4
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Make intrinsic flags into an enumJason Ekstrand1-14/+14
This should be much better for debugging as GDB will pick up on the fact that it's an enum and actually tell you what you're looking at instead of giving you some arbitrary hex value you have to go look up. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Use static inlines instead of macros for list gettersJason Ekstrand1-28/+81
This should make debugging a lot easier as GDB handles static inlines much better than macros. Also, static inlines are typesafe. Reviewed-By: Glenn Kennard <glenn.kennard@gmail.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir/variable: Remove the constant_value fieldJason Ekstrand1-12/+2
This was a left-over relic of GLSL IR that we aren't using for anything. If we ever want that value again, we can add it back, but NIR constant folding should be just as good as GLSL IR's if not better pretty soon, so I'm not worried about it. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add some documentationJason Ekstrand1-22/+69
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Rename parallel_copy_copy to parallel_copy_entry and add a foreach macroJason Ekstrand1-2/+11
parallel_copy_copy was a silly name. Also, things were getting long and annoying, so I added a foreach macro. For historical reasons, several of the original iterations over parallel copy entries in from_ssa used the _safe variants of the loop. However, all of these no longer ever remove an entry so it's ok to make them all use the normal iterator. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir/from_ssa: Clean up parallel copy handling and document it betterJason Ekstrand1-7/+0
Previously, we were doing a lazy creation of the parallel copy instructions. This is confusing, hard to get right, and involves some extra state tracking of the copies. This commit adds an extra walk over the basic blocks to add the block-end parallel copies up front. This should be much less confusing and, consequently, easier to get right. This commit also adds more comments about parallel copies to help explain what all is going on. As a consequence of these changes, we can now remove the at_end parameter from nir_parallel_copy_instr. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Rename nir_block_following_if to nir_block_get_following_ifJason Ekstrand1-1/+1
The new name is a little longer but less confusing. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir/opcodes: Remove the per_component info fieldJason Ekstrand1-18/+15
Originally, this field was intended for determining if the given instruction acted per-component or if it had mismatching source and destination sizes that would have to be interpreted specially. However, we can easily derive this from output_size == 0, so it's not really that useful. Also, the values we were setting in nir_opcodes.h for this field were completely bogus and it was never used. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir/opcodes: Add algebraic properties metadataJason Ekstrand1-1/+8
This commit adds some algebraic properties to the metadata of each opcode in NIR. In particular, you now know, just from the metadata, if a given opcode is commutative or associative. This will be useful for algebraic transformation passes that want to be able to match a + b as well as b + a in one go. v2: Make algebraic properties all caps. This was more consistent with the intrinsics flags and seems better for flags in general. Also, the enums are now declared with (1 << n) rather then hex values. v3: fmin and fmax technically aren't commutative or associative. Things get funny when one of the arguments is a NaN. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Make load_const SSA-onlyJason Ekstrand1-16/+4
As it was, we weren't ever using load_const in a non-SSA way. This allows us to substantially simplify the load_const instruction. If we ever need a non-SSA constant load, we can do a load_const and an imov. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Make nir_ssa_undef_instr_create initialize the destinationJason Ekstrand1-1/+2
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a foreach_ssa_def functionJason Ekstrand1-0/+3
There are some functions whose destinations are SSA-only and so aren't a nir_dest. This provides a function that is capable of iterating over the SSA definitions defined by those functions. If you want registers, you should use the old iterator. v2: Kenneth Graunke <kenneth@whitecape.org>: - Fix nir_foreach_ssa_def's return value. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Remove predicationJason Ekstrand1-14/+0
We stopped generating predicates in glsl_to_nir some time ago. Right now, it's all dead untested code that I'm not convinced always worked in the first place. If we decide we want them back, we can revert this patch. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir/metadata: Rename metadata_dirty to metadata_preserveJason Ekstrand1-1/+1
nir_metadata_dirty was a terrible name because the parameter it takes is the metadata to be preserved. This is really confusing because it looks like it's doing the opposite of what it is actually doing. Now it's named sensibly. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir/tex_instr: Rename the indirect source type and add an array sizeJason Ekstrand1-1/+10
In particular, we rename nir_tex_src_sampler_index to _sampler_offset and add a sampler_array_size field to nir_tex_instr. This way we can pass the size of sampler arrays through to backends even after removing the variable information and, with it, the type. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Make texture instruction names more consistentJason Ekstrand1-2/+2
This commit renames nir_instr_as_texture to nir_instr_as_tex and renames nir_instr_type_texture to nir_instr_type_tex to be consistent with nir_tex_instr. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a basic constant folding passJason Ekstrand1-0/+1
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add an algebraic optimization passJason Ekstrand1-0/+2
This pass uses the previously built algebraic transformations framework and should act as an example for anyone else wanting to make an algebraic transformation pass for NIR. Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Make the type casting operations static inline functionsJason Ekstrand1-32/+32
Previously, the casting operations were macros. While this is usually fine, the casting macro used the input parameter twice leading to strange behavior when you passed the result of another function into it. Since we know the source and destination types explicitly, we don't loose anything by making it a function. Also, this gives us a nice little macro for creating cast function that will hopefully prevent mistyping. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a lowering pass for adding source modifiers where possibleJason Ekstrand1-0/+1
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a helper for getting a constant value from an SSA sourceJason Ekstrand1-0/+1
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Vectorize intrinsicsJason Ekstrand1-2/+13
We used to have the number of components built into the intrinsic. This meant that all of our load/store intrinsics had vec1, vec2, vec3, and vec4 variants. This lead to piles of switch statements to generate the correct intrinsic names, and introspection to figure out the number of components. We can make things much nicer by allowing "vectorized" intrinsics. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Remove the old variable lowering codeJason Ekstrand1-4/+0
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a pass to lower global variables to local variablesJason Ekstrand1-0/+2
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a pass for lowering input/output loads/storesJason Ekstrand1-0/+2
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a pass to lower local variables to registersJason Ekstrand1-0/+2
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a pass to lower local variable accesses to SSA valuesJason Ekstrand1-0/+2
This pass analizes all of the load/store operations and, when a variable is never aliased (potentially used by an indirect operation), it is lowered directly to an SSA value. This pass translates to SSA directly and does not require any fixup by the original to-SSA pass. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a copy splitting passJason Ekstrand1-0/+2
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Don't require a function in ssa_def_initJason Ekstrand1-3/+2
Instead, we give SSA definitions a temporary index of 0xFFFFFFFF if the instruction does not have a block and a proper index when it actually gets added to the list. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Use an integer index for specifying structure fieldsJason Ekstrand1-2/+2
Previously, we used a string name. It was nice for translating out of GLSL IR (which also does that) but cumbersome the rest of the time. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a concept of a wildcard array dereferenceJason Ekstrand1-0/+9
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Make array deref direct vs. indirect an enumJason Ekstrand1-1/+6
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a helper for rewriting an instruction sourceJason Ekstrand1-0/+1
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a basic CSE passJason Ekstrand1-0/+2
This pass is still fairly basic. It only handles ALU operations, constant loads, and phi nodes. No texture ops or intrinsics yet. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a fused multiply-add peepholeJason Ekstrand1-0/+1
2015-01-15nir: Add a peephole select optimizationJason Ekstrand1-0/+2
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a function for comparing two sourcesJason Ekstrand1-0/+2
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a parallel copy instruction typeJason Ekstrand1-0/+23
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a function for rewriting all the uses of a SSA defJason Ekstrand1-0/+1
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add an initialization function for SSA definitionsJason Ekstrand1-0/+4
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add an SSA-based liveness analysis pass.Jason Ekstrand1-0/+11
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: set reg_alloc and ssa_alloc when indexing registers and SSA valuesJason Ekstrand1-2/+2
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a function to detect if a block is immediately followed by an ifJason Ekstrand1-0/+5
Since we don't actually have an "if" instruction, this is a very common pattern when iterating over instructions. This adds a helper function for it to make things a little less painful. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a foreach_block_reverse functionJason Ekstrand1-0/+2
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15nir: Add a basic metadata management systemJason Ekstrand1-2/+19
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>