pan/midgard: Shrink successors[] to 2 length
[mesa.git] / src / panfrost / midgard / compiler.h
index 7a07bb847bff6842e7610ac23bb4fef271175043..61fe8a92b2e96983942b9061d959f0e84c198be8 100644 (file)
@@ -117,6 +117,9 @@ typedef struct midgard_instruction {
         bool writeout;
         bool prepacked_branch;
 
+        /* Kind of a hack, but hint against aggressive DCE */
+        bool dont_eliminate;
+
         /* Masks in a saneish format. One bit per channel, not packed fancy.
          * Use this instead of the op specific ones, and switch over at emit
          * time */
@@ -129,6 +132,14 @@ typedef struct midgard_instruction {
 
         bool invert;
 
+        /* Hint for the register allocator not to spill the destination written
+         * from this instruction (because it is a spill/unspill node itself) */
+
+        bool no_spill;
+
+        /* Generic hint for intra-pass use */
+        bool hint;
+
         union {
                 midgard_load_store_word load_store;
                 midgard_vector_alu alu;
@@ -159,7 +170,7 @@ typedef struct midgard_block {
 
         /* Succeeding blocks. The compiler should not necessarily rely on
          * source-order traversal */
-        struct midgard_block *successors[4];
+        struct midgard_block *successors[2];
         unsigned nr_successors;
 
         /* The successors pointer form a graph, and in the case of
@@ -257,9 +268,6 @@ typedef struct compiler_context {
         /* Alpha ref value passed in */
         float alpha_ref;
 
-        /* The index corresponding to the fragment output */
-        unsigned fragment_output;
-
         /* The mapping of sysvals to uniforms, the count, and the off-by-one inverse */
         unsigned sysvals[MAX_SYSVAL_COUNT];
         unsigned sysval_count;
@@ -278,10 +286,12 @@ mir_upload_ins(struct midgard_instruction ins)
         return heap;
 }
 
-static inline void
+static inline midgard_instruction *
 emit_mir_instruction(struct compiler_context *ctx, struct midgard_instruction ins)
 {
-        list_addtail(&(mir_upload_ins(ins))->link, &ctx->current_block->instructions);
+        midgard_instruction *u = mir_upload_ins(ins);
+        list_addtail(&u->link, &ctx->current_block->instructions);
+        return u;
 }
 
 static inline struct midgard_instruction *
@@ -431,6 +441,7 @@ bool mir_special_index(compiler_context *ctx, unsigned idx);
 unsigned mir_use_count(compiler_context *ctx, unsigned value);
 bool mir_is_written_before(compiler_context *ctx, midgard_instruction *ins, unsigned node);
 unsigned mir_mask_of_read_components(midgard_instruction *ins, unsigned node);
+unsigned mir_ubo_shift(midgard_load_store_op op);
 
 /* MIR printing */
 
@@ -524,16 +535,20 @@ bool mir_has_multiple_writes(compiler_context *ctx, int src);
 void mir_create_pipeline_registers(compiler_context *ctx);
 
 void
-midgard_promote_uniforms(compiler_context *ctx, unsigned pressure);
+midgard_promote_uniforms(compiler_context *ctx, unsigned promoted_count);
 
-void
+midgard_instruction *
 emit_ubo_read(
         compiler_context *ctx,
+        nir_instr *instr,
         unsigned dest,
         unsigned offset,
         nir_src *indirect_offset,
         unsigned index);
 
+void
+emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override, unsigned nr_components);
+
 void
 midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr);