nir/builder: Add support for easily building control-flow
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 15 Feb 2017 16:42:45 +0000 (08:42 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 2 Mar 2017 01:00:20 +0000 (17:00 -0800)
commite27c716ad70c50597bcec5bfa71d8926460109ff
tree04ff670936e3f03b4e2ebcbc4b1750c35b44cf22
parentd5b355ce5fd6dbff61f1f471c38aa62db9d621c4
nir/builder: Add support for easily building control-flow

Each of the pop functions (and push_else) take a control flow parameter as
their second argument.  If NULL, it assumes that the builder is in a block
that's a direct child of the control-flow node you want to pop off the
virtual stack.  This is what 90% of consumers will want.  The SPIR-V pass,
however, is a bit more "creative" about how it walks the CFG and it needs
to be able to pop multiple levels at a time, hence the argument.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
src/compiler/nir/nir_builder.h