#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