[Mesa-dev] [PATCH 1/3] glsl: add ir_partial_visitor

Ian Romanick idr at freedesktop.org
Tue Sep 7 13:08:37 PDT 2010

Hash: SHA1

Luca Barbieri wrote:
> Well, the alternative is to copy&paste this into ir_lower_jumps and
> other similar passes.
> I added a new class instead of changing ir_visitor so that subclasses
> that need to examine all leaves will get a compile error if not
> updated when new leaves are introduced. This is debatable though,
> since you need to add the function to ir_visitor anyway.

The problem with the default navigation is that code breaks in
mysterious ways when new node types are added.  We've encountered this a
couple times with the hierarchical visitor.  If the visitor base class
is pure virtual, the compiler will tell you all the places that need to
be updated when a new node type is added.  The cases where we've had
this problem with the hierarchical visitor have been a bitch to debug.
The extra bit of cut-and-paste seems like a small price to pay.
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the mesa-dev mailing list