{
bool progress = false;
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
switch (inst->op) {
case QOP_FMIN:
if (is_1f(c, inst->src[1]) &&
{
bool progress = false;
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
if (constant_fold(c, inst))
progress = true;
}
bool progress = false;
bool debug = false;
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
int nsrc = qir_get_op_nsrc(inst->op);
for (int i = 0; i < nsrc; i++) {
if (inst->src[i].file != QFILE_TEMP)
{
bool progress = false;
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
/* The small immediate value sits in the raddr B field, so we
* can't have 2 small immediates in one instruction (unless
* they're the same value, but that should be optimized away
uint32_t vpm_write_count = 0;
memset(&use_count, 0, sizeof(use_count));
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
switch (inst->dst.file) {
case QFILE_VPM:
vpm_writes[vpm_write_count++] = inst;
/* For instructions reading from a temporary that contains a VPM read
* result, try to move the instruction up in place of the VPM read.
*/
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
if (!inst)
continue;
bool input_live[c->num_input_slots];
memset(input_live, 0, sizeof(input_live));
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
if (inst->src[i].file == QFILE_VARY)
input_live[inst->src[i].index] = true;
qir_reg(QFILE_LOAD_IMM, val), c->undef));
}
+#define qir_for_each_inst_inorder(inst, c) \
+ list_for_each_entry(struct qinst, inst, &c->instructions, link)
+
#endif /* VC4_QIR_H */
* than one uniform referenced, and add those uniform values to the
* ht.
*/
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
uint32_t nsrc = qir_get_op_nsrc(inst->op);
if (qir_get_instruction_uniform_count(inst) <= 1)
struct qinst *mov = qir_inst(QOP_MOV, temp, unif, c->undef);
list_add(&mov->link, &c->instructions);
c->defs[temp.index] = mov;
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
uint32_t nsrc = qir_get_op_nsrc(inst->op);
uint32_t count = qir_get_instruction_uniform_count(inst);
fail_instr(c, def, "SSA def with condition");
}
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
switch (inst->dst.file) {
case QFILE_TEMP:
if (inst->dst.index >= c->num_temps)
break;
}
- list_for_each_entry(struct qinst, qinst, &c->instructions, link) {
+ qir_for_each_inst_inorder(qinst, c) {
#if 0
fprintf(stderr, "translating qinst to qpu: ");
qir_dump_inst(qinst);
/* Compute the live ranges so we can figure out interference.
*/
uint32_t ip = 0;
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
if (inst->dst.file == QFILE_TEMP) {
def[inst->dst.index] = MIN2(ip, def[inst->dst.index]);
use[inst->dst.index] = ip;
sizeof(class_bits));
ip = 0;
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
if (qir_writes_r4(inst)) {
/* This instruction writes r4 (and optionally moves
* its result to a temp), so nothing else can be
uint32_t uniform_index_size = 0;
uint32_t next_uniform = 0;
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
+ qir_for_each_inst_inorder(inst, c) {
uint32_t new = ~0;
for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {