[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 05/16] tcg: More use of TCGReg where appropriate
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [RFC 05/16] tcg: More use of TCGReg where appropriate |
Date: |
Thu, 19 Sep 2013 14:24:57 -0700 |
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/tcg.c | 26 +++++++++++++++-----------
tcg/tcg.h | 8 ++++----
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 8fc5588..13dc8f5 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -341,7 +341,7 @@ static inline void tcg_temp_alloc(TCGContext *s, int n)
}
static int tcg_global_reg_new_internal(TCGContext *s, TCGType type,
- int reg, const char *name)
+ TCGReg reg, const char *name)
{
TCGTemp *ts;
int idx;
@@ -362,14 +362,14 @@ static int tcg_global_reg_new_internal(TCGContext *s,
TCGType type,
return idx;
}
-void tcg_set_frame(TCGContext *s, int reg, intptr_t start, intptr_t size)
+void tcg_set_frame(TCGContext *s, TCGReg reg, intptr_t start, intptr_t size)
{
s->frame_start = start;
s->frame_end = start + size;
s->frame_temp = tcg_global_reg_new_internal(s, TCG_TYPE_PTR, reg,
"_frame");
}
-TCGv_i32 tcg_global_reg_new_i32(int reg, const char *name)
+TCGv_i32 tcg_global_reg_new_i32(TCGReg reg, const char *name)
{
TCGContext *s = &tcg_ctx;
int idx;
@@ -381,7 +381,7 @@ TCGv_i32 tcg_global_reg_new_i32(int reg, const char *name)
return MAKE_TCGV_I32(idx);
}
-TCGv_i64 tcg_global_reg_new_i64(int reg, const char *name)
+TCGv_i64 tcg_global_reg_new_i64(TCGReg reg, const char *name)
{
TCGContext *s = &tcg_ctx;
int idx;
@@ -1550,7 +1550,8 @@ static void dump_regs(TCGContext *s)
static void check_regs(TCGContext *s)
{
- int reg, k;
+ TCGReg reg;
+ int k;
TCGTemp *ts;
char buf[64];
@@ -1603,7 +1604,7 @@ static void temp_allocate_frame(TCGContext *s, int temp)
}
/* sync register 'reg' by saving it to the corresponding temporary */
-static inline void tcg_reg_sync(TCGContext *s, int reg)
+static inline void tcg_reg_sync(TCGContext *s, TCGReg reg)
{
TCGTemp *ts;
int temp;
@@ -1621,7 +1622,7 @@ static inline void tcg_reg_sync(TCGContext *s, int reg)
}
/* free register 'reg' by spilling the corresponding temporary if necessary */
-static void tcg_reg_free(TCGContext *s, int reg)
+static void tcg_reg_free(TCGContext *s, TCGReg reg)
{
int temp;
@@ -1634,9 +1635,10 @@ static void tcg_reg_free(TCGContext *s, int reg)
}
/* Allocate a register belonging to reg1 & ~reg2 */
-static int tcg_reg_alloc(TCGContext *s, TCGRegSet reg1, TCGRegSet reg2)
+static TCGReg tcg_reg_alloc(TCGContext *s, TCGRegSet reg1, TCGRegSet reg2)
{
- int i, reg;
+ int i;
+ TCGReg reg;
TCGRegSet reg_ct;
tcg_regset_andnot(reg_ct, reg1, reg2);
@@ -1894,7 +1896,8 @@ static void tcg_reg_alloc_op(TCGContext *s,
uint8_t sync_args)
{
TCGRegSet allocated_regs;
- int i, k, nb_iargs, nb_oargs, reg;
+ int i, k, nb_iargs, nb_oargs;
+ TCGReg reg;
TCGArg arg;
const TCGArgConstraint *arg_ct;
TCGTemp *ts;
@@ -2060,7 +2063,8 @@ static int tcg_reg_alloc_call(TCGContext *s, const
TCGOpDef *def,
TCGOpcode opc, const TCGArg *args,
uint16_t dead_args, uint8_t sync_args)
{
- int nb_iargs, nb_oargs, flags, nb_regs, i, reg, nb_params;
+ int nb_iargs, nb_oargs, flags, nb_regs, i, nb_params;
+ TCGReg reg;
TCGArg arg, func_arg;
TCGTemp *ts;
intptr_t stack_offset;
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 16048ca..d69d993 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -394,7 +394,7 @@ typedef struct TCGTemp {
TCGType base_type;
TCGType type;
TCGTempType val_type;
- int reg;
+ TCGReg reg;
tcg_target_long val;
struct TCGTemp *mem_base;
intptr_t mem_offset;
@@ -539,12 +539,12 @@ void tcg_func_start(TCGContext *s);
int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf);
int tcg_gen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset);
-void tcg_set_frame(TCGContext *s, int reg, intptr_t start, intptr_t size);
+void tcg_set_frame(TCGContext *s, TCGReg reg, intptr_t start, intptr_t size);
int tcg_global_mem_new_internal(TCGType, TCGv_ptr, intptr_t, const char *);
-TCGv_i32 tcg_global_reg_new_i32(int reg, const char *name);
-TCGv_i64 tcg_global_reg_new_i64(int reg, const char *name);
+TCGv_i32 tcg_global_reg_new_i32(TCGReg reg, const char *name);
+TCGv_i64 tcg_global_reg_new_i64(TCGReg reg, const char *name);
TCGv_i32 tcg_temp_new_internal_i32(int temp_local);
TCGv_i64 tcg_temp_new_internal_i64(int temp_local);
--
1.8.1.4
- [Qemu-devel] [RFC 00/16] TCG indirect registers, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 02/16] tcg: Introduce TCGTempType, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 01/16] tcg: Change tcg_global_mem_new_* to take a TCGv_ptr, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 03/16] tcg: Change ts->mem_reg to ts->mem_base, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 04/16] tcg: Compress TCGLabelQemuLdst, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 05/16] tcg: More use of TCGReg where appropriate,
Richard Henderson <=
- [Qemu-devel] [RFC 06/16] tcg: Remove tcg_get_arg_str_i32/64, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 07/16] tcg: Change reg_to_temp to TCGTemp pointer, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 08/16] tcg: Change temp_dead argument to TCGTemp, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 09/16] tcg: Change temp_sync argument to TCGTemp, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 10/16] tcg: Change temp_save argument to TCGTemp, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 11/16] tcg: Introduce temp_load, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 12/16] tcg: Tidy temporary allocation, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 13/16] tcg: Use temp_idx, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 14/16] tcg: Implement indirect memory registers, Richard Henderson, 2013/09/19
- [Qemu-devel] [RFC 15/16] target-sparc: Tidy global register initialization, Richard Henderson, 2013/09/19