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 <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4061>
This commit is contained in:
Alyssa Rosenzweig 2020-03-02 20:06:34 -05:00 committed by Marge Bot
parent eceaea43e3
commit e7dc2a7b9b

View file

@ -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