return result;
}
+nir_deref_path *nir_get_deref_path(void *mem_ctx, nir_deref_and_path *deref)
+{
+ if (!deref->_path) {
+ deref->_path = ralloc(mem_ctx, nir_deref_path);
+ nir_deref_path_init(deref->_path, deref->instr, mem_ctx);
+ }
+ return deref->_path;
+}
+
+nir_deref_compare_result nir_compare_derefs_and_paths(void *mem_ctx,
+ nir_deref_and_path *a,
+ nir_deref_and_path *b)
+{
+ if (a->instr == b->instr) /* nir_compare_derefs has a fast path if a == b */
+ return nir_compare_derefs(a->instr, b->instr);
+
+ return nir_compare_deref_paths(nir_get_deref_path(mem_ctx, a),
+ nir_get_deref_path(mem_ctx, b));
+}
+
struct rematerialize_deref_state {
bool progress;
nir_builder builder;
nir_deref_instr **path;
} nir_deref_path;
+typedef struct {
+ nir_deref_instr *instr;
+ nir_deref_path *_path;
+} nir_deref_and_path;
+
void nir_deref_path_init(nir_deref_path *path,
nir_deref_instr *deref, void *mem_ctx);
void nir_deref_path_finish(nir_deref_path *path);
nir_ssa_def *nir_build_deref_offset(nir_builder *b, nir_deref_instr *deref,
glsl_type_size_align_func size_align);
+nir_deref_path *nir_get_deref_path(void *mem_ctx, nir_deref_and_path *deref);
+
typedef enum {
nir_derefs_do_not_alias = 0,
nir_derefs_equal_bit = (1 << 0),
nir_deref_compare_result nir_compare_deref_paths(nir_deref_path *a_path, nir_deref_path *b_path);
nir_deref_compare_result nir_compare_derefs(nir_deref_instr *a, nir_deref_instr *b);
+nir_deref_compare_result nir_compare_derefs_and_paths(void *mem_ctx,
+ nir_deref_and_path *a,
+ nir_deref_and_path *b);
#ifdef __cplusplus
} /* extern "C" */