/* total number of basic blocks, only valid when block_index_dirty = false */
unsigned num_blocks;
+ /** True if this nir_function_impl uses structured control-flow
+ *
+ * Structured nir_function_impls have different validation rules.
+ */
+ bool structured;
+
nir_metadata valid_metadata;
} nir_function_impl;
/** Constant data associated with this shader.
*
- * Constant data is loaded through load_constant intrinsics. See also
- * nir_opt_large_constants.
+ * Constant data is loaded through load_constant intrinsics (as compared to
+ * the NIR load_const instructions which have the constant value inlined
+ * into them). This is usually generated by nir_opt_large_constants (so
+ * shaders don't have to load_const into a temporary array when they want
+ * to indirect on a const array).
*/
void *constant_data;
+ /** Size of the constant data associated with the shader, in bytes */
unsigned constant_data_size;
} nir_shader;
nir_component_mask_t nir_ssa_def_components_read(const nir_ssa_def *def);
+
+/** Returns the next block, disregarding structure
+ *
+ * The ordering is deterministic but has no guarantees beyond that. In
+ * particular, it is not guaranteed to be dominance-preserving.
+ */
+nir_block *nir_block_unstructured_next(nir_block *block);
+nir_block *nir_unstructured_start_block(nir_function_impl *impl);
+
+#define nir_foreach_block_unstructured(block, impl) \
+ for (nir_block *block = nir_unstructured_start_block(impl); block != NULL; \
+ block = nir_block_unstructured_next(block))
+
+#define nir_foreach_block_unstructured_safe(block, impl) \
+ for (nir_block *block = nir_unstructured_start_block(impl), \
+ *next = nir_block_unstructured_next(block); \
+ block != NULL; \
+ block = next, next = nir_block_unstructured_next(block))
+
/*
* finds the next basic block in source-code order, returns NULL if there is
* none
unsigned lower_xy_uxvx_external;
unsigned lower_ayuv_external;
unsigned lower_xyuv_external;
+ unsigned bt709_external;
+ unsigned bt2020_external;
/**
* To emulate certain texture wrap modes, this can be used
bool nir_opt_remove_phis(nir_shader *shader);
bool nir_opt_remove_phis_block(nir_block *block);
-bool nir_opt_shrink_load(nir_shader *shader);
+bool nir_opt_shrink_vectors(nir_shader *shader);
bool nir_opt_trivial_continues(nir_shader *shader);