Friday save.
[cacao.git] / src / vm / jit / schedule / schedule.h
1 /* src/vm/jit/schedule/schedule.h - architecture independent instruction
2                                     scheduler
3
4    Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
5    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
6    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
7    Institut f. Computersprachen - TU Wien
8
9    This file is part of CACAO.
10
11    This program is free software; you can redistribute it and/or
12    modify it under the terms of the GNU General Public License as
13    published by the Free Software Foundation; either version 2, or (at
14    your option) any later version.
15
16    This program is distributed in the hope that it will be useful, but
17    WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    General Public License for more details.
20
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24    02111-1307, USA.
25
26    Contact: cacao@complang.tuwien.ac.at
27
28    Authors: Christian Thalinger
29
30    Changes:
31
32    $Id: schedule.h 1985 2005-03-04 17:09:13Z twisti $
33
34 */
35
36
37 #ifndef _SCHEDULE_H
38 #define _SCHEDULE_H
39
40 #include "arch.h"
41 #include "types.h"
42 #include "vm/jit/reg.h"
43
44
45 typedef struct scheduledata scheduledata;
46 typedef struct minstruction minstruction;
47 typedef struct nodelink nodelink;
48
49
50 /* machine instruction flags **************************************************/
51
52 #define SCHEDULE_LEADER    0x01
53
54
55 /* scheduledata ****************************************************************
56
57    XXX
58
59 *******************************************************************************/
60
61 struct scheduledata {
62         minstruction  *mi;                  /* machine instruction array          */
63         s4             micount;             /* number of machine instructions     */
64         nodelink      *leaders;             /* list containing sink nodes         */
65
66         s4            *intregs_define_dep;
67         s4            *fltregs_define_dep;
68     s4            *memory_define_dep;
69
70         nodelink     **intregs_use_dep;
71         nodelink     **fltregs_use_dep;
72         nodelink     **memory_use_dep;
73 };
74
75
76 /* minstruction ****************************************************************
77
78    This structure contains all information for one machine instruction
79    required to schedule it.
80
81 *******************************************************************************/
82
83 struct minstruction {
84         u4             instr[2];            /* machine instruction word           */
85         u1             flags;
86         u1             startcycle;          /* start pipeline cycle               */
87         u1             endcycle;            /* end pipeline cycle                 */
88         s4             priority;            /* priority of this instruction node  */
89         nodelink      *deps;                /* operand dependencies               */
90         minstruction  *next;                /* link to next machine instruction   */
91 };
92
93
94 /* nodelink ********************************************************************
95
96    XXX
97
98 *******************************************************************************/
99
100 struct nodelink {
101         s4        minode;                   /* pointer to machine instruction     */
102         nodelink *next;                     /* link to next node                  */
103 };
104
105
106 /* function prototypes ********************************************************/
107
108 scheduledata *schedule_init(registerdata *rd);
109 void schedule_setup(scheduledata *sd, registerdata *rd);
110
111 void schedule_calc_priority(minstruction *mi);
112
113 void schedule_add_define_dep(scheduledata *sd, s4 *define_dep, nodelink **use_dep);
114 void schedule_add_use_dep(scheduledata *sd, s4 *define_dep, nodelink **use_dep);
115
116 void schedule_add_memory_define_dep(scheduledata *sd);
117 void schedule_add_memory_use_dep(scheduledata *sd);
118
119 void schedule_do_schedule(scheduledata *sd);
120
121 #endif /* _SCHEDULE_H */
122
123
124 /*
125  * These are local overrides for various environment variables in Emacs.
126  * Please do not remove this and leave it at the end of the file, where
127  * Emacs will automagically detect them.
128  * ---------------------------------------------------------------------
129  * Local variables:
130  * mode: c
131  * indent-tabs-mode: t
132  * c-basic-offset: 4
133  * tab-width: 4
134  * End:
135  */