MIPS repair work
[cacao.git] / src / vm / jit / mips / codegen.h
index 74a8cfe72dbd9ed91cf621a1ecbdd6b03a409892..91024c9404bc2601873472c700699c9effa09f8e 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/mips/codegen.h - code generation macros and definitions for MIPS
 
-   Copyright (C) 1996-2005, 2006, 2007 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, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
@@ -22,8 +20,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.h 7601 2007-03-28 23:02:50Z michi $
-
 */
 
 
@@ -33,7 +29,7 @@
 #include "config.h"
 #include "vm/types.h"
 
-#include "vm/jit/jit.h"
+#include "vm/jit/jit.hpp"
 
 
 /* additional functions and macros to generate code ***************************/
         M_NOP; \
     }
 
-#define M_INTMOVE(a,b) \
-    do { \
-        if ((a) != (b)) \
-            M_MOV(a, b); \
-    } while (0)
-
-#if SIZEOF_VOID_P == 8
-
-#define M_LNGMOVE(a,b)    M_INTMOVE(a,b)
-
-#else /* SIZEOF_VOID_P == 8 */
-
-#define M_LNGMOVE(a,b) \
-    do { \
-        if (GET_LOW_REG(b) == GET_HIGH_REG(a)) { \
-            assert(GET_HIGH_REG(b) == GET_LOW_REG(a)); \
-            M_INTMOVE(GET_HIGH_REG(a), GET_HIGH_REG(b)); \
-            M_INTMOVE(GET_LOW_REG(a), GET_LOW_REG(b)); \
-        } else { \
-            M_INTMOVE(GET_LOW_REG(a), GET_LOW_REG(b)); \
-            M_INTMOVE(GET_HIGH_REG(a), GET_HIGH_REG(b)); \
-        } \
-    } while (0)
-
-#endif /* SIZEOF_VOID_P == 8 */
-
-#define M_FLTMOVE(a,b) \
-    do { \
-        if ((a) != (b)) \
-            M_FMOV(a, b); \
-    } while (0)
-
-#define M_DBLMOVE(a,b) \
-    do { \
-        if ((a) != (b)) \
-            M_DMOV(a, b); \
-    } while (0)
-
 #define ICONST(r,c)                     emit_iconst(cd, (r), (c))
 #define LCONST(r,c)                     emit_lconst(cd, (r), (c))
 
 
 #define BRANCH_NOPS \
     do { \
-        M_NOP; \
-        M_NOP; \
+        if (CODEGENDATA_HAS_FLAG_LONGBRANCHES(cd)) { \
+            M_NOP; \
+            M_NOP; \
+            M_NOP; \
+            M_NOP; \
+            M_NOP; \
+            M_NOP; \
+        } \
+        else { \
+            M_NOP; \
+            M_NOP; \
+        } \
     } while (0)
 
 
 /* patcher defines ************************************************************/
 
-#define PATCHER_CALL_INSTRUCTIONS    5     /* number of instructions          */
-#define PATCHER_CALL_SIZE            5 * 4 /* size in bytes of a patcher call */
+#define PATCHER_CALL_INSTRUCTIONS    1     /* number of instructions          */
+#define PATCHER_CALL_SIZE            1 * 4 /* size in bytes of a patcher call */
 
 #define PATCHER_NOPS \
     do { \
         M_NOP; \
-        M_NOP; \
-        M_NOP; \
-        M_NOP; \
-        M_NOP; \
     } while (0)
 
 
 
 /* macros for all used commands (see a MIPS-manual for description) ***********/
 
+#define M_RESERVED              M_RTYPE(0x3b, 0, 0, 0, 0, 0)
+
 /* load/store macros use the form OPERATION(source/dest, base, offset)        */
 
 #define M_LDA(a,b,disp) \
 
 #define M_ALD_INTERN(a,b,disp)  M_LLD_INTERN(a,b,disp)
 #define M_ALD(a,b,disp)         M_LLD(a,b,disp)
+#define M_ALD_DSEG(a,disp)      M_LLD(a,REG_PV,disp)
 #define M_AST_INTERN(a,b,disp)  M_LST_INTERN(a,b,disp)
 #define M_AST(a,b,disp)         M_LST(a,b,disp)
 #define M_AADD(a,b,c)           M_LADD(a,b,c)
 
 #define M_ALD_INTERN(a,b,disp)  M_ILD_INTERN(a,b,disp)
 #define M_ALD(a,b,disp)         M_ILD(a,b,disp)
+#define M_ALD_DSEG(a,disp)      M_ILD(a,REG_PV,disp)
 #define M_AST_INTERN(a,b,disp)  M_IST_INTERN(a,b,disp)
 #define M_AST(a,b,disp)         M_IST(a,b,disp)
 #define M_AADD(a,b,c)           M_IADD(a,b,c)