Line 481... |
Line 481... |
if (n1 <= 0
|
if (n1 <= 0
|
|| !(f->bb[pred].insn[n1 - 1].type & IT_BRANCH)) type = 1;
|
|| !(f->bb[pred].insn[n1 - 1].type & IT_BRANCH)) type = 1;
|
if (type == 0 && f->bb[succ].prev[0] == f->bb[succ].next[0]) add_cond = 1;
|
if (type == 0 && f->bb[succ].prev[0] == f->bb[succ].next[0]) add_cond = 1;
|
if (type == 2) add_cond = 1;
|
if (type == 2) add_cond = 1;
|
|
|
assert (f->bb[pred].next[0] == f->bb[succ].next[0] || type != 2); /* not supported */
|
//assert (f->bb[pred].next[0] == f->bb[succ].next[0] || type != 2); /* not supported */
|
|
|
ninsn = n1 + n2 + (type == 1 ? 0 : 1) + (add_cond ? MAX_REGS : 0);
|
ninsn = n1 + n2 + (type == 1 ? 0 : 1) + (add_cond ? MAX_REGS : 0);
|
|
|
insn = (cuc_insn *) malloc (ninsn * sizeof (cuc_insn));
|
insn = (cuc_insn *) malloc (ninsn * sizeof (cuc_insn));
|
for (i = 0; i < n1; i++) insn[i] = f->bb[pred].insn[i];
|
for (i = 0; i < n1; i++) insn[i] = f->bb[pred].insn[i];
|
Line 567... |
Line 567... |
for (i = 1; i < MAX_REGS; i++) {
|
for (i = 1; i < MAX_REGS; i++) {
|
cuc_insn *ii = &insn[n1 + n2 + i];
|
cuc_insn *ii = &insn[n1 + n2 + i];
|
int a = f->bb[pred].last_used_reg[i];
|
int a = f->bb[pred].last_used_reg[i];
|
int b = f->bb[succ].last_used_reg[i];
|
int b = f->bb[succ].last_used_reg[i];
|
|
|
if (b < 0) change_insn_type (ii, II_NOP);
|
/* We have deleted first branch instruction, now we must setup FLAG_REG,
|
|
to point to conditional */
|
|
if (i == FLAG_REG) {
|
|
change_insn_type (ii, II_CMOV);
|
|
ii->type = i == FLAG_REG || i == LRBB_REG ? IT_COND : 0;
|
|
ii->dep = NULL;
|
|
ii->op[0] = i; ii->opt[0] = OPT_REGISTER | OPT_DEST;
|
|
ii->op[1] = cond_op; ii->opt[1] = cond_opt;
|
|
if (b >= 0) {
|
|
ii->op[2] = b; ii->opt[2] = OPT_REF;
|
|
} else {
|
|
ii->op[2] = cond_op; ii->opt[2] = cond_opt;
|
|
}
|
|
ii->op[3] = cond_op; ii->opt[3] = cond_opt;
|
|
reloc[REF_I(a)] = REF (pred, n1 + n2 + i);
|
|
} else if (b < 0) change_insn_type (ii, II_NOP);
|
else if (a < 0) {
|
else if (a < 0) {
|
change_insn_type (ii, II_ADD);
|
change_insn_type (ii, II_ADD);
|
ii->type = i == FLAG_REG || i == LRBB_REG ? IT_COND : 0;
|
ii->type = i == FLAG_REG || i == LRBB_REG ? IT_COND : 0;
|
ii->dep = NULL;
|
ii->dep = NULL;
|
ii->op[0] = i; ii->opt[0] = OPT_REGISTER | OPT_DEST;
|
ii->op[0] = i; ii->opt[0] = OPT_REGISTER | OPT_DEST;
|
Line 794... |
Line 809... |
join_bb (f, p, i, 2);
|
join_bb (f, p, i, 2);
|
goto remove_lrbb;
|
goto remove_lrbb;
|
}
|
}
|
#endif
|
#endif
|
if (f->bb[p].next[1] == i
|
if (f->bb[p].next[1] == i
|
&& (f->bb[i].next[0] == f->bb[p].next[1]
|
&& (f->bb[p].next[0] == f->bb[i].next[1]
|
|| f->bb[i].next[0] == f->bb[p].next[0])) {
|
|| f->bb[p].next[0] == f->bb[i].next[0])) {
|
join_bb (f, p, i, 2);
|
join_bb (f, p, i, 2);
|
modified = 1;
|
modified = 1;
|
goto remove_lrbb;
|
goto remove_lrbb;
|
}
|
}
|
}
|
}
|