1 /* jit/lsra.inc - linear scan register allocator header
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Christian Ullrich
29 $Id: lsra.h 1735 2004-12-07 14:33:27Z twisti $
37 #include "loop/loop.h"
44 int i_start; /* instruction number of first use */
45 int i_end; /* instruction number of last use */
46 int v_index; /* local variable index or negative for stackslots */
48 int usagecount; /* number of references*/
49 int reg; /* regoffset durch lsra zugewiesen */
51 struct stackslot *passthrough; /* List of Stackslots in Lifetime, which are passed through a Basic Block */
52 struct stackslot *local_ss; /* Stackslots for this Lifetime or NULL (=="pure" Local Var) */
53 struct _i_list *i_list; /* list of instructions with references to var */
54 struct lifetime *next;
59 struct active_lt *next;
83 struct stackslot *next;
92 struct lifetime **ss_lifetimes;
93 struct lifetime **locals_lifetimes;
94 struct lifetime *lifetimes;
95 struct stackslot *stackslots;
96 struct active_lt *active_tmp, *active_sav;
97 int active_sav_count, active_tmp_count;
105 struct freemem *next;
109 struct stackslot *ss;
113 typedef struct lsradata lsradata;
115 /* function prototypes */
116 void lsra(methodinfo *, codegendata *, registerdata *, loopdata *, t_inlining_globals *);
117 void lsra_init(methodinfo *, codegendata *, t_inlining_globals *, lsradata *);
118 void lsra_setup(methodinfo *, codegendata *, registerdata *, lsradata *, loopdata *);
119 void lsra_clean_Graph( methodinfo *, codegendata *, lsradata *, loopdata *);
122 void lsra_dump_Graph(methodinfo *, struct depthElement **);
123 void lsra_dump_stack(stackptr );
125 #ifdef LSRA_PRINTLIFETIMES
126 void print_lifetimes(registerdata *, struct lifetime *);
129 int lsra_get_sbr_end(methodinfo *, loopdata *, int , int *);
130 void lsra_scan_registers_canditates(methodinfo *, lsradata *);
131 void lsra_join_lifetimes( methodinfo *, codegendata *, lsradata *, loopdata *);
132 int lsra_getmaxblock(methodinfo *, loopdata *, int );
133 void lsra_calc_lifetime_length(methodinfo *, lsradata *, codegendata *, loopdata *);
135 void lsra_merge_i_lists(struct lifetime *, struct lifetime *);
136 void lsra_merge_local_ss(struct lifetime *, struct lifetime *);
138 void _lsra_new_stack( lsradata *, stackptr , int , int, int);
139 void _lsra_from_stack(lsradata *, stackptr , int , int, int);
140 void lsra_add_ss(struct lifetime *, stackptr );
141 void lsra_usage_local(lsradata *, s4 , int , int , int , int );
142 void lsra_new_local(lsradata *, s4 , int );
143 struct _i_list *lsra_add_i_list(struct _i_list *, int, int ,int );
145 void lsra_sort_lt(struct lifetime **);
146 void lsra_main(methodinfo *, lsradata *, registerdata *);
147 void _lsra_main( methodinfo *, lsradata *, struct lifetime *, struct lsra_reg *, int , int , int *, int *);
148 void lsra_expire_old_intervalls(lsradata *, struct lifetime *, struct lsra_reg *);
149 void _lsra_expire_old_intervalls(struct lifetime *, struct lsra_reg *, struct active_lt **, int *);
150 void spill_at_intervall(lsradata *, struct lifetime *);
151 void _spill_at_intervall(struct lifetime *, struct active_lt **, int *);
152 void lsra_add_active(struct lifetime *, struct active_lt **, int *);
153 void lsra_alloc(methodinfo *, registerdata *, struct lifetime *, int *);
154 int lsra_getmem(struct lifetime *, struct freemem *, int *);
155 struct freemem *lsra_getnewmem(int *);
156 void lsra_align_stackslots(struct lsradata *, stackptr, stackptr);
157 void lsra_setflags(int *, int);
162 * These are local overrides for various environment variables in Emacs.
163 * Please do not remove this and leave it at the end of the file, where
164 * Emacs will automagically detect them.
165 * ---------------------------------------------------------------------
168 * indent-tabs-mode: t