From patchwork Sat Dec 10 16:35:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 5571 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0F33C23E03 for ; Sat, 10 Dec 2011 16:35:42 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id E0B55A1823D for ; Sat, 10 Dec 2011 16:35:41 +0000 (UTC) Received: by bke17 with SMTP id 17so5439300bke.11 for ; Sat, 10 Dec 2011 08:35:40 -0800 (PST) Received: by 10.204.133.213 with SMTP id g21mr2547523bkt.126.1323534940097; Sat, 10 Dec 2011 08:35:40 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.129.2 with SMTP id hg2cs6176bkc; Sat, 10 Dec 2011 08:35:37 -0800 (PST) Received: by 10.180.107.97 with SMTP id hb1mr15977905wib.18.1323534935356; Sat, 10 Dec 2011 08:35:35 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id w32si5579719weq.140.2011.12.10.08.35.33 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 10 Dec 2011 08:35:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1RZPtb-0002pU-QG; Sat, 10 Dec 2011 16:35:31 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org Subject: [PATCH] tcg: make tcg_const_ptr actually accept a pointer argument Date: Sat, 10 Dec 2011 16:35:31 +0000 Message-Id: <1323534931-10853-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 Make tcg_const_ptr() include a cast so that you can pass it a pointer. This allows us to drop the casts we had in all the places that use this macro. Signed-off-by: Peter Maydell Acked-by: Andreas Färber --- Minor cleanup; I have a patchset cooking that wants to use tcg_const_ptr(), which is why I noticed this infelicity. tcg/tcg-op.h | 6 +++--- tcg/tcg.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index 82e04e7..169d3b2 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -389,7 +389,7 @@ static inline void tcg_gen_helperN(void *func, int flags, int sizemask, TCGArg ret, int nargs, TCGArg *args) { TCGv_ptr fn; - fn = tcg_const_ptr((tcg_target_long)func); + fn = tcg_const_ptr(func); tcg_gen_callN(&tcg_ctx, fn, flags, sizemask, ret, nargs, args); tcg_temp_free_ptr(fn); @@ -405,7 +405,7 @@ static inline void tcg_gen_helper32(void *func, int sizemask, TCGv_i32 ret, { TCGv_ptr fn; TCGArg args[2]; - fn = tcg_const_ptr((tcg_target_long)func); + fn = tcg_const_ptr(func); args[0] = GET_TCGV_I32(a); args[1] = GET_TCGV_I32(b); tcg_gen_callN(&tcg_ctx, fn, TCG_CALL_CONST | TCG_CALL_PURE, sizemask, @@ -418,7 +418,7 @@ static inline void tcg_gen_helper64(void *func, int sizemask, TCGv_i64 ret, { TCGv_ptr fn; TCGArg args[2]; - fn = tcg_const_ptr((tcg_target_long)func); + fn = tcg_const_ptr(func); args[0] = GET_TCGV_I64(a); args[1] = GET_TCGV_I64(b); tcg_gen_callN(&tcg_ctx, fn, TCG_CALL_CONST | TCG_CALL_PURE, sizemask, diff --git a/tcg/tcg.h b/tcg/tcg.h index 175000f..5c28239 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -544,7 +544,7 @@ void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs); #define TCGV_NAT_TO_PTR(n) MAKE_TCGV_PTR(GET_TCGV_I32(n)) #define TCGV_PTR_TO_NAT(n) MAKE_TCGV_I32(GET_TCGV_PTR(n)) -#define tcg_const_ptr(V) TCGV_NAT_TO_PTR(tcg_const_i32(V)) +#define tcg_const_ptr(V) TCGV_NAT_TO_PTR(tcg_const_i32((tcg_target_long)(V))) #define tcg_global_reg_new_ptr(R, N) \ TCGV_NAT_TO_PTR(tcg_global_reg_new_i32((R), (N))) #define tcg_global_mem_new_ptr(R, O, N) \ @@ -555,7 +555,7 @@ void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs); #define TCGV_NAT_TO_PTR(n) MAKE_TCGV_PTR(GET_TCGV_I64(n)) #define TCGV_PTR_TO_NAT(n) MAKE_TCGV_I64(GET_TCGV_PTR(n)) -#define tcg_const_ptr(V) TCGV_NAT_TO_PTR(tcg_const_i64(V)) +#define tcg_const_ptr(V) TCGV_NAT_TO_PTR(tcg_const_i64((tcg_target_long)(V))) #define tcg_global_reg_new_ptr(R, N) \ TCGV_NAT_TO_PTR(tcg_global_reg_new_i64((R), (N))) #define tcg_global_mem_new_ptr(R, O, N) \