[Mesa-dev] [PATCH 07/10] nir/dominance: Also record the dominance depth
Jason Ekstrand
jason at jlekstrand.net
Fri Feb 6 14:14:37 PST 2015
With the patches I just sent, we'll drop this from the series and use the
nir_dominance_lca function in GCM instead.
On Thu, Feb 5, 2015 at 3:42 PM, Connor Abbott <cwabbott0 at gmail.com> wrote:
> Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
>
> On Thu, Feb 5, 2015 at 5:29 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > ---
> > src/glsl/nir/nir.h | 3 +++
> > src/glsl/nir/nir_dominance.c | 9 ++++++++-
> > 2 files changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> > index 32c991a..8e5e686 100644
> > --- a/src/glsl/nir/nir.h
> > +++ b/src/glsl/nir/nir.h
> > @@ -1136,6 +1136,9 @@ typedef struct nir_block {
> > */
> > struct nir_block *imm_dom;
> >
> > + /* This block's depth in the dominator tree; zero for the start
> block */
> > + unsigned dom_depth;
> > +
> > /* This node's children in the dominance tree */
> > unsigned num_dom_children;
> > struct nir_block **dom_children;
> > diff --git a/src/glsl/nir/nir_dominance.c b/src/glsl/nir/nir_dominance.c
> > index 67fdcc6..898b139 100644
> > --- a/src/glsl/nir/nir_dominance.c
> > +++ b/src/glsl/nir/nir_dominance.c
> > @@ -131,6 +131,9 @@ calc_dom_frontier_cb(nir_block *block, void *state)
> > * 3. For each node, add itself to its parent's list of children, using
> > * num_dom_children as an index - at the end of this step,
> num_dom_children
> > * for each node will be the same as it was at the end of step #1.
> > + *
> > + * While we're at it, this is also a convenient time to set the
> > + * dominator depth for each node.
> > */
> >
> > static bool
> > @@ -161,8 +164,12 @@ block_add_child(nir_block *block, void *state)
> > {
> > (void) state;
> >
> > - if (block->imm_dom)
> > + if (block->imm_dom) {
> > block->imm_dom->dom_children[block->imm_dom->num_dom_children++]
> = block;
> > + block->dom_depth = block->imm_dom->dom_depth + 1;
> > + } else {
> > + block->dom_depth = 0;
> > + }
> >
> > return true;
> > }
> > --
> > 2.2.2
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150206/b1c151d8/attachment.html>
More information about the mesa-dev
mailing list