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 1597 2004-11-28 16:37:23Z christian $
38 #include "loop/loop.h"
45 int i_start; /* instruction number of first use */
46 int i_end; /* instruction number of last use */
47 int v_index; /* local variable index or negative for stackslots */
49 int usagecount; /* number of references*/
50 int reg; /* regoffset durch lsra zugewiesen */
52 struct stackslot *passthrough; /* List of Stackslots in Lifetime, which are passed through a Basic Block */
53 struct stackslot *local_ss; /* Stackslots for this Lifetime or NULL (=="pure" Local Var) */
54 struct _i_list *i_list; /* list of instructions with references to var */
55 struct lifetime *next;
60 struct active_lt *next;
84 struct stackslot *next;
93 struct lifetime **ss_lifetimes;
94 struct lifetime **locals_lifetimes;
95 struct lifetime *lifetimes;
96 struct stackslot *stackslots;
97 struct active_lt *active_tmp, *active_sav;
98 int active_sav_count, active_tmp_count;
100 bool back_edge_panic;
106 struct freemem *next;
110 struct stackslot *ss;
114 typedef struct lsradata lsradata;
116 /* function prototypes */
117 void lsra(methodinfo *, codegendata *, registerdata *, loopdata *, t_inlining_globals *);
118 void lsra_init(methodinfo *, codegendata *, t_inlining_globals *, lsradata *);
119 void lsra_setup(methodinfo *, codegendata *, registerdata *, lsradata *, loopdata *);
120 void lsra_clean_Graph( methodinfo *, codegendata *, lsradata *, loopdata *);
123 void lsra_dump_Graph(methodinfo *, struct depthElement **);
124 void lsra_dump_stack(stackptr );
126 #ifdef LSRA_PRINTLIFETIMES
127 void print_lifetimes(registerdata *, struct lifetime *);
130 int lsra_get_sbr_end(methodinfo *, loopdata *, int , int *);
131 void lsra_scan_registers_canditates(methodinfo *, lsradata *);
132 void lsra_join_lifetimes( methodinfo *, codegendata *, lsradata *, loopdata *);
133 int lsra_getmaxblock(methodinfo *, loopdata *, int );
134 void lsra_calc_lifetime_length(methodinfo *, lsradata *, codegendata *, loopdata *);
136 void lsra_merge_i_lists(struct lifetime *, struct lifetime *);
137 void lsra_merge_local_ss(struct lifetime *, struct lifetime *);
139 void _lsra_new_stack( lsradata *, stackptr , int , int, int);
140 void _lsra_from_stack(lsradata *, stackptr , int , int, int);
141 void lsra_add_ss(struct lifetime *, stackptr );
142 void lsra_usage_local(lsradata *, s4 , int , int , int , int );
143 void lsra_new_local(lsradata *, s4 , int );
144 struct _i_list *lsra_add_i_list(struct _i_list *, int, int ,int );
146 void lsra_sort_lt(struct lifetime **);
147 void lsra_main(methodinfo *, lsradata *, registerdata *);
148 void _lsra_main( methodinfo *, lsradata *, struct lifetime *, struct lsra_reg *, int , int , int *, int *);
149 void lsra_expire_old_intervalls(lsradata *, struct lifetime *, struct lsra_reg *);
150 void _lsra_expire_old_intervalls(struct lifetime *, struct lsra_reg *, struct active_lt **, int *);
151 void spill_at_intervall(lsradata *, struct lifetime *);
152 void _spill_at_intervall(struct lifetime *, struct active_lt **, int *);
153 void lsra_add_active(struct lifetime *, struct active_lt **, int *);
154 void lsra_alloc(methodinfo *, registerdata *, struct lifetime *, int *);
155 int lsra_getmem(struct lifetime *, struct freemem *, int *);
156 struct freemem *lsra_getnewmem(int *);
157 void lsra_align_stackslots(struct lsradata *, stackptr, stackptr);
158 void lsra_setflags(int *, int);
163 * These are local overrides for various environment variables in Emacs.
164 * Please do not remove this and leave it at the end of the file, where
165 * Emacs will automagically detect them.
166 * ---------------------------------------------------------------------
169 * indent-tabs-mode: t