From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 5/7] tcg: Generalize TCGOp parameters
Date: Fri, 15 Dec 2017 11:07:30 -0600 [thread overview]
Message-ID: <20171215170732.31125-6-richard.henderson@linaro.org> (raw)
In-Reply-To: <20171215170732.31125-1-richard.henderson@linaro.org>
We had two fields specific to INDEX_op_call. Rename these and
add some macros so that the fields may be reused for other opcodes.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/tcg.h | 10 ++++++----
tcg/optimize.c | 4 ++--
tcg/tcg.c | 22 +++++++++++-----------
3 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/tcg/tcg.h b/tcg/tcg.h
index a577447846..f25efa9795 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -566,10 +566,9 @@ typedef uint16_t TCGLifeData;
typedef struct TCGOp {
TCGOpcode opc : 8; /* 8 */
- /* The number of out and in parameter for a call. */
- unsigned calli : 4; /* 12 */
- unsigned callo : 2; /* 14 */
- unsigned : 2; /* 16 */
+ /* Parameters for this opcode. See below. */
+ unsigned param1 : 4; /* 12 */
+ unsigned param2 : 4; /* 16 */
/* Lifetime data of the operands. */
unsigned life : 16; /* 32 */
@@ -581,6 +580,9 @@ typedef struct TCGOp {
TCGArg args[MAX_OPC_PARAM];
} TCGOp;
+#define TCGOP_CALLI(X) (X)->param1
+#define TCGOP_CALLO(X) (X)->param2
+
/* Make sure operands fit in the bitfields above. */
QEMU_BUILD_BUG_ON(NB_OPS > (1 << 8));
diff --git a/tcg/optimize.c b/tcg/optimize.c
index e495680e95..2cbbeefd53 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -627,8 +627,8 @@ void tcg_optimize(TCGContext *s)
/* Count the arguments, and initialize the temps that are
going to be used */
if (opc == INDEX_op_call) {
- nb_oargs = op->callo;
- nb_iargs = op->calli;
+ nb_oargs = TCGOP_CALLO(op);
+ nb_iargs = TCGOP_CALLI(op);
for (i = 0; i < nb_oargs + nb_iargs; i++) {
TCGTemp *ts = arg_temp(op->args[i]);
if (ts) {
diff --git a/tcg/tcg.c b/tcg/tcg.c
index f26949a900..93caa0be93 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1430,7 +1430,7 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args)
} else {
nb_rets = 0;
}
- op->callo = nb_rets;
+ TCGOP_CALLO(op) = nb_rets;
real_args = 0;
for (i = 0; i < nargs; i++) {
@@ -1469,10 +1469,10 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args)
}
op->args[pi++] = (uintptr_t)func;
op->args[pi++] = flags;
- op->calli = real_args;
+ TCGOP_CALLI(op) = real_args;
/* Make sure the fields didn't overflow. */
- tcg_debug_assert(op->calli == real_args);
+ tcg_debug_assert(TCGOP_CALLI(op) == real_args);
tcg_debug_assert(pi <= ARRAY_SIZE(op->args));
#if defined(__sparc__) && !defined(__arch64__) \
@@ -1634,8 +1634,8 @@ void tcg_dump_ops(TCGContext *s)
}
} else if (c == INDEX_op_call) {
/* variable number of arguments */
- nb_oargs = op->callo;
- nb_iargs = op->calli;
+ nb_oargs = TCGOP_CALLO(op);
+ nb_iargs = TCGOP_CALLI(op);
nb_cargs = def->nb_cargs;
/* function name, flags, out args */
@@ -1996,8 +1996,8 @@ static void liveness_pass_1(TCGContext *s)
{
int call_flags;
- nb_oargs = op->callo;
- nb_iargs = op->calli;
+ nb_oargs = TCGOP_CALLO(op);
+ nb_iargs = TCGOP_CALLI(op);
call_flags = op->args[nb_oargs + nb_iargs + 1];
/* pure functions can be removed if their result is unused */
@@ -2233,8 +2233,8 @@ static bool liveness_pass_2(TCGContext *s)
TCGTemp *arg_ts, *dir_ts;
if (opc == INDEX_op_call) {
- nb_oargs = op->callo;
- nb_iargs = op->calli;
+ nb_oargs = TCGOP_CALLO(op);
+ nb_iargs = TCGOP_CALLI(op);
call_flags = op->args[nb_oargs + nb_iargs + 1];
} else {
nb_iargs = def->nb_iargs;
@@ -2915,8 +2915,8 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op)
{
- const int nb_oargs = op->callo;
- const int nb_iargs = op->calli;
+ const int nb_oargs = TCGOP_CALLO(op);
+ const int nb_iargs = TCGOP_CALLI(op);
const TCGLifeData arg_life = op->life;
int flags, nb_regs, i;
TCGReg reg;
--
2.14.3
next prev parent reply other threads:[~2017-12-15 17:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-15 17:07 [Qemu-devel] [PATCH 0/7] TCG misc patches Richard Henderson
2017-12-15 17:07 ` [Qemu-devel] [PATCH 1/7] target/*helper: don't check retaddr before calling cpu_restore_state Richard Henderson
2017-12-15 17:07 ` [Qemu-devel] [PATCH 2/7] target/moxie: Fix tlb_fill Richard Henderson
2017-12-15 17:31 ` Peter Maydell
2017-12-18 18:47 ` Richard Henderson
2017-12-15 17:07 ` [Qemu-devel] [PATCH 3/7] tcg: Remove TCGV_UNUSED* and TCGV_IS_UNUSED* Richard Henderson
2017-12-15 17:58 ` Philippe Mathieu-Daudé
2017-12-15 17:07 ` [Qemu-devel] [PATCH 4/7] tcg: Dynamically allocate TCGOps Richard Henderson
2017-12-15 17:07 ` Richard Henderson [this message]
2017-12-15 17:59 ` [Qemu-devel] [PATCH 5/7] tcg: Generalize TCGOp parameters Philippe Mathieu-Daudé
2017-12-15 17:07 ` [Qemu-devel] [PATCH 6/7] tcg: Add tcg_signed_cond Richard Henderson
2017-12-15 17:07 ` [Qemu-devel] [PATCH 7/7] tcg: Allow 6 arguments to TCG helpers Richard Henderson
2017-12-15 18:06 ` Philippe Mathieu-Daudé
2017-12-18 19:20 ` Richard Henderson
2017-12-18 20:39 ` Philippe Mathieu-Daudé
2017-12-15 18:13 ` [Qemu-devel] [PATCH 0/7] TCG misc patches no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171215170732.31125-6-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).