From: Alyssa Rosenzweig Date: Tue, 3 Mar 2020 01:06:34 +0000 (-0500) Subject: pan/bi: Add the control flow graph X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e7dc2a7b9beeb3fe9af00033d972f89bf436bb68;p=mesa.git pan/bi: Add the control flow graph We're starting to build up the IR data structures in preparation to get everything piped through. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 5c339ddf2bb..6c2f657a73a 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -27,8 +27,60 @@ #ifndef __BIFROST_COMPILER_H #define __BIFROST_COMPILER_H +/* Bifrost opcodes are tricky -- the same op may exist on both FMA and + * ADD with two completely different opcodes, and opcodes can be varying + * length in some cases. Then we have different opcodes for int vs float + * and then sometimes even for different typesizes. Further, virtually + * every op has a number of flags which depend on the op. In constrast + * to Midgard where you have a strict ALU/LDST/TEX division and within + * ALU you have strict int/float and that's it... here it's a *lot* more + * involved. As such, we use something much higher level for our IR, + * encoding "classes" of operations, letting the opcode details get + * sorted out at emit time. + * + * Please keep this list alphabetized. Please use a dictionary if you + * don't know how to do that. + */ + +enum bi_class { + BI_ADD, + BI_ATEST, + BI_BRANCH, + BI_CMP, + BI_BLEND, + BI_BITWISE, + BI_CONVERT, + BI_CSEL, + BI_DISCARD, + BI_FMA, + BI_FREXP, + BI_LOAD, + BI_LOAD_ATTR, + BI_LOAD_VAR, + BI_LOAD_VAR_ADDRESS, + BI_MINMAX, + BI_MOV, + BI_SHIFT, + BI_STORE, + BI_STORE_VAR, + BI_SPECIAL, /* _FAST, _TABLE on supported GPUs */ + BI_TEX, + BI_ROUND, +}; + +typedef struct { + struct list_head link; /* Must be first */ + enum bi_class type; +} bi_instruction; + +typedef struct { + struct list_head link; /* must be first */ + struct list_head instructions; /* list of bi_instructions */ +} bi_block; + typedef struct { nir_shader *nir; + struct list_head blocks; /* list of bi_block */ } bi_context; #endif