unsigned ir3_count_instructions(struct ir3 *ir);
unsigned ir3_count_instructions_ra(struct ir3 *ir);
+/**
+ * Move 'instr' to just before 'after'
+ */
+static inline void
+ir3_instr_move_before(struct ir3_instruction *instr,
+ struct ir3_instruction *after)
+{
+ list_delinit(&instr->node);
+ list_addtail(&instr->node, &after->node);
+}
+
+/**
+ * Move 'instr' to just after 'before':
+ */
+static inline void
+ir3_instr_move_after(struct ir3_instruction *instr,
+ struct ir3_instruction *before)
+{
+ list_delinit(&instr->node);
+ list_add(&instr->node, &before->node);
+}
+
void ir3_find_ssa_uses(struct ir3 *ir, void *mem_ctx, bool falsedeps);
void ir3_set_dst_type(struct ir3_instruction *instr, bool half);
/* it will have already been appended to the end of the block, which
* isn't where we want it, so fix-up the location:
*/
- list_delinit(&mov->node);
- list_add(&mov->node, &atomic->node);
+ ir3_instr_move_after(mov, atomic);
return atomic->data = mov;
}
* it should be safe to leave at the end of the block it is in:
*/
if (src->block == collect->block) {
- list_delinit(&mov->node);
- list_addtail(&mov->node, &collect->node);
+ ir3_instr_move_before(mov, collect);
}
}
ir3_reg_create(baryf, regid(0, 0), 0);
/* insert the dummy bary.f after last_input: */
- list_delinit(&baryf->node);
- list_add(&baryf->node, &last_input->node);
+ ir3_instr_move_after(baryf, last_input);
last_input = baryf;