tcg: More use of TCGReg where appropriate

Backports commit b66386623176e0b0f3bd270640bdb8ac8431c732 from qemu
This commit is contained in:
Richard Henderson 2018-02-19 02:06:03 -05:00 committed by Lioncash
parent e7a7d8c508
commit 12577dfcc0
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 19 additions and 15 deletions

View file

@ -429,7 +429,7 @@ static inline void tcg_temp_alloc(TCGContext *s, int n)
} }
static int tcg_global_reg_new_internal(TCGContext *s, TCGType type, static int tcg_global_reg_new_internal(TCGContext *s, TCGType type,
int reg, const char *name) TCGReg reg, const char *name)
{ {
TCGTemp *ts; TCGTemp *ts;
int idx; int idx;
@ -450,7 +450,7 @@ static int tcg_global_reg_new_internal(TCGContext *s, TCGType type,
return idx; 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)
{ {
int idx; int idx;
s->frame_start = start; s->frame_start = start;
@ -459,7 +459,7 @@ void tcg_set_frame(TCGContext *s, int reg, intptr_t start, intptr_t size)
s->frame_temp = &s->temps[idx]; s->frame_temp = &s->temps[idx];
} }
TCGv_i32 tcg_global_reg_new_i32(TCGContext *s, int reg, const char *name) TCGv_i32 tcg_global_reg_new_i32(TCGContext *s, TCGReg reg, const char *name)
{ {
int idx; int idx;
@ -471,7 +471,7 @@ TCGv_i32 tcg_global_reg_new_i32(TCGContext *s, int reg, const char *name)
return MAKE_TCGV_I32(idx); return MAKE_TCGV_I32(idx);
} }
TCGv_i64 tcg_global_reg_new_i64(TCGContext *s, int reg, const char *name) TCGv_i64 tcg_global_reg_new_i64(TCGContext *s, TCGReg reg, const char *name)
{ {
int idx; int idx;
@ -1688,7 +1688,8 @@ static void dump_regs(TCGContext *s)
static void check_regs(TCGContext *s) static void check_regs(TCGContext *s)
{ {
int reg, k; TCGReg reg;
int k;
TCGTemp *ts; TCGTemp *ts;
char buf[64]; char buf[64];
@ -1741,7 +1742,7 @@ static void temp_allocate_frame(TCGContext *s, int temp)
} }
/* sync register 'reg' by saving it to the corresponding temporary */ /* 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; TCGTemp *ts;
int temp; int temp;
@ -1759,7 +1760,7 @@ static inline void tcg_reg_sync(TCGContext *s, int reg)
} }
/* free register 'reg' by spilling the corresponding temporary if necessary */ /* 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; int temp;
@ -1772,9 +1773,10 @@ static void tcg_reg_free(TCGContext *s, int reg)
} }
/* Allocate a register belonging to reg1 & ~reg2 */ /* 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; TCGRegSet reg_ct;
tcg_regset_andnot(reg_ct, reg1, reg2); tcg_regset_andnot(reg_ct, reg1, reg2);
@ -2036,7 +2038,8 @@ static void tcg_reg_alloc_op(TCGContext *s,
uint8_t sync_args) uint8_t sync_args)
{ {
TCGRegSet allocated_regs; TCGRegSet allocated_regs;
int i, k, nb_iargs, nb_oargs, reg; int i, k, nb_iargs, nb_oargs;
TCGReg reg;
TCGArg arg; TCGArg arg;
const TCGArgConstraint *arg_ct; const TCGArgConstraint *arg_ct;
TCGTemp *ts; TCGTemp *ts;
@ -2202,7 +2205,8 @@ static void tcg_reg_alloc_call(TCGContext *s, int nb_oargs, int nb_iargs,
const TCGArg * const args, uint16_t dead_args, const TCGArg * const args, uint16_t dead_args,
uint8_t sync_args) uint8_t sync_args)
{ {
int flags, nb_regs, i, reg; int flags, nb_regs, i;
TCGReg reg;
TCGArg arg; TCGArg arg;
TCGTemp *ts; TCGTemp *ts;
intptr_t stack_offset; intptr_t stack_offset;

View file

@ -451,7 +451,7 @@ typedef enum TCGTempVal {
} TCGTempVal; } TCGTempVal;
typedef struct TCGTemp { typedef struct TCGTemp {
unsigned int reg:8; TCGReg reg:8;
TCGTempVal val_type:8; TCGTempVal val_type:8;
TCGType base_type:8; TCGType base_type:8;
TCGType type:8; TCGType type:8;
@ -507,12 +507,12 @@ void tcg_func_start(TCGContext *s);
int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf); int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf);
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(TCGContext *s, TCGType type, TCGv_ptr base, intptr_t offset, const char *name); int tcg_global_mem_new_internal(TCGContext *s, TCGType type, TCGv_ptr base, intptr_t offset, const char *name);
TCGv_i32 tcg_global_reg_new_i32(TCGContext *s, int reg, const char *name); TCGv_i32 tcg_global_reg_new_i32(TCGContext *s, TCGReg reg, const char *name);
TCGv_i64 tcg_global_reg_new_i64(TCGContext *s, int reg, const char *name); TCGv_i64 tcg_global_reg_new_i64(TCGContext *s, TCGReg reg, const char *name);
TCGv_i32 tcg_temp_new_internal_i32(TCGContext *s, int temp_local); TCGv_i32 tcg_temp_new_internal_i32(TCGContext *s, int temp_local);
TCGv_i64 tcg_temp_new_internal_i64(TCGContext *s, int temp_local); TCGv_i64 tcg_temp_new_internal_i64(TCGContext *s, int temp_local);