1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 13:30:38 +02:00

m1/perf/sched.c: don't try to unblock references of next setter twice (more)

Also changed:
- added commented-out #define DEBUG
- work-around for abort() being a no-op in libbase
This commit is contained in:
Werner Almesberger 2011-09-23 22:15:11 -03:00
parent 69cfc407d5
commit 0f80dcf118

View File

@ -22,7 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <assert.h> //#include <assert.h>
#include <fpvm/is.h> #include <fpvm/is.h>
#include <fpvm/fpvm.h> #include <fpvm/fpvm.h>
@ -31,10 +31,15 @@
#include <hw/pfpu.h> #include <hw/pfpu.h>
#undef assert
#define assert(x) \
do { if (!(x)) { printf("ASSERT: " #x "\n"); abort(); } } \
while (0)
//#define REG_STATS //#define REG_STATS
//#define LCPF /* longest critical path first */ //#define LCPF /* longest critical path first */
//#define DEBUG
#ifdef DEBUG #ifdef DEBUG
#define Dprintf printf #define Dprintf printf
#else #else
@ -447,13 +452,14 @@ static void unblock(struct insn *insn)
} }
static void put_reg_by_setter(struct insn *setter, int vm_reg) static void put_reg_by_ref(struct data_ref *ref, int vm_reg)
{ {
struct insn *setter = ref->dep;
struct vm_reg *reg; struct vm_reg *reg;
if (setter) { if (setter) {
put_reg(setter->vm_insn->dest); put_reg(setter->vm_insn->dest);
if (setter->next_setter) if (setter->next_setter && setter->next_setter != ref->insn)
unblock(setter->next_setter); unblock(setter->next_setter);
} else { } else {
reg = sc->regs+vm_reg2idx(vm_reg); reg = sc->regs+vm_reg2idx(vm_reg);
@ -483,15 +489,15 @@ static void issue(struct insn *insn, unsigned *code)
switch (insn->arity) { switch (insn->arity) {
case 3: case 3:
put_reg_by_setter(insn->cond.dep, FPVM_REG_IFB); put_reg_by_ref(&insn->cond, FPVM_REG_IFB);
/* fall through */ /* fall through */
case 2: case 2:
CODE(sc->cycle).opb = lookup_pfpu_reg(insn->vm_insn->opb); CODE(sc->cycle).opb = lookup_pfpu_reg(insn->vm_insn->opb);
put_reg_by_setter(insn->opb.dep, insn->vm_insn->opb); put_reg_by_ref(&insn->opb, insn->vm_insn->opb);
/* fall through */ /* fall through */
case 1: case 1:
CODE(sc->cycle).opa = lookup_pfpu_reg(insn->vm_insn->opa); CODE(sc->cycle).opa = lookup_pfpu_reg(insn->vm_insn->opa);
put_reg_by_setter(insn->opa.dep, insn->vm_insn->opa); put_reg_by_ref(&insn->opa, insn->vm_insn->opa);
break; break;
case 0: case 0:
break; break;