* the end of a clause. Implies ADD */
#define BI_SCHED_HI_LATENCY ((1 << 7) | BI_SCHED_ADD)
+/* Intrinsic is vectorized and should read 4 components regardless of writemask */
+#define BI_VECTOR (1 << 8)
+
+/* Use a data register for src0/dest respectively, bypassing the usual
+ * register accessor. Mutually exclusive. */
+#define BI_DATA_REG_SRC (1 << 9)
+#define BI_DATA_REG_DEST (1 << 10)
+
/* It can't get any worse than csel4... can it? */
#define BIR_SRC_COUNT 4
bool back_to_back;
bool branch_conditional;
+ /* Assigned data register */
+ unsigned data_register;
+
/* Corresponds to the usual bit but shifted by a clause */
bool data_register_write_barrier;
/* Constants read by this clause. ISA limit. */
uint64_t constants[8];
unsigned constant_count;
+
+ /* What type of high latency instruction is here, basically */
+ unsigned clause_type;
} bi_clause;
typedef struct bi_block {
* Uniform: access a uniform register given by low bits.
* Constant: access the specified constant
* Zero: special cased to avoid wasting a constant
+ * Passthrough: a bifrost_packed_src to passthrough T/T0/T1
*/
#define BIR_INDEX_REGISTER (1 << 31)
#define BIR_INDEX_UNIFORM (1 << 30)
#define BIR_INDEX_CONSTANT (1 << 29)
#define BIR_INDEX_ZERO (1 << 28)
+#define BIR_INDEX_PASS (1 << 27)
/* Keep me synced please so we can check src & BIR_SPECIAL */
#define BIR_SPECIAL ((BIR_INDEX_REGISTER | BIR_INDEX_UNIFORM) | \
- (BIR_INDEX_CONSTANT | BIR_INDEX_ZERO)
+ (BIR_INDEX_CONSTANT | BIR_INDEX_ZERO | BIR_INDEX_PASS))
static inline unsigned
bi_max_temp(bi_context *ctx)
{
unsigned alloc = MAX2(ctx->impl->reg_alloc, ctx->impl->ssa_alloc);
- return ((alloc + 1 + ctx->temp_alloc) << 1) | BIR_IS_REG;
+ return ((alloc + 2 + ctx->temp_alloc) << 1);
}
static inline unsigned
list_for_each_entry_from(pan_block, v, from, &ctx->blocks, link)
#define bi_foreach_instr_in_block(block, v) \
- list_for_each_entry(bi_instruction, v, &block->base.instructions, link)
+ list_for_each_entry(bi_instruction, v, &(block)->base.instructions, link)
#define bi_foreach_instr_in_block_rev(block, v) \
- list_for_each_entry_rev(bi_instruction, v, &block->base.instructions, link)
+ list_for_each_entry_rev(bi_instruction, v, &(block)->base.instructions, link)
#define bi_foreach_instr_in_block_safe(block, v) \
- list_for_each_entry_safe(bi_instruction, v, &block->base.instructions, link)
+ list_for_each_entry_safe(bi_instruction, v, &(block)->base.instructions, link)
#define bi_foreach_instr_in_block_safe_rev(block, v) \
- list_for_each_entry_safe_rev(bi_instruction, v, &block->base.instructions, link)
+ list_for_each_entry_safe_rev(bi_instruction, v, &(block)->base.instructions, link)
#define bi_foreach_instr_in_block_from(block, v, from) \
- list_for_each_entry_from(bi_instruction, v, from, &block->base.instructions, link)
+ list_for_each_entry_from(bi_instruction, v, from, &(block)->base.instructions, link)
#define bi_foreach_instr_in_block_from_rev(block, v, from) \
- list_for_each_entry_from_rev(bi_instruction, v, from, &block->base.instructions, link)
+ list_for_each_entry_from_rev(bi_instruction, v, from, &(block)->base.instructions, link)
#define bi_foreach_clause_in_block(block, v) \
- list_for_each_entry(bi_clause, v, &block->clauses, link)
+ list_for_each_entry(bi_clause, v, &(block)->clauses, link)
#define bi_foreach_instr_global(ctx, v) \
bi_foreach_block(ctx, v_block) \
- bi_foreach_instr_in_block((pan_block *) v_block, v)
+ bi_foreach_instr_in_block((bi_block *) v_block, v)
#define bi_foreach_instr_global_safe(ctx, v) \
bi_foreach_block(ctx, v_block) \
- bi_foreach_instr_in_block_safe((pan_block *) v_block, v)
+ bi_foreach_instr_in_block_safe((bi_block *) v_block, v)
/* Based on set_foreach, expanded with automatic type casts */
return list_first_entry(&(ins->link), bi_instruction, link);
}
+static inline pan_block *
+pan_next_block(pan_block *block)
+{
+ return list_first_entry(&(block->link), pan_block, link);
+}
+
/* BIR manipulation */
bool bi_has_outmod(bi_instruction *ins);
bool bi_has_source_mods(bi_instruction *ins);
bool bi_is_src_swizzled(bi_instruction *ins, unsigned s);
bool bi_has_arg(bi_instruction *ins, unsigned arg);
+uint16_t bi_from_bytemask(uint16_t bytemask, unsigned bytes);
+unsigned bi_get_component_count(bi_instruction *ins);
uint16_t bi_bytemask_of_read_components(bi_instruction *ins, unsigned node);
/* BIR passes */
+bool bi_opt_dead_code_eliminate(bi_context *ctx, bi_block *block);
void bi_schedule(bi_context *ctx);
+void bi_register_allocate(bi_context *ctx);
/* Liveness */
void bi_invalidate_liveness(bi_context *ctx);
bool bi_is_live_after(bi_context *ctx, bi_block *block, bi_instruction *start, int src);
+/* Code emit */
+
+void bi_pack(bi_context *ctx, struct util_dynarray *emission);
+
#endif