Commit 8a56e840 authored by Richard Henderson's avatar Richard Henderson Committed by Aurelien Jarno
Browse files

tcg: Use TCGCond where appropriate.



Use the TCGCond enumeration type in the brcond and setcond
related prototypes in tcg-op.h and each code generator.

Signed-off-by: default avatarRichard Henderson <rth@twiddle.net>
Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
parent a9751609
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ static void tcg_out_cmp(TCGContext *s, TCGArg arg1, TCGArg arg2,
    }
}

static void tcg_out_brcond(TCGContext *s, int cond,
static void tcg_out_brcond(TCGContext *s, TCGCond cond,
                           TCGArg arg1, TCGArg arg2, int const_arg2,
                           int label_index, int small)
{
@@ -466,7 +466,7 @@ static void tcg_out_brcond2(TCGContext *s, const TCGArg *args,
    tcg_out_label(s, label_next, (tcg_target_long)s->code_ptr);
}

static void tcg_out_setcond(TCGContext *s, int cond, TCGArg dest,
static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGArg dest,
                            TCGArg arg1, TCGArg arg2, int const_arg2)
{
    tcg_out_cmp(s, arg1, arg2, const_arg2);
+4 −4
Original line number Diff line number Diff line
@@ -464,7 +464,7 @@ static inline void tcg_out_addi(TCGContext *s, int reg, tcg_target_long val)
    }
}

static void tcg_out_brcond(TCGContext *s, int cond, int arg1,
static void tcg_out_brcond(TCGContext *s, TCGCond cond, int arg1,
                           int arg2, int label_index)
{
    TCGLabel *l = &s->labels[label_index];
@@ -522,7 +522,7 @@ static void tcg_out_brcond(TCGContext *s, int cond, int arg1,

/* XXX: we implement it at the target level to avoid having to
   handle cross basic blocks temporaries */
static void tcg_out_brcond2(TCGContext *s, int cond, int arg1,
static void tcg_out_brcond2(TCGContext *s, TCGCond cond, int arg1,
                            int arg2, int arg3, int arg4, int label_index)
{
    void *label_ptr;
@@ -585,7 +585,7 @@ static void tcg_out_brcond2(TCGContext *s, int cond, int arg1,
    reloc_pc16(label_ptr, (tcg_target_long) s->code_ptr);
}

static void tcg_out_setcond(TCGContext *s, int cond, int ret,
static void tcg_out_setcond(TCGContext *s, TCGCond cond, int ret,
                            int arg1, int arg2)
{
    switch (cond) {
@@ -645,7 +645,7 @@ static void tcg_out_setcond(TCGContext *s, int cond, int ret,

/* XXX: we implement it at the target level to avoid having to
   handle cross basic blocks temporaries */
static void tcg_out_setcond2(TCGContext *s, int cond, int ret,
static void tcg_out_setcond2(TCGContext *s, TCGCond cond, int ret,
                             int arg1, int arg2, int arg3, int arg4)
{
    switch (cond) {
+4 −3
Original line number Diff line number Diff line
@@ -1080,7 +1080,8 @@ static void tcg_out_bc (TCGContext *s, int bc, int label_index)
static void tcg_out_cr7eq_from_cond (TCGContext *s, const TCGArg *args,
                                     const int *const_args)
{
    int cond = args[4], op;
    TCGCond cond = args[4];
    int op;
    struct { int bit1; int bit2; int cond2; } bits[] = {
        [TCG_COND_LT ] = { CR_LT, CR_LT, TCG_COND_LT  },
        [TCG_COND_LE ] = { CR_LT, CR_GT, TCG_COND_LT  },
@@ -1120,7 +1121,7 @@ static void tcg_out_cr7eq_from_cond (TCGContext *s, const TCGArg *args,
    }
}

static void tcg_out_setcond (TCGContext *s, int cond, TCGArg arg0,
static void tcg_out_setcond (TCGContext *s, TCGCond cond, TCGArg arg0,
                             TCGArg arg1, TCGArg arg2, int const_arg2)
{
    int crop, sh, arg;
@@ -1244,7 +1245,7 @@ static void tcg_out_setcond2 (TCGContext *s, const TCGArg *args,
        );
}

static void tcg_out_brcond (TCGContext *s, int cond,
static void tcg_out_brcond (TCGContext *s, TCGCond cond,
                            TCGArg arg1, TCGArg arg2, int const_arg2,
                            int label_index)
{
+4 −3
Original line number Diff line number Diff line
@@ -1051,8 +1051,9 @@ static void tcg_out_cmp (TCGContext *s, int cond, TCGArg arg1, TCGArg arg2,

}

static void tcg_out_setcond (TCGContext *s, TCGType type, int cond, TCGArg arg0,
                             TCGArg arg1, TCGArg arg2, int const_arg2)
static void tcg_out_setcond (TCGContext *s, TCGType type, TCGCond cond,
                             TCGArg arg0, TCGArg arg1, TCGArg arg2,
                             int const_arg2)
{
    int crop, sh, arg;

@@ -1182,7 +1183,7 @@ static void tcg_out_bc (TCGContext *s, int bc, int label_index)
    }
}

static void tcg_out_brcond (TCGContext *s, int cond,
static void tcg_out_brcond (TCGContext *s, TCGCond cond,
                            TCGArg arg1, TCGArg arg2, int const_arg2,
                            int label_index, int arch64)
{
+6 −6
Original line number Diff line number Diff line
@@ -520,7 +520,7 @@ static void tcg_out_cmp(TCGContext *s, TCGArg c1, TCGArg c2, int c2const)
    tcg_out_arithc(s, TCG_REG_G0, c1, c2, c2const, ARITH_SUBCC);
}

static void tcg_out_brcond_i32(TCGContext *s, int cond,
static void tcg_out_brcond_i32(TCGContext *s, TCGCond cond,
                               TCGArg arg1, TCGArg arg2, int const_arg2,
                               int label_index)
{
@@ -530,7 +530,7 @@ static void tcg_out_brcond_i32(TCGContext *s, int cond,
}

#if TCG_TARGET_REG_BITS == 64
static void tcg_out_brcond_i64(TCGContext *s, int cond,
static void tcg_out_brcond_i64(TCGContext *s, TCGCond cond,
                               TCGArg arg1, TCGArg arg2, int const_arg2,
                               int label_index)
{
@@ -539,7 +539,7 @@ static void tcg_out_brcond_i64(TCGContext *s, int cond,
    tcg_out_nop(s);
}
#else
static void tcg_out_brcond2_i32(TCGContext *s, int cond,
static void tcg_out_brcond2_i32(TCGContext *s, TCGCond cond,
                                TCGArg al, TCGArg ah,
                                TCGArg bl, int blconst,
                                TCGArg bh, int bhconst, int label_dest)
@@ -587,7 +587,7 @@ static void tcg_out_brcond2_i32(TCGContext *s, int cond,
}
#endif

static void tcg_out_setcond_i32(TCGContext *s, int cond, TCGArg ret,
static void tcg_out_setcond_i32(TCGContext *s, TCGCond cond, TCGArg ret,
                                TCGArg c1, TCGArg c2, int c2const)
{
    TCGArg t;
@@ -643,7 +643,7 @@ static void tcg_out_setcond_i32(TCGContext *s, int cond, TCGArg ret,
}

#if TCG_TARGET_REG_BITS == 64
static void tcg_out_setcond_i64(TCGContext *s, int cond, TCGArg ret,
static void tcg_out_setcond_i64(TCGContext *s, TCGCond cond, TCGArg ret,
                                TCGArg c1, TCGArg c2, int c2const)
{
    tcg_out_cmp(s, c1, c2, c2const);
@@ -653,7 +653,7 @@ static void tcg_out_setcond_i64(TCGContext *s, int cond, TCGArg ret,
               | MOVCC_XCC | INSN_IMM11(1));
}
#else
static void tcg_out_setcond2_i32(TCGContext *s, int cond, TCGArg ret,
static void tcg_out_setcond2_i32(TCGContext *s, TCGCond cond, TCGArg ret,
                                 TCGArg al, TCGArg ah,
                                 TCGArg bl, int blconst,
                                 TCGArg bh, int bhconst)
Loading