Changes:
- $Id: schedule.c 1961 2005-02-23 11:47:32Z twisti $
+ $Id: schedule.c 1963 2005-02-23 17:03:53Z twisti $
*/
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 */
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;
}
}
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");
-
-
}
Changes:
- $Id: schedule.h 1961 2005-02-23 11:47:32Z twisti $
+ $Id: schedule.h 1963 2005-02-23 17:03:53Z twisti $
*/
#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
*******************************************************************************/
-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 */
};