From bfb4cb032761811b989a7458d97f5bbe1488e257 Mon Sep 17 00:00:00 2001 From: twisti Date: Wed, 23 Feb 2005 17:03:53 +0000 Subject: [PATCH] Save. --- src/vm/jit/schedule/schedule.c | 53 +++++++++++++++++++++++++++++----- src/vm/jit/schedule/schedule.h | 41 +++++++++++++++++--------- 2 files changed, 72 insertions(+), 22 deletions(-) diff --git a/src/vm/jit/schedule/schedule.c b/src/vm/jit/schedule/schedule.c index 61bc12046..bb806a6c1 100644 --- a/src/vm/jit/schedule/schedule.c +++ b/src/vm/jit/schedule/schedule.c @@ -28,7 +28,7 @@ Changes: - $Id: schedule.c 1961 2005-02-23 11:47:32Z twisti $ + $Id: schedule.c 1963 2005-02-23 17:03:53Z twisti $ */ @@ -83,7 +83,7 @@ minstruction *schedule_prepend_minstruction(minstruction *mi) tmpmi->opdep[0] = NULL; tmpmi->opdep[1] = NULL; tmpmi->opdep[2] = NULL; - tmpmi->sinknode = true; + tmpmi->issinknode = true; /* initially all nodes are sink nodes */ tmpmi->next = mi; /* link to next instruction */ @@ -113,9 +113,9 @@ void schedule_calc_priority(minstruction *mi) if (mi->opdep[i]->priority > pathpriority) pathpriority = mi->opdep[i]->priority; - /* depedent node is non-sink node */ + /* dependent node is non-sink node */ - mi->opdep[i]->sinknode = false; + mi->opdep[i]->issinknode = false; } } @@ -132,25 +132,62 @@ void schedule_calc_priority(minstruction *mi) void schedule_do_schedule(minstruction *mi) { minstruction *rootmi; - s4 i; + sinknode *rootsn; + sinknode *sn; + s4 i; + s4 icount; /* number of basic block instruction */ + + /* initialize variables */ rootmi = mi; + rootsn = NULL; + icount = 0; + + /* find all sink nodes */ + + while (mi) { + icount++; + + /* if current node is a sink node, add it to the sink node list */ + + if (mi->issinknode) { + sn = DNEW(sinknode); + sn->mi = mi; + sn->next = rootsn; + rootsn = sn; + } + + mi = mi->next; + } + + + /* walk through the instructions and do the actual scheduling */ + + for (i = 0; i < icount; i++) { + sn = rootsn; + + /* first, find the highest priority path */ + + while (sn) + sn = sn->next; + } + printf("bb start ---\n"); + mi = rootmi; + while (mi) { printf("%p: ", mi); /* disassinstr(&tmpmi->instr); */ printf("%05x", mi->instr); - printf(" --> %d, %d, %d: op1=%p, op2=%p, op3=%p\n", mi->sinknode, mi->latency, mi->priority, mi->opdep[0], mi->opdep[1], mi->opdep[2]); + printf(" --> %d, %d, %d: op1=%p, op2=%p, op3=%p\n", mi->issinknode, mi->latency, mi->priority, mi->opdep[0], mi->opdep[1], mi->opdep[2]); mi = mi->next; } printf("bb end ---\n\n"); - - } diff --git a/src/vm/jit/schedule/schedule.h b/src/vm/jit/schedule/schedule.h index 01cceb5f1..3a7f49be2 100644 --- a/src/vm/jit/schedule/schedule.h +++ b/src/vm/jit/schedule/schedule.h @@ -28,7 +28,7 @@ Changes: - $Id: schedule.h 1961 2005-02-23 11:47:32Z twisti $ + $Id: schedule.h 1963 2005-02-23 17:03:53Z twisti $ */ @@ -41,6 +41,27 @@ #include "vm/jit/reg.h" +typedef struct scheduledata scheduledata; +typedef struct minstruction minstruction; +typedef struct sinknode sinknode; + + +/* scheduledata **************************************************************** + + XXX + +*******************************************************************************/ + +struct scheduledata { + minstruction **sink_nodes; /* list containing sink nodes */ + minstruction **intregs_read_dep; + minstruction **intregs_write_dep; + minstruction **fltregs_read_dep; + minstruction **fltregs_write_dep; + minstruction *memory_write_dep; +}; + + /* minstruction **************************************************************** This structure contains all information for one machine instruction @@ -48,33 +69,25 @@ *******************************************************************************/ -typedef struct minstruction minstruction; - struct minstruction { u4 instr; /* machine instruction word */ u1 latency; /* instruction latency */ s4 priority; /* priority of this instruction node */ minstruction *opdep[3]; /* operand dependencies */ - bool sinknode; + bool issinknode; minstruction *next; /* link to next machine instruction */ }; -/* scheduledata **************************************************************** +/* sinknode ******************************************************************** XXX *******************************************************************************/ -typedef struct scheduledata scheduledata; - -struct scheduledata { - minstruction **sink_nodes; /* list containing sink nodes */ - minstruction **intregs_read_dep; - minstruction **intregs_write_dep; - minstruction **fltregs_read_dep; - minstruction **fltregs_write_dep; - minstruction *memory_write_dep; +struct sinknode { + minstruction *mi; /* link to machine instruction */ + sinknode *next; /* link to next sink node */ }; -- 2.25.1