Changed some includes.
[cacao.git] / src / vm / jit / lsra.h
index 7b61df6a7ed7add32cad37167f6cdf681af0c52d..06a14a1dcf990502f62f4e49a827f4840d4d70d0 100644 (file)
@@ -1,10 +1,9 @@
-/* jit/lsra.inc - linear scan register allocator header
+/* src/vm/jit/lsra.h - linear scan register allocator header
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-   Institut f. Computersprachen, TU Wien
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
-   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
-   J. Wenninger, C. Ullrich
+   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+   Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
@@ -27,7 +26,7 @@
 
    Authors: Christian Ullrich
 
-   $Id: lsra.h 1981 2005-03-04 15:49:41Z christian $
+   $Id: lsra.h 2030 2005-03-10 16:17:50Z christian $
 
 */
 
 #ifndef _LSRA_H
 #define _LSRA_H
 
-#include "vm/jit/loop/loop.h"
-
-/* #define LSRA_DEBUG */
+/*   #define LSRA_DEBUG */
 /* #define LSRA_SAVEDVAR */
 /* #define LSRA_MEMORY */
 /* #define LSRA_PRINTLIFETIMES */
 /* #define LSRA_EDX */
-/* #define LSRA_TESTLT */ /* not to be used with register allocation - only INMEMORY */
 
 
 #ifdef LSRA_DEBUG
 #define min(a,b) ((a)<(b)?(a):(b))
 #define max(a,b) ((a)<(b)?(b):(a))
 
+#if defined(LSRA_EDX)
+struct tmp_reg {
+       int eax;
+       int ecx;
+       int edx;
+};
+
+extern struct tmp_reg icmd_uses_tmp[256];
+#endif
+
 struct _list {
        int value;
        struct _list *next;
@@ -77,7 +83,6 @@ struct lifetime {
        int savedvar;
        struct stackslot *passthrough; /* List of Stackslots in Lifetime, which are passed through a Basic Block */
        struct stackslot *local_ss; /* Stackslots for this Lifetime or NULL (=="pure" Local Var) */
-       struct _i_list *i_list; /* list of instructions with references to var */
 
        int bb_last_use;
        int i_last_use;
@@ -102,12 +107,6 @@ struct b_loop {
        int instr;
 };
 
-struct _i_list {
-       int b_index;
-       int instr;
-       int store;
-       struct _i_list *next;
-};
 
 struct stackslot {
        stackptr s;
@@ -115,12 +114,23 @@ struct stackslot {
        struct stackslot *next;
 };
 
+struct lsra_register {
+       int *sav_reg;
+       int *tmp_reg;
+       int *nregdesc;
+       int sav_top;
+       int tmp_top;
+};
+
 struct lsra_reg {
        int reg_index;
        int use;
 };
 
 struct lsradata {
+#if defined(LSRA_EDX)
+       int edx_free;
+#endif
        struct _list **succ;
        struct _list **pred;
        int *num_pred;
@@ -147,17 +157,6 @@ struct freemem {
        struct freemem *next;
 };
 
-struct dup {
-       struct stackslot *ss;
-       struct dup *next;
-};
-
-struct tmp_reg {
-       int eax;
-       int ecx;
-       int edx;
-};
-
 struct lsra_exceptiontable {
        int handler_min;
        int handler_max;
@@ -182,18 +181,15 @@ void lsra_dump_stack(stackptr );
 void print_lifetimes(registerdata *, lsradata *, struct lifetime *);
 #endif
 
-int lsra_get_sbr_end(methodinfo *, int , int *);
-void lsra_mark_blocks(methodinfo *,struct depthElement **, int *, int , int *);
-int lsra_get_exmaxblock(methodinfo *, int );
-void lsra_setup_exceptiontable( methodinfo *, codegendata *, lsradata *);
-void _df( struct depthElement **, int , bool *, int *, bool *, int *);
+
+void lsra_reg_setup(methodinfo *m ,registerdata *,struct lsra_register *,struct lsra_register * );
+
 
 void lsra_scan_registers_canditates(methodinfo *,  lsradata *, int);
 
 void lsra_join_lifetimes( methodinfo *, lsradata *, int);
 void lsra_calc_lifetime_length(methodinfo *, lsradata *, codegendata *);
 
-void lsra_merge_i_lists(struct lifetime *, struct lifetime *);
 void lsra_merge_local_ss(struct lifetime *, struct lifetime *);
 
 void _lsra_new_stack( lsradata *, stackptr , int , int, int);
@@ -201,26 +197,20 @@ void _lsra_from_stack(lsradata *, stackptr , int , int, int);
 void lsra_add_ss(struct lifetime *, stackptr );
 void lsra_usage_local(lsradata *, s4 , int , int , int , int );
 void lsra_new_local(lsradata *, s4 , int );
-struct _i_list *lsra_add_i_list(struct _i_list *, int, int ,int );
 
 void lsra_sort_lt(struct lifetime **);
-void _lsra_main( methodinfo *, lsradata *, struct lifetime *, struct lsra_reg *, int , int , int *, int *);
-void lsra_expire_old_intervalls(lsradata *, struct lifetime *, struct lsra_reg *);
-void _lsra_expire_old_intervalls(struct lifetime *, struct lsra_reg *, struct active_lt **, int *);
-void spill_at_intervall(lsradata *, struct lifetime *);
-void _spill_at_intervall(struct lifetime *, struct active_lt **, int *);
-void lsra_add_active(struct lifetime *, struct active_lt **, int *);
+void _lsra_main( methodinfo *, lsradata *, struct lifetime *, struct lsra_register *, int *);
+void lsra_expire_old_intervalls(methodinfo *, lsradata *, struct lifetime *, struct lsra_register *);
+void _lsra_expire_old_intervalls(methodinfo *, struct lifetime *, struct lsra_register *, struct active_lt **/* , int * */);
+void spill_at_intervall(methodinfo *, lsradata *, struct lifetime *);
+void _spill_at_intervall(struct lifetime *, struct active_lt **);
+void lsra_add_active(struct lifetime *, struct active_lt **);
 void lsra_alloc(methodinfo *, registerdata *, struct lifetime *, int *);
 int lsra_getmem(struct lifetime *, struct freemem *, int *);
 struct freemem *lsra_getnewmem(int *);
 void lsra_align_stackslots(struct lsradata *, stackptr, stackptr);
 void lsra_setflags(int *, int);
 
-#ifdef LSRA_TESTLT
-void test_lifetimes( methodinfo *m, lsradata *ls, struct lifetime *lifet, codegendata *cd);
-int _test_lifetimes(methodinfo *m, lsradata *ls, int b_index, int *values, bool* bb_visited, struct lifetime *lifet);
-#endif
-
 #endif /* _LSRA_H */