[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 10/14] tcg: Map TCG_CALL_DUMMY_ARG to NULL
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [RFC 10/14] tcg: Map TCG_CALL_DUMMY_ARG to NULL |
Date: |
Wed, 16 Nov 2016 20:51:46 +0100 |
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/tcg.c | 36 +++++++++++++-----------------------
tcg/tcg.h | 2 +-
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index e8b3fbb..c62f161 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1415,7 +1415,6 @@ static void liveness_pass_1(TCGContext *s)
bool have_opc_new2;
TCGLifeData arg_life = 0;
TCGTemp *arg_ts;
- TCGArg arg_idx;
TCGOp * const op = &s->gen_op_buf[oi];
TCGArg * const args = &s->gen_opparam_buf[op->args];
@@ -1472,19 +1471,15 @@ static void liveness_pass_1(TCGContext *s)
/* record arguments that die in this helper */
for (i = nb_oargs; i < nb_iargs + nb_oargs; i++) {
- arg_idx = arg_index(args[i]);
- if (arg_idx != TCG_CALL_DUMMY_ARG) {
- arg_ts = arg_temp(args[i]);
- if (arg_ts->state & TS_DEAD) {
- arg_life |= DEAD_ARG << i;
- }
+ arg_ts = arg_temp(args[i]);
+ if (arg_ts && (arg_ts->state & TS_DEAD)) {
+ arg_life |= DEAD_ARG << i;
}
}
/* input arguments are live for preceding opcodes */
for (i = nb_oargs; i < nb_iargs + nb_oargs; i++) {
- arg_idx = arg_index(args[i]);
- if (arg_idx != TCG_CALL_DUMMY_ARG) {
- arg_ts = arg_temp(args[i]);
+ arg_ts = arg_temp(args[i]);
+ if (arg_ts) {
arg_ts->state &= ~TS_DEAD;
}
}
@@ -1690,12 +1685,10 @@ static bool liveness_pass_2(TCGContext *s)
/* Make sure that input arguments are available. */
for (i = nb_oargs; i < nb_iargs + nb_oargs; i++) {
- arg_idx = arg_index(args[i]);
- /* Note this unsigned test catches TCG_CALL_ARG_DUMMY too. */
- if (arg_idx < nb_globals) {
- arg_ts = arg_temp(args[i]);
+ arg_ts = arg_temp(args[i]);
+ if (arg_ts) {
dir_ts = arg_ts->state_ptr;
- if (dir_ts != 0 && arg_ts->state == TS_DEAD) {
+ if (dir_ts && arg_ts->state == TS_DEAD) {
TCGOpcode lopc = (arg_ts->type == TCG_TYPE_I32
? INDEX_op_ld_i32
: INDEX_op_ld_i64);
@@ -1716,12 +1709,10 @@ static bool liveness_pass_2(TCGContext *s)
No action is required except keeping temp_state up to date
so that we reload when needed. */
for (i = nb_oargs; i < nb_iargs + nb_oargs; i++) {
- arg_idx = arg_index(args[i]);
- /* Note this unsigned test catches TCG_CALL_ARG_DUMMY too. */
- if (arg_idx < nb_globals) {
- arg_ts = arg_temp(args[i]);
+ arg_ts = arg_temp(args[i]);
+ if (arg_ts) {
dir_ts = arg_ts->state_ptr;
- if (dir_ts != 0) {
+ if (dir_ts) {
args[i] = temp_idx(dir_ts);
changes = true;
if (IS_DEAD_ARG(i)) {
@@ -2403,9 +2394,8 @@ static void tcg_reg_alloc_call(TCGContext *s, int
nb_oargs, int nb_iargs,
/* assign input registers */
tcg_regset_set(allocated_regs, s->reserved_regs);
for(i = 0; i < nb_regs; i++) {
- arg = args[nb_oargs + i];
- if (arg != TCG_CALL_DUMMY_ARG) {
- ts = arg_temp(arg);
+ ts = arg_temp(args[nb_oargs + i]);
+ if (ts) {
reg = tcg_target_call_iarg_regs[i];
tcg_reg_free(s, reg, allocated_regs);
diff --git a/tcg/tcg.h b/tcg/tcg.h
index acc0cfb..2670cab 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -483,7 +483,7 @@ typedef TCGv_ptr TCGv_env;
#define TCG_CALL_NO_WG_SE (TCG_CALL_NO_WG | TCG_CALL_NO_SE)
/* used to align parameters */
-#define TCG_CALL_DUMMY_ARG ((TCGArg)(-1))
+#define TCG_CALL_DUMMY_ARG 0
typedef enum {
/* Used to indicate the type of accesses on which ordering
--
2.7.4
- [Qemu-devel] [RFC 00/14] tcg: Use TCGTemp pointers instead of indices, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 01/14] tcg: Use NULL for TCGV_UNUSED_*, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 04/14] tcg: Add temp_global bit to TCGTemp, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 02/14] tcg: Define actual structures for TCGv_*, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 05/14] tcg: Avoid loops against variable bounds, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 03/14] tcg: Use per-temp state data in liveness, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 06/14] tcg: More use of arg_temp, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 07/14] tcg: Change temp_allocate_frame arg to TCGTemp, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 08/14] tcg: Remove unused TCG_CALL_DUMMY_TCGV, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 09/14] tcg: More use of arg_index, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 10/14] tcg: Map TCG_CALL_DUMMY_ARG to NULL,
Richard Henderson <=
- [Qemu-devel] [RFC 13/14] tcg: Use temp number 0 again, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 11/14] tcg: Introduce temp_info for the optimize pass, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 12/14] tcg: Store pointers to temporaries directly in TCGArg, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 14/14] tcg/optimize: Fold movcond 0/1 into setcond, Richard Henderson, 2016/11/16