diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-08-15 08:36:41 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-19 08:32:17 -0700 |
commit | b8e526c520a20b13492e0ca5074d72f5b3f6388f (patch) | |
tree | 85b0b6198036d5294ffa4aabe0f43b8d4fae29b2 | |
parent | b4b2e111f882fe036a0c829e28f7bc5719143cf4 (diff) |
pan/midgard: Add mir_foreach_predecessor utility
It's ugly, but c'est la vie.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r-- | src/panfrost/midgard/compiler.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index e51ea8ba602..f196389c36a 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -360,6 +360,17 @@ mir_next_op(struct midgard_instruction *ins) mir_foreach_block(ctx, v_block) \ mir_foreach_instr_in_block_safe(v_block, v) +/* Based on set_foreach, expanded with automatic type casts */ + +#define mir_foreach_predecessor(blk, v) \ + struct set_entry *_entry_##v; \ + struct midgard_block *v; \ + for (_entry_##v = _mesa_set_next_entry(blk->predecessors, NULL), \ + v = (struct midgard_block *) (_entry_##v ? _entry_##v->key : NULL); \ + _entry_##v != NULL; \ + _entry_##v = _mesa_set_next_entry(blk->predecessors, _entry_##v), \ + v = (struct midgard_block *) (_entry_##v ? _entry_##v->key : NULL)) + static inline midgard_instruction * mir_last_in_block(struct midgard_block *block) { |