From: Alyssa Rosenzweig Date: Fri, 27 Nov 2020 23:54:49 +0000 (-0500) Subject: pan/bi: Add cursor data structures X-Git-Tag: upstream/21.0.0~1063 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8c687b15b85324aaac3f12640c2137fb6be95bb;p=platform%2Fupstream%2Fmesa.git pan/bi: Add cursor data structures To be used in conjunction with the builder. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 20f755b..f90c738 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -1105,4 +1105,48 @@ signed bi_block_offset(bi_context *ctx, bi_clause *start, bi_block *target); void bi_pack(bi_context *ctx, struct util_dynarray *emission); +/* Like in NIR, for use with the builder */ + +enum bi_cursor_option { + bi_cursor_after_block, + bi_cursor_before_instr, + bi_cursor_after_instr +}; + +typedef struct { + enum bi_cursor_option option; + + union { + bi_block *block; + bi_instr *instr; + }; +} bi_cursor; + +static inline bi_cursor +bi_after_block(bi_block *block) +{ + return (bi_cursor) { + .option = bi_cursor_after_block, + .block = block + }; +} + +static inline bi_cursor +bi_before_instr(bi_instr *instr) +{ + return (bi_cursor) { + .option = bi_cursor_before_instr, + .instr = instr + }; +} + +static inline bi_cursor +bi_after_instr(bi_instr *instr) +{ + return (bi_cursor) { + .option = bi_cursor_after_instr, + .instr = instr + }; +} + #endif