* src/vm/jit/alpha/emit.c [ENABLE_THREADS] (threads/native/lock.h):
[cacao.git] / src / vm / jit / jit.h
index 5a3f7973d6ccfc57172af08e9f2f7801bdf82632..7bc76e02e63dce97d5c7e12771e0274db9034a3f 100644 (file)
@@ -30,7 +30,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: jit.h 5208 2006-08-04 14:42:57Z twisti $
+   $Id: jit.h 5262 2006-08-22 19:53:56Z twisti $
 
 */
 
@@ -70,10 +70,15 @@ typedef struct insinfo_inline insinfo_inline;
 #if defined(ENABLE_LOOP)
 # include "vm/jit/loop/loop.h"
 #endif
+#if defined(ENABLE_SSA) 
+# include "vm/jit/optimizing/lsra.h"
+#endif
+#if defined(ENABLE_LSRA)
+# include "vm/jit/allocator/lsra.h"
+#endif
 
 #include "vm/jit/verify/typeinfo.h"
 
-
 /* common jit/codegen macros **************************************************/
 
 #if defined(ENABLE_STATISTICS)
@@ -95,9 +100,13 @@ struct jitdata {
 #if defined(ENABLE_LOOP)
        loopdata        *ld;
 #endif
+#if defined(ENABLE_SSA) || defined(ENABLE_LSRA)
+       lsradata     *ls;
+#endif
 
        u4               flags;             /* contains JIT compiler flags        */
        bool             isleafmethod;      /* does method call subroutines       */
+       s4               stackframesize;    /* size of the current stackframe     */
 
        new_instruction *new_instructions;
        basicblock      *new_basicblocks;
@@ -337,6 +346,15 @@ struct instruction {
 #define INSTRUCTION_IS_UNRESOLVED(iptr) \
        ((ptrint)(iptr)->target & 0x01) /* XXX target used temporarily as flag */
 
+#define NEW_INSTRUCTION_IS_RESOLVED(iptr) \
+       (!((iptr)->flags.bits & INS_FLAG_UNRESOLVED))
+
+#define NEW_INSTRUCTION_IS_UNRESOLVED(iptr) \
+       ((iptr)->flags.bits & INS_FLAG_UNRESOLVED)
+
+#define NEW_INSTRUCTION_MUST_CHECK(iptr) \
+       (!((iptr)->flags.bits & INS_FLAG_NOCHECK))
+
 #define NEW_INSTRUCTION_GET_FIELDREF(iptr,fref) \
        do { \
                if (iptr->flags.bits & INS_FLAG_UNRESOLVED) \
@@ -477,45 +495,45 @@ struct insinfo_inline {
 /* the others by using bitfields.                                             */
 
 struct basicblock {
-       s4           debug_nr;      /* basic block number                         */
-       s4           flags;         /* used during stack analysis, init with -1   */
-       s4           bitflags;      /* OR of BBFLAG_... constants, init with 0    */
-       s4           type;          /* basic block type (std, xhandler, subroutine*/
-       instruction *iinstr;        /* pointer to intermediate code instructions  */
-       s4           icount;        /* number of intermediate code instructions   */
-       s4           mpc;           /* machine code pc at start of block          */
-       stackptr     instack;       /* stack at begin of basic block              */
-       stackptr     outstack;      /* stack at end of basic block                */
-       s4           indepth;       /* stack depth at begin of basic block        */
-       s4           outdepth;      /* stack depth end of basic block             */
-
-       s4           predecessorcount;
-       s4           successorcount;
-       basicblock  *predecessors;  /* array of predecessor basic blocks          */
-       basicblock  *successors;    /* array of successor basic blocks            */
-
-       branchref   *branchrefs;    /* list of branches to be patched             */
-
-       basicblock  *next;          /* used to build a BB list (instead of array) */
-       s4           lflags;        /* used during loop copying, init with 0      */
-       basicblock  *copied_to;     /* points to the copy of this basic block     */
+       s4            nr;           /* basic block number                         */
+       s4            flags;        /* used during stack analysis, init with -1   */
+       s4            bitflags;     /* OR of BBFLAG_... constants, init with 0    */
+       s4            type;         /* basic block type (std, xhandler, subroutine*/
+       instruction  *iinstr;       /* pointer to intermediate code instructions  */
+       s4            icount;       /* number of intermediate code instructions   */
+       s4            mpc;          /* machine code pc at start of block          */
+       stackptr      instack;      /* stack at begin of basic block              */
+       stackptr      outstack;     /* stack at end of basic block                */
+       s4            indepth;      /* stack depth at begin of basic block        */
+       s4            outdepth;     /* stack depth end of basic block             */
+
+       s4            predecessorcount;
+       s4            successorcount;
+       basicblock  **predecessors; /* array of predecessor basic blocks          */
+       basicblock  **successors;   /* array of successor basic blocks            */
+
+       branchref    *branchrefs;   /* list of branches to be patched             */
+
+       basicblock   *next;         /* used to build a BB list (instead of array) */
+       s4            lflags;       /* used during loop copying, init with 0      */
+       basicblock   *copied_to;    /* points to the copy of this basic block     */
                                 /* when loop nodes are copied                 */
-       stackptr     stack;         /* start of stack array for this block        */
+       stackptr      stack;        /* start of stack array for this block        */
                                    /* (see doc/stack.txt)                        */
-       methodinfo  *method;        /* method this block belongs to               */
+       methodinfo   *method;       /* method this block belongs to               */
 };
 
 
 /* Macro for initializing newly allocated basic block's. It does not
    need to zero fields, as we zero out the whole basic block array. */
 
-#define BASICBLOCK_INIT(bptr,m)                            \
-       do {                                                   \
-               bptr->mpc        = -1;                             \
-               bptr->flags      = -1;                             \
-               bptr->type       = BBTYPE_STD;                     \
-               bptr->method     = (m);                            \
-               bptr->debug_nr   = (m)->c_debug_nr++;              \
+#define BASICBLOCK_INIT(bptr,m)                        \
+       do {                                               \
+               bptr->mpc    = -1;                             \
+               bptr->flags  = -1;                             \
+               bptr->type   = BBTYPE_STD;                     \
+               bptr->method = (m);                            \
+               bptr->nr     = (m)->c_debug_nr++;              \
        } while (0)
                        
 
@@ -1201,7 +1219,14 @@ extern int jcommandsize[256];
 /***************************** register info block ****************************/
 
 extern int stackreq[256];
-
+/* extern int op_needs_saved[256];  */
+/* extern int op_is_pei[256];       */
+#define NEEDS_SAVED  0
+#define PEI          1
+#define OP_DATA_SIZE 2
+extern int op_data[256][OP_DATA_SIZE]; 
+/* [0..255][NEEDS_SAVED] ... if ICMD needs a SAVEDVAR         */
+/* [0..255][PEI]         ... if ICMD could throw an exception */
 
 /* function prototypes ********************************************************/
 
@@ -1218,6 +1243,8 @@ u1 *jit_recompile(methodinfo *m);
 /* patch the method entrypoint */
 u1 *jit_asm_compile(methodinfo *m, u1 *mptr, u1 *sp, u1 *ra);
 
+s4 jit_complement_condition(s4 opcode);
+
 /* machine dependent functions */
 #if defined(ENABLE_JIT)
 void md_init(void);