* src/vm/jit/i386/codegen.h (vm/jit/i386/emit.h): Added.
[cacao.git] / src / vm / jit / reg.c
index 6489e4ffc19248315e5a55ac3a8c31328807815b..4673c5ab373958692f1ee22f22f2bdb8e211bd5b 100644 (file)
@@ -1,9 +1,9 @@
 /* src/vm/jit/reg.c - register allocator setup
 
-   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
+   Copyright (C) 1996-2005, 2006 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.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Andreas Krall
 
    Changes: Stefan Ring
             Christian Thalinger
-                       Christian Ullrich
+            Christian Ullrich
             Michael Starzinger
+            Edwin Steiner
 
-   $Id: reg.c 4057 2006-01-02 14:05:00Z twisti $
+   $Id: reg.c 5435 2006-09-08 18:14:50Z edwin $
 
 */
 
@@ -46,6 +47,7 @@
 #include "md-abi.h"
 
 #include "mm/memory.h"
+#include "vm/jit/abi.h"
 #include "vm/jit/reg.h"
 
 
 
 *******************************************************************************/
 
-void reg_setup(methodinfo *m, registerdata *rd, t_inlining_globals *id)
+void reg_setup(jitdata *jd)
 {
-       s4 i;
-       varinfo5 *v;
-       
+       methodinfo   *m;
+       registerdata *rd;
+       s4            i;
+
+       /* get required compiler data */
+
+       m  = jd->m;
+       rd = jd->rd;
+
        /* setup the integer register table */
 
 #if defined(__ARM__)
@@ -185,46 +193,24 @@ void reg_setup(methodinfo *m, registerdata *rd, t_inlining_globals *id)
        assert(rd->argfltreguse == FLT_ARG_CNT);
 
 
-       rd->freemem    = DMNEW(s4, id->cummaxstack);
+       rd->freemem    = DMNEW(s4, m->maxstack);
 #if defined(HAS_4BYTE_STACKSLOT)
-       rd->freemem_2  = DMNEW(s4, id->cummaxstack);
+       rd->freemem_2  = DMNEW(s4, m->maxstack);
 #endif
-       rd->locals     = DMNEW(varinfo5, id->cumlocals);
-       rd->interfaces = DMNEW(varinfo5, id->cummaxstack);
-       for (v = rd->locals, i = id->cumlocals; i > 0; v++, i--) {
-               v[0][TYPE_INT].type = -1;
-               v[0][TYPE_LNG].type = -1;
-               v[0][TYPE_FLT].type = -1;
-               v[0][TYPE_DBL].type = -1;
-               v[0][TYPE_ADR].type = -1;
-       }
-
-       for (v = rd->interfaces, i = id->cummaxstack; i > 0; v++, i--) {
-               v[0][TYPE_INT].type = -1;
-               v[0][TYPE_INT].flags = 0;
-               v[0][TYPE_LNG].type = -1;
-               v[0][TYPE_LNG].flags = 0;
-               v[0][TYPE_FLT].type = -1;
-               v[0][TYPE_FLT].flags = 0;
-               v[0][TYPE_DBL].type = -1;
-               v[0][TYPE_DBL].flags = 0;
-               v[0][TYPE_ADR].type = -1;
-               v[0][TYPE_ADR].flags = 0;
-       }
 
 #if defined(SPECIALMEMUSE)
 # if defined(__DARWIN__)
        /* 6*4=24 byte linkage area + 8*4=32 byte minimum parameter Area */
-       rd->memuse = LA_WORD_SIZE + INT_ARG_CNT; 
+       rd->memuse = LA_SIZE_IN_POINTERS + INT_ARG_CNT; 
 # else
-       rd->memuse = LA_WORD_SIZE;
+       rd->memuse = LA_SIZE_IN_POINTERS;
 # endif
 #else
        rd->memuse = 0; /* init to zero -> analyse_stack will set it to a higher  */
                        /* value, if appropriate */
 #endif
 
-       /* Set rd->argxxxreguse to XXX_ARG_CNBT to not use unused argument        */
+       /* Set rd->arg*reguse to *_ARG_CNBT to not use unused argument            */
        /* registers as temp registers  */
 #if defined(HAS_ADDRESS_REGISTER_FILE)
        rd->argadrreguse = 0;
@@ -245,4 +231,5 @@ void reg_setup(methodinfo *m, registerdata *rd, t_inlining_globals *id)
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */