mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-12-19 15:25:19 +02:00
m1/perf/sched.c: if register allocation fails, return an error instead of aborting
This commit is contained in:
parent
bb8c1ce741
commit
3da0074896
@ -244,7 +244,7 @@ static int alloc_reg(struct insn *setter)
|
||||
} else {
|
||||
reg = list_pop(&sc->unallocated);
|
||||
if (!reg)
|
||||
abort();
|
||||
return -1;
|
||||
|
||||
#ifdef REG_STATS
|
||||
sc->curr_regs++;
|
||||
@ -495,10 +495,11 @@ static void unblock_after(struct insn *insn, int cycle)
|
||||
}
|
||||
|
||||
|
||||
static void issue(struct insn *insn, unsigned *code)
|
||||
static int issue(struct insn *insn, unsigned *code)
|
||||
{
|
||||
struct data_ref *ref;
|
||||
int end;
|
||||
int end, reg;
|
||||
|
||||
end = sc->cycle+insn->latency;
|
||||
|
||||
Dprintf("cycle %d: insn %lu L %d (A %d B %d)\n", sc->cycle,
|
||||
@ -523,7 +524,10 @@ static void issue(struct insn *insn, unsigned *code)
|
||||
abort();
|
||||
}
|
||||
|
||||
CODE(end).dest = alloc_reg(insn);
|
||||
reg = alloc_reg(insn);
|
||||
if (reg < 0)
|
||||
return -1;
|
||||
CODE(end).dest = reg;
|
||||
CODE(sc->cycle).opcode = fpvm_to_pfpu(insn->vm_insn->opcode);
|
||||
|
||||
foreach (ref, &insn->dependants)
|
||||
@ -580,7 +584,8 @@ static int schedule(unsigned int *code)
|
||||
}
|
||||
}
|
||||
if (best) {
|
||||
issue(best, code);
|
||||
if (issue(best, code) < 0)
|
||||
return -1;
|
||||
list_del(&best->more);
|
||||
remaining--;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user