Line 114... |
Line 114... |
if (insn[i].type & IT_MEMORY) {
|
if (insn[i].type & IT_MEMORY) {
|
f->msched[f->nmsched++] = REF (b, i);
|
f->msched[f->nmsched++] = REF (b, i);
|
if (otype == MO_NONE || otype == MO_WEAK) insn[i].type |= IT_FLAG1; /* mark unscheduled */
|
if (otype == MO_NONE || otype == MO_WEAK) insn[i].type |= IT_FLAG1; /* mark unscheduled */
|
}
|
}
|
}
|
}
|
#if 0
|
|
for (i = 0; i < f->nmsched; i++)
|
for (i = 0; i < f->nmsched; i++)
|
printf ("[%i]%i%c ", f->msched[i], f->mtype[i] & MT_WIDTH, (f->mtype[i] & MT_BURST) ? (f->mtype[i] & MT_BURSTE) ? 'E' : 'B' : ' ');
|
cucdebug (2, "[%x]%x%c ", f->msched[i], f->mtype[i] & MT_WIDTH, (f->mtype[i] & MT_BURST) ? (f->mtype[i] & MT_BURSTE) ? 'E' : 'B' : ' ');
|
printf ("\n");
|
cucdebug (2, "\n");
|
#endif
|
|
|
|
/* We can reorder just more loose types
|
/* We can reorder just more loose types
|
We assume, that memory accesses are currently in valid (but not neccesserly)
|
We assume, that memory accesses are currently in valid (but not neccesserly)
|
optimal order */
|
optimal order */
|
if (otype == MO_WEAK || otype == MO_NONE) {
|
if (otype == MO_WEAK || otype == MO_NONE) {
|
Line 150... |
Line 149... |
f->msched[i] = tmp;
|
f->msched[i] = tmp;
|
f->INSN(f->msched[i]).type &= ~IT_FLAG1; /* mark scheduled */
|
f->INSN(f->msched[i]).type &= ~IT_FLAG1; /* mark scheduled */
|
}
|
}
|
}
|
}
|
|
|
#if 0
|
|
for (i = 0; i < f->nmsched; i++)
|
for (i = 0; i < f->nmsched; i++)
|
printf ("[%i]%i%c ", f->msched[i], f->mtype[i] & MT_WIDTH, (f->mtype[i] & MT_BURST) ? (f->mtype[i] & MT_BURSTE) ? 'E' : 'B' : ' ');
|
cucdebug (2, "[%x]%x%c ", f->msched[i], f->mtype[i] & MT_WIDTH, (f->mtype[i] & MT_BURST) ? (f->mtype[i] & MT_BURSTE) ? 'E' : 'B' : ' ');
|
printf ("\n");
|
cucdebug (2, "\n");
|
#endif
|
|
|
|
/* Assign memory types */
|
/* Assign memory types */
|
for (i = 0; i < f->nmsched; i++) {
|
for (i = 0; i < f->nmsched; i++) {
|
cuc_insn *a = &f->INSN(f->msched[i]);
|
cuc_insn *a = &f->INSN(f->msched[i]);
|
f->mtype[i] = !II_IS_LOAD(a->index) ? MT_STORE : MT_LOAD;
|
f->mtype[i] = !II_IS_LOAD(a->index) ? MT_STORE : MT_LOAD;
|
Line 199... |
Line 196... |
for (j = 0; j < MAX_OPERANDS; j++)
|
for (j = 0; j < MAX_OPERANDS; j++)
|
if (f->bb[b].insn[i].opt[j] & OPT_REF && f->bb[b].insn[i].op[j] == t2)
|
if (f->bb[b].insn[i].opt[j] & OPT_REF && f->bb[b].insn[i].op[j] == t2)
|
f->bb[b].insn[i].op[j] = t1;
|
f->bb[b].insn[i].op[j] = t1;
|
|
|
} else goto keep;
|
} else goto keep;
|
}
|
} else goto keep;
|
} else {
|
} else {
|
keep:
|
keep:
|
f->msched[j] = f->msched[i];
|
f->msched[j] = f->msched[i];
|
f->mtype[j++] = f->mtype[i];
|
f->mtype[j++] = f->mtype[i];
|
}
|
}
|
f->nmsched = j;
|
f->nmsched = j;
|
}
|
}
|
|
|
|
for (i = 0; i < f->nmsched; i++)
|
|
cucdebug (2, "[%x]%x%c ", f->msched[i], f->mtype[i] & MT_WIDTH, (f->mtype[i] & MT_BURST) ? (f->mtype[i] & MT_BURSTE) ? 'E' : 'B' : ' ');
|
|
cucdebug (2, "\n");
|
|
if (cuc_debug > 5) print_cuc_bb (f, "AFTER_MEM_REMOVAL");
|
|
|
if (config.cuc.enable_bursts) {
|
if (config.cuc.enable_bursts) {
|
//printf ("\n");
|
//printf ("\n");
|
for (i = 1; i < f->nmsched; i++) {
|
for (i = 1; i < f->nmsched; i++) {
|
cuc_insn *a = &f->INSN(f->msched[i - 1]);
|
cuc_insn *a = &f->INSN(f->msched[i - 1]);
|
cuc_insn *b = &f->INSN(f->msched[i]);
|
cuc_insn *b = &f->INSN(f->msched[i]);
|
Line 236... |
Line 238... |
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
#if 0
|
|
printf ("\n");
|
|
for (i = 0; i < f->nmsched; i++)
|
for (i = 0; i < f->nmsched; i++)
|
printf ("[%i]%i%c ", f->msched[i], f->mtype[i] & MT_WIDTH, (f->mtype[i] & MT_BURST) ? (f->mtype[i] & MT_BURSTE) ? 'E' : 'B' : ' ');
|
cucdebug (2, "[%x]%x%c ", f->msched[i], f->mtype[i] & MT_WIDTH, (f->mtype[i] & MT_BURST) ? (f->mtype[i] & MT_BURSTE) ? 'E' : 'B' : ' ');
|
printf ("\n");
|
cucdebug (2, "\n");
|
#endif
|
|
|
|
/* We don't need dependencies in non-memory instructions */
|
/* We don't need dependencies in non-memory instructions */
|
for (b = 0; b < f->num_bb; b++) {
|
for (b = 0; b < f->num_bb; b++) {
|
cuc_insn *insn = f->bb[b].insn;
|
cuc_insn *insn = f->bb[b].insn;
|
for (i = 0; i < f->bb[b].ninsn; i++) if (!(insn[i].type & IT_MEMORY))
|
for (i = 0; i < f->bb[b].ninsn; i++) if (!(insn[i].type & IT_MEMORY))
|
Line 264... |
Line 263... |
int maxs = lasts[t];
|
int maxs = lasts[t];
|
int maxc = lastc[t];
|
int maxc = lastc[t];
|
dep_list *tmp = f->INSN(f->msched[i]).dep;
|
dep_list *tmp = f->INSN(f->msched[i]).dep;
|
while (tmp) {
|
while (tmp) {
|
if (f->INSN(tmp->ref).type & IT_MEMORY && REF_BB(tmp->ref) == REF_BB(f->msched[i])) {
|
if (f->INSN(tmp->ref).type & IT_MEMORY && REF_BB(tmp->ref) == REF_BB(f->msched[i])) {
|
|
printf ("%i %x %x\n", i, f->msched[i], tmp->ref);
|
/* Search for the reference */
|
/* Search for the reference */
|
for (j = 0; j < f->nmsched; j++) if (f->msched[j] == tmp->ref) break;
|
for (j = 0; j < f->nmsched; j++) if (f->msched[j] == tmp->ref) break;
|
assert (j < f->nmsched);
|
assert (j < f->nmsched);
|
if (f->mtype[j] & MT_STORE) {
|
if (f->mtype[j] & MT_STORE) {
|
if (maxs < j) maxs = j;
|
if (maxs < j) maxs = j;
|