Debian Codegraph @

src/panfrost/compiler/midgard/compiler.h

raw
1 /*
2 * Copyright (C) 2019-2020 Collabora, Ltd.
3 * Copyright (C) 2019 Alyssa Rosenzweig
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef _MDG_COMPILER_H
8 #define _MDG_COMPILER_H
9
10 #include "helpers.h"
11 #include "midgard.h"
12 #include "midgard_compile.h"
13 #include "midgard_ops.h"
14
15 #include "util/hash_table.h"
16 #include "util/list.h"
17 #include "util/set.h"
18 #include "util/u_dynarray.h"
19 #include "util/u_math.h"
20
21 #include "compiler/glsl_types.h"
22 #include "compiler/nir/nir.h"
23 #include "panfrost/compiler/pan_compiler.h"
24
25 /* Forward declare */
26 struct midgard_block;
27
28 /* Target types. Defaults to TARGET_GOTO (the type corresponding directly to
29 * the hardware), hence why that must be zero. TARGET_DISCARD signals this
30 * instruction is actually a discard op. */
31
32 #define TARGET_GOTO 0
33 #define TARGET_BREAK 1
34 #define TARGET_CONTINUE 2
35 #define TARGET_DISCARD 3
36 #define TARGET_TILEBUF_WAIT 4
37
38 typedef struct midgard_branch {
39 /* If conditional, the condition is specified in r31.w */
40 bool conditional;
41
42 /* For conditionals, if this is true, we branch on FALSE. If false, we branch
43 * on TRUE. */
44 bool invert_conditional;
45
46 /* Branch targets: the start of a block, the start of a loop (continue), the
47 * end of a loop (break). Value is one of TARGET_ */
48 unsigned target_type;
49
50 /* The actual target */
51 union {
52 int target_block;
53 int target_break;
54 int target_continue;
55 };
56 } midgard_branch;
57
58 /* Generic in-memory data type repesenting a single logical instruction, rather
59 * than a single instruction group. This is the preferred form for code gen.
60 * Multiple midgard_insturctions will later be combined during scheduling,
61 * though this is not represented in this structure. Its format bridges
62 * the low-level binary representation with the higher level semantic meaning.
63 *
64 * Notably, it allows registers to be specified as block local SSA, for code
65 * emitted before the register allocation pass.
66 */
67
68 #define MIR_SRC_COUNT 4
69 #define MIR_VEC_COMPONENTS 16
70
71 #define MIR_WRITEOUT_C 1
72 #define MIR_WRITEOUT_Z 2
73 #define MIR_WRITEOUT_S 4
74 #define MIR_WRITEOUT_2 8
75
76 typedef struct midgard_instruction {
77 /* Must be first for casting */
78 struct list_head link;
79
80 unsigned type; /* ALU, load/store, texture */
81
82 /* Instruction arguments represented as block-local SSA
83 * indices, rather than registers. ~0 means unused. */
84 unsigned src[MIR_SRC_COUNT];
85 unsigned dest;
86
87 /* vec16 swizzle, unpacked, per source */
88 unsigned swizzle[MIR_SRC_COUNT][MIR_VEC_COMPONENTS];
89
90 /* Types! */
91 nir_alu_type src_types[MIR_SRC_COUNT];
92 nir_alu_type dest_type;
93
94 /* Packing ops have non-32-bit dest types even though they functionally
95 * work at the 32-bit level, use this as a signal to disable copyprop.
96 * We maybe need synthetic pack ops instead. */
97 bool is_pack;
98
99 /* Modifiers, depending on type */
100 union {
101 struct {
102 bool src_abs[MIR_SRC_COUNT];
103 bool src_neg[MIR_SRC_COUNT];
104 };
105
106 struct {
107 bool src_shift[MIR_SRC_COUNT];
108 };
109 };
110
111 /* Out of the union for csel (could maybe be fixed..) */
112 bool src_invert[MIR_SRC_COUNT];
113
114 /* If the op supports it */
115 enum midgard_roundmode roundmode;
116
117 /* For textures: should helpers execute this instruction (instead of
118 * just helping with derivatives)? Should helpers terminate after? */
119 bool helper_terminate;
120 bool helper_execute;
121
122 /* I.e. (1 << alu_bit) */
123 int unit;
124
125 bool has_constants;
126 midgard_constants constants;
127 uint16_t inline_constant;
128 bool has_inline_constant;
129
130 bool compact_branch;
131 uint8_t writeout;
132 bool last_writeout;
133
134 /* Masks in a saneish format. One bit per channel, not packed fancy.
135 * Use this instead of the op specific ones, and switch over at emit
136 * time */
137
138 uint16_t mask;
139
140 /* Hint for the register allocator not to spill the destination written
141 * from this instruction (because it is a spill/unspill node itself).
142 * Bitmask of spilled classes */
143
144 unsigned no_spill;
145
146 /* Generic hint for intra-pass use */
147 bool hint;
148
149 /* During scheduling, the backwards dependency graph
150 * (DAG). nr_dependencies is the number of unscheduled
151 * instructions that must still be scheduled after
152 * (before) this instruction. dependents are which
153 * instructions need to be scheduled before (after) this
154 * instruction. */
155
156 unsigned nr_dependencies;
157 BITSET_WORD *dependents;
158
159 /* Use this in conjunction with `type` */
160 unsigned op;
161
162 /* This refers to midgard_outmod_float or midgard_outmod_int.
163 * In case of a ALU op, use midgard_is_integer_out_op() to know which
164 * one is used.
165 * If it's a texture op, it's always midgard_outmod_float. */
166 unsigned outmod;
167
168 union {
169 midgard_load_store_word load_store;
170 midgard_texture_word texture;
171
172 midgard_branch branch;
173 };
174
175 unsigned bundle_id;
176 } midgard_instruction;
177
178 typedef struct midgard_block {
179 /* Link to next block. Must be first for mir_get_block */
180 struct list_head link;
181
182 /* List of instructions emitted for the current block */
183 struct list_head instructions;
184
185 /* Index of the block in source order */
186 unsigned name;
187
188 /* Control flow graph */
189 struct midgard_block *successors[2];
190 struct set *predecessors;
191 bool unconditional_jumps;
192
193 /* In liveness analysis, these are live masks (per-component) for
194 * indices for the block. Scalar compilers have the luxury of using
195 * simple bit fields, but for us, liveness is a vector idea. */
196 uint16_t *live_in;
197 uint16_t *live_out;
198
199 bool scheduled;
200
201 /* List of midgard_bundles emitted (after the scheduler has run) */
202 struct util_dynarray bundles;
203
204 /* Number of quadwords _actually_ emitted, as determined after scheduling */
205 unsigned quadword_count;
206
207 /* Indicates this is a fixed-function fragment epilogue block */
208 bool epilogue;
209
210 /* Are helper invocations required by this block? */
211 bool helpers_in;
212 } midgard_block;
213
214 typedef struct midgard_bundle {
215 /* Tag for the overall bundle */
216 int tag;
217
218 /* Instructions contained by the bundle. instruction_count <= 6 (vmul,
219 * sadd, vadd, smul, vlut, branch) */
220 int instruction_count;
221 midgard_instruction *instructions[6];
222
223 /* Bundle-wide ALU configuration */
224 int padding;
225 int control;
226 bool has_embedded_constants;
227 midgard_constants constants;
228 bool last_writeout;
229 } midgard_bundle;
230
231 enum midgard_rt_id {
232 MIDGARD_COLOR_RT0 = 0,
233 MIDGARD_COLOR_RT1,
234 MIDGARD_COLOR_RT2,
235 MIDGARD_COLOR_RT3,
236 MIDGARD_COLOR_RT4,
237 MIDGARD_COLOR_RT5,
238 MIDGARD_COLOR_RT6,
239 MIDGARD_COLOR_RT7,
240 MIDGARD_ZS_RT,
241 MIDGARD_NUM_RTS,
242 };
243
244 #define MIDGARD_MAX_SAMPLE_ITER 16
245
246 typedef struct compiler_context {
247 const struct pan_compile_inputs *inputs;
248 nir_shader *nir;
249 struct pan_shader_info *info;
250 mesa_shader_stage stage;
251
252 /* Index to precolour to r0 for an input blend colour */
253 unsigned blend_input;
254
255 /* Index to precolour to r2 for a dual-source blend colour */
256 unsigned blend_src1;
257
258 /* Count of spills and fills for shaderdb */
259 unsigned spills;
260 unsigned fills;
261
262 /* Current NIR function */
263 nir_function *func;
264
265 /* Allocated compiler temporary counter */
266 unsigned temp_alloc;
267
268 /* Unordered list of midgard_blocks */
269 int block_count;
270 struct list_head blocks;
271
272 /* TODO merge with block_count? */
273 unsigned block_source_count;
274
275 /* List of midgard_instructions emitted for the current block */
276 midgard_block *current_block;
277
278 /* If there is a preset after block, use this, otherwise emit_block will
279 * create one if NULL */
280 midgard_block *after_block;
281
282 /* The current "depth" of the loop, for disambiguating breaks/continues
283 * when using nested loops */
284 int current_loop_depth;
285
286 /* Total number of loops for shader-db */
287 unsigned loop_count;
288
289 /* Constants which have been loaded, for later inlining */
290 struct hash_table_u64 *ssa_constants;
291
292 int temp_count;
293 int max_hash;
294
295 /* Count of instructions emitted from NIR overall, across all blocks */
296 int instruction_count;
297
298 unsigned quadword_count;
299
300 /* Bitmask of valid metadata */
301 unsigned metadata;
302
303 /* Model-specific quirk set */
304 uint32_t quirks;
305
306 /* Writeout instructions for each render target */
307 midgard_instruction
308 *writeout_branch[MIDGARD_NUM_RTS][MIDGARD_MAX_SAMPLE_ITER];
309
310 /* Mask of UBOs that need to be uploaded */
311 uint32_t ubo_mask;
312 } compiler_context;
313
314 /* Per-block live_in/live_out */
315 #define MIDGARD_METADATA_LIVENESS (1 << 0)
316
317 /* Helpers for manipulating the above structures (forming the driver IR) */
318
319 /* Append instruction to end of current block */
320
321 static inline midgard_instruction *
322 mir_upload_ins(struct compiler_context *ctx,
323 const struct midgard_instruction *ins)
324 {
325 midgard_instruction *heap = ralloc(ctx, struct midgard_instruction);
326 memcpy(heap, ins, sizeof(*ins));
327 return heap;
328 }
329
330 static inline midgard_instruction *
331 emit_mir_instruction(struct compiler_context *ctx,
332 const struct midgard_instruction *ins)
333 {
334 midgard_instruction *u = mir_upload_ins(ctx, ins);
335 list_addtail(&u->link, &ctx->current_block->instructions);
336 return u;
337 }
338
339 static inline struct midgard_instruction *
340 mir_insert_instruction_before(struct compiler_context *ctx,
341 struct midgard_instruction *tag,
342 const struct midgard_instruction *ins)
343 {
344 struct midgard_instruction *u = mir_upload_ins(ctx, ins);
345 list_addtail(&u->link, &tag->link);
346 return u;
347 }
348
349 static inline void
350 mir_remove_instruction(struct midgard_instruction *ins)
351 {
352 list_del(&ins->link);
353 }
354
355 #define mir_prev_op(ins) \
356 list_last_entry(&((ins)->link), midgard_instruction, link)
357
358 #define mir_next_op(ins) \
359 list_first_entry(&((ins)->link), midgard_instruction, link)
360
361 static inline midgard_block *
362 mir_exit_block(struct list_head *blocks)
363 {
364 midgard_block *last = list_last_entry(blocks, midgard_block, link);
365 assert(!last->successors[0] && !last->successors[1]);
366 return last;
367 }
368
369 #define mir_foreach_block(ctx, v) \
370 list_for_each_entry(midgard_block, v, &ctx->blocks, link)
371
372 #define mir_foreach_block_from(ctx, from, v) \
373 list_for_each_entry_from(midgard_block, v, from, &ctx->blocks, link)
374
375 #define mir_foreach_instr_in_block(block, v) \
376 list_for_each_entry(struct midgard_instruction, v, \
377 &block->instructions, link)
378 #define mir_foreach_instr_in_block_rev(block, v) \
379 list_for_each_entry_rev(struct midgard_instruction, v, \
380 &block->instructions, link)
381
382 #define mir_foreach_instr_in_block_safe(block, v) \
383 list_for_each_entry_safe(struct midgard_instruction, v, \
384 &block->instructions, link)
385
386 #define mir_foreach_instr_in_block_safe_rev(block, v) \
387 list_for_each_entry_safe_rev(struct midgard_instruction, v, \
388 &block->instructions, link)
389
390 #define mir_foreach_instr_in_block_from(block, v, from) \
391 list_for_each_entry_from(struct midgard_instruction, v, from, \
392 &block->instructions, link)
393
394 #define mir_foreach_instr_in_block_from_rev(block, v, from) \
395 list_for_each_entry_from_rev(struct midgard_instruction, v, from, \
396 &block->instructions, link)
397
398 #define mir_foreach_bundle_in_block(block, v) \
399 util_dynarray_foreach(&block->bundles, midgard_bundle, v)
400
401 #define mir_foreach_bundle_in_block_rev(block, v) \
402 util_dynarray_foreach_reverse(&block->bundles, midgard_bundle, v)
403
404 #define mir_foreach_instr_in_block_scheduled_rev(block, v) \
405 midgard_instruction *v; \
406 signed i = 0; \
407 mir_foreach_bundle_in_block_rev(block, _bundle) \
408 for (i = (_bundle->instruction_count - 1), v = _bundle->instructions[i]; \
409 i >= 0; --i, v = (i >= 0) ? _bundle->instructions[i] : NULL)
410
411 #define mir_foreach_instr_global(ctx, v) \
412 mir_foreach_block(ctx, v_block) \
413 mir_foreach_instr_in_block(((midgard_block *)v_block), v)
414
415 #define mir_foreach_instr_global_safe(ctx, v) \
416 mir_foreach_block(ctx, v_block) \
417 mir_foreach_instr_in_block_safe(((midgard_block *)v_block), v)
418
419 /* Based on set_foreach, expanded with automatic type casts */
420
421 #define mir_foreach_successor(blk, v) \
422 struct midgard_block *v; \
423 struct midgard_block **_v; \
424 for (_v = (midgard_block **)&blk->successors[0], v = *_v; \
425 v != NULL && _v < (midgard_block **)&blk->successors[2]; \
426 _v++, v = *_v)
427
428 #define mir_foreach_predecessor(blk, v) \
429 struct set_entry *_entry_##v; \
430 struct midgard_block *v; \
431 for (_entry_##v = _mesa_set_next_entry(blk->predecessors, NULL), \
432 v = (struct midgard_block *)(_entry_##v ? _entry_##v->key : NULL); \
433 _entry_##v != NULL; \
434 _entry_##v = _mesa_set_next_entry(blk->predecessors, _entry_##v), \
435 v = (struct midgard_block *)(_entry_##v ? _entry_##v->key : NULL))
436
437 #define mir_foreach_src(ins, v) \
438 for (unsigned v = 0; v < ARRAY_SIZE(ins->src); ++v)
439
440 void mir_block_add_successor(midgard_block *block, midgard_block *successor);
441
442 static inline midgard_instruction *
443 mir_last_in_block(struct midgard_block *block)
444 {
445 return list_last_entry(&block->instructions, struct midgard_instruction,
446 link);
447 }
448
449 static inline midgard_block *
450 mir_get_block(compiler_context *ctx, int idx)
451 {
452 struct list_head *lst = &ctx->blocks;
453
454 while ((idx--) + 1)
455 lst = lst->next;
456
457 return (struct midgard_block *)lst;
458 }
459
460 static inline bool
461 mir_is_alu_bundle(midgard_bundle *bundle)
462 {
463 return IS_ALU(bundle->tag);
464 }
465
466 static inline unsigned
467 make_compiler_temp(compiler_context *ctx)
468 {
469 return (ctx->func->impl->ssa_alloc + ctx->temp_alloc++) << 1;
470 }
471
472 /* IR indexing */
473 #define PAN_IS_REG (1)
474
475 static inline unsigned
476 make_compiler_temp_reg(compiler_context *ctx)
477 {
478 return ((ctx->func->impl->ssa_alloc + ctx->temp_alloc++) << 1) | PAN_IS_REG;
479 }
480
481 static inline bool
482 mir_is_ssa(unsigned index)
483 {
484 return (index < SSA_FIXED_MINIMUM) && !(index & PAN_IS_REG);
485 }
486
487 static inline unsigned
488 nir_ssa_index(nir_def *ssa)
489 {
490 return (ssa->index << 1) | 0;
491 }
492
493 static inline unsigned
494 nir_reg_index(nir_def *handle)
495 {
496 return (handle->index << 1) | PAN_IS_REG;
497 }
498
499 static inline unsigned
500 nir_src_index(compiler_context *ctx, nir_src *src)
501 {
502 nir_intrinsic_instr *load = nir_load_reg_for_def(src->ssa);
503
504 if (load)
505 return nir_reg_index(load->src[0].ssa);
506 else
507 return nir_ssa_index(src->ssa);
508 }
509
510 static inline unsigned
511 nir_def_index_with_mask(nir_def *def, uint16_t *write_mask)
512 {
513 nir_intrinsic_instr *store = nir_store_reg_for_def(def);
514
515 if (store) {
516 *write_mask = nir_intrinsic_write_mask(store);
517 return nir_reg_index(store->src[1].ssa);
518 } else {
519 *write_mask = (uint16_t)BITFIELD_MASK(def->num_components);
520 return nir_ssa_index(def);
521 }
522 }
523
524 static inline unsigned
525 nir_def_index(nir_def *def)
526 {
527 uint16_t write_mask = 0;
528 return nir_def_index_with_mask(def, &write_mask);
529 }
530
531 /* MIR manipulation */
532
533 void mir_rewrite_index(compiler_context *ctx, unsigned old, unsigned new);
534 void mir_rewrite_index_src(compiler_context *ctx, unsigned old, unsigned new);
535 void mir_rewrite_index_dst(compiler_context *ctx, unsigned old, unsigned new);
536 void mir_rewrite_index_dst_single(midgard_instruction *ins, unsigned old,
537 unsigned new);
538 void mir_rewrite_index_src_single(midgard_instruction *ins, unsigned old,
539 unsigned new);
540 void mir_rewrite_index_src_swizzle(compiler_context *ctx, unsigned old,
541 unsigned new, unsigned *swizzle);
542 bool mir_single_use(compiler_context *ctx, unsigned value);
543 unsigned mir_use_count(compiler_context *ctx, unsigned value);
544 uint16_t mir_bytemask_of_read_components(const midgard_instruction *ins,
545 unsigned node);
546 uint16_t mir_bytemask_of_read_components_index(const midgard_instruction *ins,
547 unsigned i);
548 uint16_t mir_from_bytemask(uint16_t bytemask, unsigned bits);
549 uint16_t mir_bytemask(const midgard_instruction *ins);
550 uint16_t mir_round_bytemask_up(uint16_t mask, unsigned bits);
551 void mir_set_bytemask(midgard_instruction *ins, uint16_t bytemask);
552 signed mir_upper_override(const midgard_instruction *ins, unsigned inst_size);
553 unsigned mir_components_for_type(nir_alu_type T);
554 unsigned max_bitsize_for_alu(const midgard_instruction *ins);
555 midgard_reg_mode reg_mode_for_bitsize(unsigned bitsize);
556
557 /* MIR printing */
558
559 void mir_print_instruction(const midgard_instruction *ins);
560 void mir_print_bundle(const midgard_bundle *ctx);
561 void mir_print_block(const midgard_block *block);
562 void mir_print_shader(const compiler_context *ctx);
563 bool mir_nontrivial_mod(const midgard_instruction *ins, unsigned i,
564 bool check_swizzle);
565 bool mir_nontrivial_outmod(const midgard_instruction *ins);
566
567 midgard_instruction *mir_insert_instruction_before_scheduled(
568 compiler_context *ctx, midgard_block *block, const midgard_instruction *tag,
569 const midgard_instruction *ins);
570 midgard_instruction *mir_insert_instruction_after_scheduled(
571 compiler_context *ctx, midgard_block *block, const midgard_instruction *tag,
572 const midgard_instruction *ins);
573 void mir_flip(midgard_instruction *ins);
574 void mir_compute_temp_count(compiler_context *ctx);
575
576 #define LDST_GLOBAL (REGISTER_LDST_ZERO << 2)
577 #define LDST_SHARED ((REGISTER_LDST_LOCAL_STORAGE_PTR << 2) | COMPONENT_Z)
578 #define LDST_SCRATCH ((REGISTER_LDST_PC_SP << 2) | COMPONENT_Z)
579
580 void mir_set_offset(compiler_context *ctx, midgard_instruction *ins,
581 nir_src *offset, unsigned seg);
582 void mir_set_ubo_offset(midgard_instruction *ins, nir_src *src, unsigned bias);
583
584 /* 'Intrinsic' move for aliasing */
585
586 static inline midgard_instruction
587 v_mov(unsigned src, unsigned dest)
588 {
589 midgard_instruction ins = {
590 .type = TAG_ALU_4,
591 .mask = 0xF,
592 .src = {~0, src, ~0, ~0},
593 .src_types = {0, nir_type_uint32},
594 .swizzle = SWIZZLE_IDENTITY,
595 .dest = dest,
596 .dest_type = nir_type_uint32,
597 .op = midgard_alu_op_imov,
598 .outmod = midgard_outmod_keeplo,
599 };
600
601 return ins;
602 }
603
604 /* Broad types of register classes so we can handle special
605 * registers */
606
607 #define REG_CLASS_WORK 0
608 #define REG_CLASS_LDST 1
609 #define REG_CLASS_TEXR 3
610 #define REG_CLASS_TEXW 4
611
612 /* Like a move, but to thread local storage! */
613
614 static inline midgard_instruction
615 v_load_store_scratch(unsigned srcdest, unsigned index, bool is_store,
616 unsigned mask)
617 {
618 /* We index by 32-bit vec4s */
619 unsigned byte = (index * 4 * 4);
620
621 midgard_instruction ins = {
622 .type = TAG_LOAD_STORE_4,
623 .mask = mask,
624 .dest_type = nir_type_uint32,
625 .dest = ~0,
626 .src = {~0, ~0, ~0, ~0},
627 .swizzle = SWIZZLE_IDENTITY_4,
628 .op = is_store ? midgard_op_st_128 : midgard_op_ld_128,
629 .load_store =
630 {
631 /* For register spilling - to thread local storage */
632 .arg_reg = REGISTER_LDST_LOCAL_STORAGE_PTR,
633 .arg_comp = COMPONENT_X,
634 .bitsize_toggle = true,
635 .index_format = midgard_index_address_u32,
636 .index_reg = REGISTER_LDST_ZERO,
637 },
638
639 /* If we spill an unspill, RA goes into an infinite loop */
640 .no_spill = (1 << REG_CLASS_WORK),
641 };
642
643 ins.constants.u32[0] = byte;
644
645 if (is_store) {
646 ins.src[0] = srcdest;
647 ins.src_types[0] = nir_type_uint32;
648
649 /* Ensure we are tightly swizzled so liveness analysis is
650 * correct */
651
652 for (unsigned i = 0; i < 4; ++i) {
653 if (!(mask & (1 << i)))
654 ins.swizzle[0][i] = COMPONENT_X;
655 }
656 } else
657 ins.dest = srcdest;
658
659 return ins;
660 }
661
662 static inline bool
663 mir_has_arg(const midgard_instruction *ins, unsigned arg)
664 {
665 if (!ins)
666 return false;
667
668 mir_foreach_src(ins, i) {
669 if (ins->src[i] == arg)
670 return true;
671 }
672
673 return false;
674 }
675
676 /* Scheduling */
677
678 void midgard_schedule_program(compiler_context *ctx);
679
680 void mir_ra(compiler_context *ctx);
681 void mir_squeeze_index(compiler_context *ctx);
682 void mir_lower_special_reads(compiler_context *ctx);
683 void mir_liveness_ins_update(uint16_t *live, const midgard_instruction *ins,
684 unsigned max);
685 void mir_compute_liveness(compiler_context *ctx);
686 void mir_invalidate_liveness(compiler_context *ctx);
687 bool mir_is_live_after(compiler_context *ctx, const midgard_block *block,
688 const midgard_instruction *start, int src);
689
690 void mir_create_pipeline_registers(compiler_context *ctx);
691 void midgard_promote_uniforms(compiler_context *ctx);
692
693 void midgard_emit_derivatives(compiler_context *ctx,
694 nir_intrinsic_instr *instr);
695
696 void midgard_lower_derivatives(compiler_context *ctx, midgard_block *block);
697
698 bool mir_op_computes_derivatives(mesa_shader_stage stage, unsigned op);
699
700 void mir_analyze_helper_terminate(compiler_context *ctx);
701 void mir_analyze_helper_requirements(compiler_context *ctx);
702
703 /* Final emission */
704
705 void emit_binary_bundle(compiler_context *ctx, midgard_block *block,
706 midgard_bundle *bundle, struct util_dynarray *emission,
707 int next_tag);
708
709 bool nir_fuse_io_16(nir_shader *shader);
710
711 bool midgard_nir_lod_errata(nir_shader *shader);
712
713 unsigned midgard_get_first_tag_from_block(compiler_context *ctx,
714 unsigned block_idx);
715
716 /* Optimizations */
717
718 bool midgard_opt_copy_prop(compiler_context *ctx, midgard_block *block);
719 bool midgard_opt_prop(compiler_context *ctx);
720 bool midgard_opt_combine_projection(compiler_context *ctx,
721 midgard_block *block);
722 bool midgard_opt_varying_projection(compiler_context *ctx,
723 midgard_block *block);
724 bool midgard_opt_dead_code_eliminate(compiler_context *ctx);
725 bool midgard_opt_dead_move_eliminate(compiler_context *ctx,
726 midgard_block *block);
727
728 #endif