* src/vm/jit/emit-common.c (emit_beq, emit_bne, emit_blt, emit_bge)
authortwisti <none@none>
Tue, 28 Nov 2006 19:58:02 +0000 (19:58 +0000)
committertwisti <none@none>
Tue, 28 Nov 2006 19:58:02 +0000 (19:58 +0000)
(emit_bgt, emit_ble, emit_bnan): New functions.
* src/vm/jit/emit-common.h (emit_beq, emit_bne, emit_blt, emit_bge)
(emit_bgt, emit_ble, emit_bnan): Added.

* src/vm/jit/codegen-common.h (BRANCH_UNCONDITIONAL, BRANCH_EQ)
(BRANCH_NE, BRANCH_LT, BRANCH_GE, BRANCH_GT, BRANCH_LE, BRANCH_NAN):
Added.

src/vm/jit/codegen-common.h
src/vm/jit/emit-common.c
src/vm/jit/emit-common.h

index 8c793f136224787d69e1c8b7baae7400a0daac98..70fcd5fbad7cceb8e3be5cd51753e4f5004393bb 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Ullrich
             Edwin Steiner
 
-   $Id: codegen-common.h 6064 2006-11-27 15:23:55Z edwin $
+   $Id: codegen-common.h 6075 2006-11-28 19:58:02Z twisti $
 
 */
 
@@ -74,6 +74,20 @@ typedef struct codegen_critical_section_t codegen_critical_section_t;
 #define GET_HIGH_REG(a)    (((a) & 0xffff0000) >> 16)
 
 
+/* branch conditions **********************************************************/
+
+#define BRANCH_UNCONDITIONAL    -1
+
+#define BRANCH_EQ               (ICMD_IFEQ - ICMD_IFEQ)
+#define BRANCH_NE               (ICMD_IFNE - ICMD_IFEQ)
+#define BRANCH_LT               (ICMD_IFLT - ICMD_IFEQ)
+#define BRANCH_GE               (ICMD_IFGE - ICMD_IFEQ)
+#define BRANCH_GT               (ICMD_IFGT - ICMD_IFEQ)
+#define BRANCH_LE               (ICMD_IFLE - ICMD_IFEQ)
+
+#define BRANCH_NAN              256
+
+
 /************************* critical sections  *********************************/
 
 struct codegen_critical_section_t {
index 8bd270b0478e860f2781c479bbf970d4c08ad240..202118b5b5a087235b27f55d73fd85aaf7ad5b32 100644 (file)
@@ -246,6 +246,54 @@ void emit_store_dst(jitdata *jd, instruction *iptr, s4 d)
 }
 
 
+/* emit_bxx ********************************************************************
+
+   Wrappers for conditional branch instructions.
+
+*******************************************************************************/
+
+void emit_beq(codegendata *cd, basicblock *target)
+{
+       emit_bc(cd, target, BRANCH_EQ);
+}
+
+
+void emit_bne(codegendata *cd, basicblock *target)
+{
+       emit_bc(cd, target, BRANCH_NE);
+}
+
+
+void emit_blt(codegendata *cd, basicblock *target)
+{
+       emit_bc(cd, target, BRANCH_LT);
+}
+
+
+void emit_bge(codegendata *cd, basicblock *target)
+{
+       emit_bc(cd, target, BRANCH_GE);
+}
+
+
+void emit_bgt(codegendata *cd, basicblock *target)
+{
+       emit_bc(cd, target, BRANCH_GT);
+}
+
+
+void emit_ble(codegendata *cd, basicblock *target)
+{
+       emit_bc(cd, target, BRANCH_LE);
+}
+
+
+void emit_bnan(codegendata *cd, basicblock *target)
+{
+       emit_bc(cd, target, BRANCH_NAN);
+}
+
+
 /* emit_array_checks ***********************************************************
 
    Emit exception checks for array accesses, if they need to be
index a9a5b154c4a15086efd3cde387cba77a0e45b459..b4c71580f64e1448f23f260def02e67370805cd0 100644 (file)
@@ -89,6 +89,18 @@ void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst);
 void emit_iconst(codegendata *cd, s4 d, s4 value);
 void emit_lconst(codegendata *cd, s4 d, s8 value);
 
+void emit_br(codegendata *cd, basicblock *target);
+void emit_bc(codegendata *cd, basicblock *target, s4 condition);
+
+void emit_beq(codegendata *cd, basicblock *target);
+void emit_bne(codegendata *cd, basicblock *target);
+void emit_blt(codegendata *cd, basicblock *target);
+void emit_bge(codegendata *cd, basicblock *target);
+void emit_bgt(codegendata *cd, basicblock *target);
+void emit_ble(codegendata *cd, basicblock *target);
+
+void emit_bnan(codegendata *cd, basicblock *target);
+
 void emit_arithmetic_check(codegendata *cd, s4 reg);
 void emit_arrayindexoutofbounds_check(codegendata *cd, s4 s1, s4 s2);
 void emit_arraystore_check(codegendata *cd, s4 reg);