summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir.h
Commit message (Collapse)AuthorAgeFilesLines
* nir: Add a nir_foreach_phi_src helper macroJason Ekstrand2015-01-201-0/+3
| | | | Reviewed-by: Connor Abbott <cwabbott02gmail.com>
* util: Move main/set to util/hash_setJason Ekstrand2015-01-151-1/+1
| | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* nir: Add a pass for lowering copy instructionsJason Ekstrand2015-01-151-0/+3
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Rename lower_variables to lower_vars_to_ssaJason Ekstrand2015-01-151-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 <[email protected]>
* nir/tex_instr: Add a nir_tex_src struct and dynamically allocate the src arrayJason Ekstrand2015-01-151-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 <[email protected]>
* nir/validate: Only build in debug modeJason Ekstrand2015-01-151-0/+4
| | | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: Make intrinsic flags into an enumJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Use static inlines instead of macros for list gettersJason Ekstrand2015-01-151-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 <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/variable: Remove the constant_value fieldJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Add some documentationJason Ekstrand2015-01-151-22/+69
| | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: Rename parallel_copy_copy to parallel_copy_entry and add a foreach macroJason Ekstrand2015-01-151-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 <[email protected]>
* nir/from_ssa: Clean up parallel copy handling and document it betterJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Rename nir_block_following_if to nir_block_get_following_ifJason Ekstrand2015-01-151-1/+1
| | | | | | The new name is a little longer but less confusing. Reviewed-by: Connor Abbott <[email protected]>
* nir/opcodes: Remove the per_component info fieldJason Ekstrand2015-01-151-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 <[email protected]>
* nir/opcodes: Add algebraic properties metadataJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Make load_const SSA-onlyJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Make nir_ssa_undef_instr_create initialize the destinationJason Ekstrand2015-01-151-1/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a foreach_ssa_def functionJason Ekstrand2015-01-151-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 <[email protected]>: - Fix nir_foreach_ssa_def's return value. Reviewed-by: Connor Abbott <[email protected]>
* nir: Remove predicationJason Ekstrand2015-01-151-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 <[email protected]>
* nir/metadata: Rename metadata_dirty to metadata_preserveJason Ekstrand2015-01-151-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 <[email protected]>
* nir/tex_instr: Rename the indirect source type and add an array sizeJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Make texture instruction names more consistentJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Add a basic constant folding passJason Ekstrand2015-01-151-0/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add an algebraic optimization passJason Ekstrand2015-01-151-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 <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: Make the type casting operations static inline functionsJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Add a lowering pass for adding source modifiers where possibleJason Ekstrand2015-01-151-0/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a helper for getting a constant value from an SSA sourceJason Ekstrand2015-01-151-0/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Vectorize intrinsicsJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Remove the old variable lowering codeJason Ekstrand2015-01-151-4/+0
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a pass to lower global variables to local variablesJason Ekstrand2015-01-151-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a pass for lowering input/output loads/storesJason Ekstrand2015-01-151-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a pass to lower local variables to registersJason Ekstrand2015-01-151-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a pass to lower local variable accesses to SSA valuesJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Add a copy splitting passJason Ekstrand2015-01-151-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Don't require a function in ssa_def_initJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Use an integer index for specifying structure fieldsJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Add a concept of a wildcard array dereferenceJason Ekstrand2015-01-151-0/+9
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Make array deref direct vs. indirect an enumJason Ekstrand2015-01-151-1/+6
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a helper for rewriting an instruction sourceJason Ekstrand2015-01-151-0/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a basic CSE passJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Add a fused multiply-add peepholeJason Ekstrand2015-01-151-0/+1
|
* nir: Add a peephole select optimizationJason Ekstrand2015-01-151-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a function for comparing two sourcesJason Ekstrand2015-01-151-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a parallel copy instruction typeJason Ekstrand2015-01-151-0/+23
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a function for rewriting all the uses of a SSA defJason Ekstrand2015-01-151-0/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add an initialization function for SSA definitionsJason Ekstrand2015-01-151-0/+4
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add an SSA-based liveness analysis pass.Jason Ekstrand2015-01-151-0/+11
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: set reg_alloc and ssa_alloc when indexing registers and SSA valuesJason Ekstrand2015-01-151-2/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a function to detect if a block is immediately followed by an ifJason Ekstrand2015-01-151-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 <[email protected]>
* nir: Add a foreach_block_reverse functionJason Ekstrand2015-01-151-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>