From patchwork Fri Mar 19 18:26:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 48185 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E088BB7CD5 for ; Sat, 20 Mar 2010 07:30:22 +1100 (EST) Received: from localhost ([127.0.0.1]:59498 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsipM-0002xq-7F for incoming@patchwork.ozlabs.org; Fri, 19 Mar 2010 16:29:52 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nsil5-0001g7-Nu for qemu-devel@nongnu.org; Fri, 19 Mar 2010 16:25:27 -0400 Received: from [199.232.76.173] (port=60618 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nsil5-0001fi-7h for qemu-devel@nongnu.org; Fri, 19 Mar 2010 16:25:27 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nsikz-0002LZ-Jg for qemu-devel@nongnu.org; Fri, 19 Mar 2010 16:25:27 -0400 Received: from are.twiddle.net ([75.149.56.221]:59892) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nsiky-0002Ko-05 for qemu-devel@nongnu.org; Fri, 19 Mar 2010 16:25:20 -0400 Received: by are.twiddle.net (Postfix, from userid 5000) id 9F6C5B07; Fri, 19 Mar 2010 13:25:17 -0700 (PDT) Message-Id: <77d97a087514e7afae421a140211ee0188c637c3.1269029457.git.rth@twiddle.net> In-Reply-To: References: From: Richard Henderson Date: Fri, 19 Mar 2010 11:26:05 -0700 To: qemu-devel@nongnu.org X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: blauwirbel@gmail.com, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 3/9] tcg: Use TCGCond where appropriate. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use the TCGCond enumeration type in the brcond and setcond related prototypes in tcg-op.h and each code generator. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c | 4 ++-- tcg/mips/tcg-target.c | 8 ++++---- tcg/ppc/tcg-target.c | 7 ++++--- tcg/ppc64/tcg-target.c | 7 ++++--- tcg/sparc/tcg-target.c | 12 ++++++------ tcg/tcg-op.h | 34 +++++++++++++++++----------------- tcg/x86_64/tcg-target.c | 4 ++-- 7 files changed, 39 insertions(+), 37 deletions(-) diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index af6a9d0..036f6ed 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -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); diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c index e700552..f71a648 100644 --- a/tcg/mips/tcg-target.c +++ b/tcg/mips/tcg-target.c @@ -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) { diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c index f911b54..8b9e7f3 100644 --- a/tcg/ppc/tcg-target.c +++ b/tcg/ppc/tcg-target.c @@ -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) { diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c index ffe1ca0..cfcf869 100644 --- a/tcg/ppc64/tcg-target.c +++ b/tcg/ppc64/tcg-target.c @@ -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) { diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c index c1976ad..344e948 100644 --- a/tcg/sparc/tcg-target.c +++ b/tcg/sparc/tcg-target.c @@ -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) diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index a44f050..350a096 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -593,28 +593,28 @@ static inline void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) } } -static inline void tcg_gen_brcond_i32(int cond, TCGv_i32 arg1, TCGv_i32 arg2, - int label_index) +static inline void tcg_gen_brcond_i32(TCGCond cond, TCGv_i32 arg1, + TCGv_i32 arg2, int label_index) { tcg_gen_op4ii_i32(INDEX_op_brcond_i32, arg1, arg2, cond, label_index); } -static inline void tcg_gen_brcondi_i32(int cond, TCGv_i32 arg1, int32_t arg2, - int label_index) +static inline void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, + int32_t arg2, int label_index) { TCGv_i32 t0 = tcg_const_i32(arg2); tcg_gen_brcond_i32(cond, arg1, t0, label_index); tcg_temp_free_i32(t0); } -static inline void tcg_gen_setcond_i32(int cond, TCGv_i32 ret, +static inline void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) { tcg_gen_op4i_i32(INDEX_op_setcond_i32, ret, arg1, arg2, cond); } -static inline void tcg_gen_setcondi_i32(int cond, TCGv_i32 ret, TCGv_i32 arg1, - int32_t arg2) +static inline void tcg_gen_setcondi_i32(TCGCond cond, TCGv_i32 ret, + TCGv_i32 arg1, int32_t arg2) { TCGv_i32 t0 = tcg_const_i32(arg2); tcg_gen_setcond_i32(cond, ret, arg1, t0); @@ -895,15 +895,15 @@ static inline void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) tcg_gen_shifti_i64(ret, arg1, arg2, 1, 1); } -static inline void tcg_gen_brcond_i64(int cond, TCGv_i64 arg1, TCGv_i64 arg2, - int label_index) +static inline void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1, + TCGv_i64 arg2, int label_index) { tcg_gen_op6ii_i32(INDEX_op_brcond2_i32, TCGV_LOW(arg1), TCGV_HIGH(arg1), TCGV_LOW(arg2), TCGV_HIGH(arg2), cond, label_index); } -static inline void tcg_gen_setcond_i64(int cond, TCGv_i64 ret, +static inline void tcg_gen_setcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { tcg_gen_op6i_i32(INDEX_op_setcond2_i32, TCGV_LOW(ret), @@ -1136,13 +1136,13 @@ static inline void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) } } -static inline void tcg_gen_brcond_i64(int cond, TCGv_i64 arg1, TCGv_i64 arg2, - int label_index) +static inline void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1, + TCGv_i64 arg2, int label_index) { tcg_gen_op4ii_i64(INDEX_op_brcond_i64, arg1, arg2, cond, label_index); } -static inline void tcg_gen_setcond_i64(int cond, TCGv_i64 ret, +static inline void tcg_gen_setcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { tcg_gen_op4i_i64(INDEX_op_setcond_i64, ret, arg1, arg2, cond); @@ -1263,16 +1263,16 @@ static inline void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) tcg_temp_free_i64(t0); } } -static inline void tcg_gen_brcondi_i64(int cond, TCGv_i64 arg1, int64_t arg2, - int label_index) +static inline void tcg_gen_brcondi_i64(TCGCond cond, TCGv_i64 arg1, + int64_t arg2, int label_index) { TCGv_i64 t0 = tcg_const_i64(arg2); tcg_gen_brcond_i64(cond, arg1, t0, label_index); tcg_temp_free_i64(t0); } -static inline void tcg_gen_setcondi_i64(int cond, TCGv_i64 ret, TCGv_i64 arg1, - int64_t arg2) +static inline void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret, + TCGv_i64 arg1, int64_t arg2) { TCGv_i64 t0 = tcg_const_i64(arg2); tcg_gen_setcond_i64(cond, ret, arg1, t0); diff --git a/tcg/x86_64/tcg-target.c b/tcg/x86_64/tcg-target.c index cb7d651..a664168 100644 --- a/tcg/x86_64/tcg-target.c +++ b/tcg/x86_64/tcg-target.c @@ -518,7 +518,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 rexw) { @@ -526,7 +526,7 @@ static void tcg_out_brcond(TCGContext *s, int cond, tcg_out_jxx(s, tcg_cond_to_jcc[cond], label_index); } -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, int rexw) { tcg_out_cmp(s, arg1, arg2, const_arg2, rexw);