Commit Graph

24 Commits

Author SHA1 Message Date
Jason Ekstrand 68778d52cd nir: Automatically update SSA if uses
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:02 -08:00
Jason Ekstrand 6a52d2af2f nir: Don't require a function in ssa_def_init
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-15 07:19:02 -08:00
Jason Ekstrand 829aa98320 nir: Use an integer index for specifying structure fields
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-15 07:19:02 -08:00
Jason Ekstrand b5143edaee nir: Make array deref direct vs. indirect an enum
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:02 -08:00
Jason Ekstrand 8219ff1796 nir: Clean up nir_deref helper functions
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:01 -08:00
Jason Ekstrand cd01de0812 nir: Add a helper for rewriting an instruction source
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:01 -08:00
Jason Ekstrand ef7ebb908e nir/nir: Patch up phi predecessors in move_successors
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:01 -08:00
Jason Ekstrand 02eef48343 nir/nir: Use safe iterators when iterating over the CFG
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:01 -08:00
Jason Ekstrand dc4e660dfa nir/nir: Fix a bug in move_successors
The unlink_blocks function moves successors around to make sure that, if
there is a remaining successor, it is in the first successors slot and not
the second.  To fix this, we simply get both successors up front.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:01 -08:00
Jason Ekstrand 4f44120ff5 nir: Add a function for comparing two sources
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:00 -08:00
Jason Ekstrand 366181d826 nir: Add a parallel copy instruction type
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:00 -08:00
Jason Ekstrand 7de6b7fc3e nir: Add a function for rewriting all the uses of a SSA def
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:00 -08:00
Jason Ekstrand 946012f10f nir: Automatically handle SSA uses when an instruction is inserted
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:00 -08:00
Jason Ekstrand fbc443ad56 nir: Add an initialization function for SSA definitions
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:00 -08:00
Jason Ekstrand c9a21c725d nir: set reg_alloc and ssa_alloc when indexing registers and SSA values
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:00 -08:00
Jason Ekstrand d7e482d32c nir: Add a function to detect if a block is immediately followed by an if
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-15 07:19:00 -08:00
Jason Ekstrand dfdf0c4673 nir: Add a foreach_block_reverse function
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:00 -08:00
Jason Ekstrand 07556442a7 nir/foreach_block: Return false if the callback on the last block fails
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:00 -08:00
Jason Ekstrand 49911cf4db nir: Add a basic metadata management system
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-01-15 07:19:00 -08:00
Connor Abbott b559ee709b nir: calculate dominance information 2015-01-15 07:18:58 -08:00
Connor Abbott 494790b2a9 nir: keep track of the number of input, output, and uniform slots 2015-01-15 07:18:58 -08:00
Jason Ekstrand 9b1139649d SQUASH: Fix comments from eric
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-01-15 07:18:58 -08:00
Jason Ekstrand 8b4c860580 SQUASH: Add an assert 2015-01-15 07:18:58 -08:00
Connor Abbott 2812e5de93 nir: add core helper functions
These include functions for adding and removing various bits of IR and
helpers for iterating over all the sources and destinations of an
instruction. This is similar to ir.cpp.

v2: Jason Ekstrand <jason.ekstrand@intel.com>:
   whitespace and automake fixes
2015-01-15 07:18:58 -08:00