SchedDataCalculatorGM107::findFirstUse(const Instruction *bari) const
{
Instruction *insn, *next;
- int minGPR, maxGPR;
if (!bari->defExists(0))
return NULL;
- minGPR = bari->def(0).rep()->reg.data.id;
- maxGPR = minGPR + bari->def(0).rep()->reg.size / 4 - 1;
-
for (insn = bari->next; insn != NULL; insn = next) {
next = insn->next;
for (int s = 0; insn->srcExists(s); ++s) {
const Value *src = insn->src(s).rep();
- if (bari->def(0).getFile() == FILE_GPR) {
- if (insn->src(s).getFile() != FILE_GPR ||
- src->reg.data.id + src->reg.size / 4 - 1 < minGPR ||
- src->reg.data.id > maxGPR)
- continue;
- return insn;
- } else
- if (bari->def(0).getFile() == FILE_PREDICATE) {
- if (insn->src(s).getFile() != FILE_PREDICATE ||
- src->reg.data.id != minGPR)
- continue;
- return insn;
+ for (int d = 0; bari->defExists(d); ++d) {
+ const ValueDef &def = bari->def(d);
+ int minGPR = def.rep()->reg.data.id;
+ int maxGPR = minGPR + def.rep()->reg.size / 4 - 1;
+
+ if (def.getFile() == FILE_GPR) {
+ if (insn->src(s).getFile() != FILE_GPR ||
+ src->reg.data.id + src->reg.size / 4 - 1 < minGPR ||
+ src->reg.data.id > maxGPR)
+ continue;
+ return insn;
+ } else
+ if (def.getFile() == FILE_PREDICATE) {
+ if (insn->src(s).getFile() != FILE_PREDICATE ||
+ src->reg.data.id != minGPR)
+ continue;
+ return insn;
+ }
}
}
}