diff options
author | Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> | 2019-08-15 08:16:38 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> | 2019-08-19 08:32:17 -0700 |
commit | 07c960cac061ebfd0d8a0789dd1e86bc0ca4c08a (patch) | |
tree | ab19fc803920e077d4144dd544683307dca9f8d7 | |
parent | aeeeef1242b7f0541f5021d080bd7c1e55060feb (diff) |
pan/midgard: Add mir_exit_block helper
The exit block is gauranteed to be empty, signaling the end of the
program.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
-rw-r--r-- | src/panfrost/midgard/compiler.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index fb47c3475bf..e51ea8ba602 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -377,6 +377,19 @@ mir_get_block(compiler_context *ctx, int idx) return (struct midgard_block *) lst; } +static inline midgard_block * +mir_exit_block(struct compiler_context *ctx) +{ + midgard_block *last = list_last_entry(&ctx->blocks, + struct midgard_block, link); + + /* The last block must be empty (the exit block) */ + assert(list_empty(&last->instructions)); + assert(last->nr_successors == 0); + + return last; +} + static inline bool mir_is_alu_bundle(midgard_bundle *bundle) { |