Date:2011-09-18 11:56:00 (8 years 1 day ago)
Author:Werner Almesberger
Commit:abd7de72651ce9ef077215cfeec797e0ec89e377
Message:m1/perf/: added instrumentation for monitoring register allocation

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

Change Details

m1/perf/sched.c
3131#include <hw/pfpu.h>
3232
3333
34#define REG_STATS
35
3436#ifdef DEBUG
3537#define Dprintf printf
3638#else
...... 
8890    struct list unscheduled; /* unscheduled insns */
8991    struct list waiting; /* insns waiting to be scheduled */
9092    struct list ready[PFPU_PROGSIZE]; /* insns ready at nth cycle */
93#ifdef REG_STATS
94    int max_regs, curr_regs; /* allocation statistics */
95#endif
9196} *sc;
9297
9398
...... 
211216    reg = list_pop(&sc->unallocated);
212217    if (!reg)
213218        abort();
219
220#ifdef REG_STATS
221    sc->curr_regs++;
222    if (sc->curr_regs > sc->max_regs)
223        sc->max_regs = sc->curr_regs;
224#endif
225
214226    reg->vm_reg = vm_reg;
215227    pfpu_reg = reg-sc->pfpu_regs;
216228
...... 
238250
239251    Dprintf(" free reg %d\n", regs[vm_idx].pfpu_reg);
240252
253#ifdef REG_STATS
254    sc->curr_regs--;
255#endif
256
241257    /*
242258     * Prepend so that register numbers stay small and bugs reveal
243259     * themselves more rapidly.
...... 
488504    init_scheduler_context(frag, reg);
489505    memset(code, 0, PFPU_PROGSIZE*sizeof(*code));
490506    res = schedule(code);
507
508#ifdef REG_STATS
509    printf("regs: %d/%d\n", sc->curr_regs, sc->max_regs);
510#endif
511
491512    free(sc->regs);
513    free(sc);
492514    if (res < 0)
493515        return res;
494516    if (frag->vector_mode)

Archive Download the corresponding diff file

Branches:
master



interactive