1 /* jit/lsra.inc - linear scan register allocator header
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
4 Institut f. Computersprachen, TU Wien
5 R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
6 S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
7 J. Wenninger, C. Ullrich
9 This file is part of CACAO.
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.
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.
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
26 Contact: cacao@complang.tuwien.ac.at
28 Authors: Christian Ullrich
30 $Id: lsra.h 1590 2004-11-25 13:24:49Z christian $
38 #include "loop/loop.h"
45 int index; /* unique index, LOCALVAR varnum or negative*/
46 int b_start; /* bb of first use */
47 int b_end; /* bb of last use */
48 int i_start; /* instruction number of first use */
49 int i_end; /* instruction number of last use */
50 int length; /* lifetime in instructions */
51 stackptr s; /* stackslot or NULL */
52 int v_index; /* local variable index or -1 */
54 int usagecount; /* number of refernces*/
55 int reg; /* regoffset durch lsra zugewiesen */
57 struct stackslot *passthrough; /* List of Stackslots in Lifetime, which are passed through a Basic Block */
58 struct stackslot *local_ss;
59 struct _i_list *i_list; /* list of instructions with references to var */
60 struct lifetime *next;
63 /* struct int_list { */
70 struct active_lt *next;
94 struct stackslot *next;
103 struct lifetime **ss_lifetimes;
104 struct lifetime **locals_lifetimes;
105 struct lifetime *lifetimes;
106 struct stackslot *stackslots;
107 struct active_lt *active_tmp, *active_sav;
108 int active_sav_count, active_tmp_count;
110 bool back_edge_panic;
116 struct freemem *next;
125 typedef struct lsradata lsradata;
127 /* function prototypes */
128 void lsra(methodinfo *, codegendata *, registerdata *, loopdata *, t_inlining_globals *);
129 void lsra_init(methodinfo *, codegendata *, t_inlining_globals *, lsradata *);
130 void lsra_setup(methodinfo *, codegendata *, registerdata *, lsradata *, loopdata *);
131 void lsra_clean_Graph( methodinfo *, codegendata *, lsradata *, loopdata *);
134 void lsra_dump_Graph(methodinfo *, struct depthElement **);
135 void lsra_dump_stack(stackptr );
136 void print_lifetimes(registerdata *, struct lifetime *);
139 int lsra_get_sbr_end(methodinfo *, loopdata *, int , int *);
140 void lsra_scan_registers_canditates(methodinfo *, lsradata *);
141 void lsra_join_lifetimes( methodinfo *, codegendata *, lsradata *, loopdata *);
142 int lsra_getmaxblock(methodinfo *, loopdata *, int );
143 void lsra_calc_lifetime_length(methodinfo *, lsradata *, codegendata *, loopdata *);
145 void lsra_merge_i_lists(struct lifetime *, struct lifetime *);
147 void _lsra_new_stack( lsradata *, stackptr , int , int , int);
148 void _lsra_from_stack(lsradata *, stackptr , int , int, int);
149 void lsra_add_ss(struct lifetime *, stackptr );
150 void lsra_usage_local(lsradata *, s4 , int , int , int , int );
151 void lsra_new_local(lsradata *, s4 , int );
152 struct _i_list *lsra_add_i_list(struct _i_list *, int, int ,int );
154 void lsra_sort_lt(struct lifetime **);
155 void lsra_main(methodinfo *, lsradata *, registerdata *);
156 void _lsra_main( methodinfo *, lsradata *, struct lifetime *, struct lsra_reg *, int , int , int *, int *);
157 void lsra_expire_old_intervalls(lsradata *, struct lifetime *, struct lsra_reg *);
158 void _lsra_expire_old_intervalls(struct lifetime *, struct lsra_reg *, struct active_lt **, int *);
159 void spill_at_intervall(lsradata *, struct lifetime *);
160 void _spill_at_intervall(struct lifetime *, struct active_lt **, int *);
161 void lsra_add_active(struct lifetime *, struct active_lt **, int *);
162 void lsra_alloc(methodinfo *, registerdata *, struct lifetime *, int *);
163 int lsra_getmem(struct lifetime *, struct freemem *, int *);
164 struct freemem *lsra_getnewmem(int *);
165 void lsra_align_stackslots(struct lsradata *, stackptr, stackptr);
166 void lsra_setflags(int *, int);
171 * These are local overrides for various environment variables in Emacs.
172 * Please do not remove this and leave it at the end of the file, where
173 * Emacs will automagically detect them.
174 * ---------------------------------------------------------------------
177 * indent-tabs-mode: t