Date:2011-09-21 22:53:13 (7 years 11 months ago)
Author:Werner Almesberger
Commit:e98f08e8573685c10a823551cbdb9c721d44f1ca
Message:m1/perf/sched.c: light code cleanup

Files: m1/perf/sched.c (7 diffs)

Change Details

m1/perf/sched.c
298298}
299299
300300
301static void unblock(struct insn *insn);
302static void put_reg_by_setter(struct insn *setter, int vm_reg)
303{
304    struct vm_reg *reg;
305
306    if (setter) {
307        put_reg(setter->vm_insn->dest);
308        if (setter->next_setter)
309            unblock(setter->next_setter);
310    } else {
311        reg = sc->regs+vm_reg2idx(vm_reg);
312        if (reg->first_setter && !reg->first_setter->rmw)
313            unblock(reg->first_setter);
314    }
315}
316
317
318301static int lookup_pfpu_reg(int vm_reg)
319302{
320303    return vm_reg >= 0 ? vm_reg : sc->regs[vm_reg2idx(vm_reg)].pfpu_reg;
...... 
464447}
465448
466449
450static void put_reg_by_setter(struct insn *setter, int vm_reg)
451{
452    struct vm_reg *reg;
453
454    if (setter) {
455        put_reg(setter->vm_insn->dest);
456        if (setter->next_setter)
457            unblock(setter->next_setter);
458    } else {
459        reg = sc->regs+vm_reg2idx(vm_reg);
460        if (reg->first_setter && !reg->first_setter->rmw)
461            unblock(reg->first_setter);
462    }
463}
464
465
467466static void unblock_after(struct insn *insn, int cycle)
468467{
469468    if (insn->earliest <= cycle)
...... 
472471}
473472
474473
475static void issue(struct insn *insn, int cycle, unsigned *code)
474static void issue(struct insn *insn, unsigned *code)
476475{
477476    struct data_ref *ref;
478477    int end;
479    end = cycle+insn->latency;
478    end = sc->cycle+insn->latency;
480479
481    Dprintf("cycle %d: insn %lu L %d (A %d B %d)\n", cycle,
480    Dprintf("cycle %d: insn %lu L %d (A %d B %d)\n", sc->cycle,
482481        insn-sc->insns, insn->latency, insn->vm_insn->opa,
483482        insn->vm_insn->opb);
484483
...... 
487486        put_reg_by_setter(insn->cond.dep, FPVM_REG_IFB);
488487        /* fall through */
489488    case 2:
490        CODE(cycle).opb = lookup_pfpu_reg(insn->vm_insn->opb);
489        CODE(sc->cycle).opb = lookup_pfpu_reg(insn->vm_insn->opb);
491490        put_reg_by_setter(insn->opb.dep, insn->vm_insn->opb);
492491        /* fall through */
493492    case 1:
494        CODE(cycle).opa = lookup_pfpu_reg(insn->vm_insn->opa);
493        CODE(sc->cycle).opa = lookup_pfpu_reg(insn->vm_insn->opa);
495494        put_reg_by_setter(insn->opa.dep, insn->vm_insn->opa);
496495        break;
497496    case 0:
...... 
501500    }
502501
503502    CODE(end).dest = alloc_reg(insn);
504    CODE(cycle).opcode = fpvm_to_pfpu(insn->vm_insn->opcode);
503    CODE(sc->cycle).opcode = fpvm_to_pfpu(insn->vm_insn->opcode);
505504
506505    foreach (ref, &insn->dependants)
507506        unblock_after(ref->insn, end);
...... 
555554                if (!best || best->distance < insn->distance)
556555                    best = insn;
557556#else
558                issue(insn, i, code);
557                issue(insn, code);
559558                list_del(&insn->more);
560559                remaining--;
561560                break;
...... 
564563        }
565564#ifdef LCPF
566565        if (best) {
567            issue(best, i, code);
566            issue(best, code);
568567            list_del(&best->more);
569568            remaining--;
570569        }

Archive Download the corresponding diff file

Branches:
master



interactive