CACAO
schedule.h
Go to the documentation of this file.
1 /* src/vm/jit/schedule/schedule.h - architecture independent instruction
2  scheduler
3 
4  Copyright (C) 1996-2013
5  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 
7  This file is part of CACAO.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2, or (at
12  your option) any later version.
13 
14  This program is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  02110-1301, USA.
23 
24  Contact: cacao@cacaojvm.org
25 
26  Authors: Christian Thalinger
27 
28  Changes:
29 
30 */
31 
32 
33 #ifndef _SCHEDULE_H
34 #define _SCHEDULE_H
35 
36 #include "arch.hpp"
37 #include "types.hpp"
38 #include "vm/jit/reg.hpp"
39 
40 
41 typedef struct scheduledata scheduledata;
42 typedef struct minstruction minstruction;
43 typedef struct edgenode edgenode;
44 typedef struct opcycles opcycles;
45 
46 
47 /* machine instruction flags **************************************************/
48 
49 #define SCHEDULE_LEADER 0x01
50 #define SCHEDULE_SINK 0x02
51 
52 #define SCHEDULE_UNIT_ALU 0x04
53 #define SCHEDULE_UNIT_MEM 0x08
54 #define SCHEDULE_UNIT_BRANCH 0x10
55 
56 
57 #define M_SCHEDULE_SET_EXCEPTION_POINT /* if (jd->exceptiontablelength > 0) { schedule_do_schedule(sd); schedule_reset(sd, rd); } */
58 
59 
60 struct opcycles {
63 };
64 
65 
66 /* scheduledata ****************************************************************
67 
68  XXX
69 
70 *******************************************************************************/
71 
72 struct scheduledata {
73  minstruction *mi; /* machine instruction array */
74  s4 micount; /* number of machine instructions */
75  edgenode *leaders; /* list containing leader nodes */
76 
80 
84 
85  FILE *file;
86 };
87 
88 
89 /* minstruction ****************************************************************
90 
91  This structure contains all information for one machine instruction
92  required to schedule it.
93 
94 *******************************************************************************/
95 
96 struct minstruction {
97  u4 instr[2]; /* machine instruction word */
99 #if 1
100  s1 startcycle; /* start pipeline cycle */
101  s1 endcycle; /* end pipeline cycle */
102 #endif
104  s4 priority; /* priority of this instruction node */
106  edgenode *deps; /* operand dependencies */
107  minstruction *next; /* link to next machine instruction */
108 };
109 
110 
111 /* edgenode ********************************************************************
112 
113  XXX
114 
115 *******************************************************************************/
116 
117 /* TODO rename to edgenode */
118 struct edgenode {
119  s4 minum; /* machine instruction number */
120  s1 opnum; /* dependency operand number */
123  edgenode *next; /* link to next node */
124 };
125 
126 
127 /* function prototypes ********************************************************/
128 
131 void schedule_close(scheduledata *sd);
132 
134 
135 /* void schedule_add_define_dep(scheduledata *sd, s1 operand, s4 *define_dep, edgenode **use_dep); */
136 /* void schedule_add_use_dep(scheduledata *sd, s1 operand, s4 *define_dep, edgenode **use_dep); */
137 void schedule_add_define_dep(scheduledata *sd, s1 opnum, edgenode **define_dep, edgenode **use_dep);
138 void schedule_add_use_dep(scheduledata *sd, s1 opnum, edgenode **define_dep, edgenode **use_dep);
139 
141 
142 #endif /* _SCHEDULE_H */
143 
144 
145 /*
146  * These are local overrides for various environment variables in Emacs.
147  * Please do not remove this and leave it at the end of the file, where
148  * Emacs will automagically detect them.
149  * ---------------------------------------------------------------------
150  * Local variables:
151  * mode: c
152  * indent-tabs-mode: t
153  * c-basic-offset: 4
154  * tab-width: 4
155  * End:
156  */
void schedule_reset(scheduledata *sd, registerdata *rd)
Definition: schedule.c:98
minstruction * mi
Definition: schedule.h:73
s1 opnum
Definition: schedule.h:120
opcycles op[4]
Definition: schedule.h:103
edgenode ** fltregs_use_dep
Definition: schedule.h:82
edgenode ** fltregs_define_dep
Definition: schedule.h:78
edgenode ** memory_use_dep
Definition: schedule.h:83
s1 latency
Definition: schedule.h:122
void schedule_close(scheduledata *sd)
Definition: schedule.c:118
uint8_t u1
Definition: types.hpp:40
void schedule_add_define_dep(scheduledata *sd, s1 opnum, edgenode **define_dep, edgenode **use_dep)
Definition: schedule.c:138
edgenode ** memory_define_dep
Definition: schedule.h:79
void schedule_add_use_dep(scheduledata *sd, s1 opnum, edgenode **define_dep, edgenode **use_dep)
Definition: schedule.c:231
void schedule_calc_priority(minstruction *mi)
FILE * file
Definition: schedule.h:85
edgenode ** intregs_use_dep
Definition: schedule.h:81
s1 lastcycle
Definition: schedule.h:62
int32_t s4
Definition: types.hpp:45
edgenode * leaders
Definition: schedule.h:75
u4 instr[2]
Definition: schedule.h:97
edgenode ** intregs_define_dep
Definition: schedule.h:77
edgenode * next
Definition: schedule.h:123
uint32_t u4
Definition: types.hpp:46
s4 minum
Definition: schedule.h:119
void schedule_do_schedule(scheduledata *sd)
Definition: schedule.c:480
edgenode * deps
Definition: schedule.h:106
s1 firstcycle
Definition: schedule.h:61
minstruction * next
Definition: schedule.h:107
int8_t s1
Definition: types.hpp:39
scheduledata * schedule_init(methodinfo *m, registerdata *rd)
Definition: schedule.c:57
s1 opnum2
Definition: schedule.h:121