diff mbox

remove unused params in some TCG functions

Message ID fdaac4d50912110054h12c1993cp578bc52ead79ec4d@mail.gmail.com
State New
Headers show

Commit Message

Jun Koi Dec. 11, 2009, 8:54 a.m. UTC
Hi,

Thanks to everybody helping me to have more understanding on QEmu
internals. This community is great!

This trivial patch removes some unused params in tcg_out_st() and
tcg_out_ld(). Probably this remains from dyngen time?

Thanks,
Jun



         case TEMP_VAL_MEM:
@@ -1494,7 +1494,7 @@ static void tcg_reg_alloc_mov(TCGContext *s,
const TCGOpDef *def,
         } else {
             reg = tcg_reg_alloc(s, arg_ct->u.regs, s->reserved_regs);
         }
-        tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
+        tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
     } else if (ts->val_type == TEMP_VAL_CONST) {
         if (ots->fixed_reg) {
             reg = ots->reg;
@@ -1546,7 +1546,7 @@ static void tcg_reg_alloc_op(TCGContext *s,
         ts = &s->temps[arg];
         if (ts->val_type == TEMP_VAL_MEM) {
             reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs);
-            tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
+            tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
             ts->val_type = TEMP_VAL_REG;
             ts->reg = reg;
             ts->mem_coherent = 1;
@@ -1726,19 +1726,19 @@ static int tcg_reg_alloc_call(TCGContext *s,
const TCGOpDef *def,
         if (arg != TCG_CALL_DUMMY_ARG) {
             ts = &s->temps[arg];
             if (ts->val_type == TEMP_VAL_REG) {
-                tcg_out_st(s, ts->type, ts->reg, TCG_REG_CALL_STACK,
stack_offset);
+                tcg_out_st(s, ts->reg, TCG_REG_CALL_STACK, stack_offset);
             } else if (ts->val_type == TEMP_VAL_MEM) {
                 reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type],
                                     s->reserved_regs);
                 /* XXX: not correct if reading values from the stack */
-                tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
-                tcg_out_st(s, ts->type, reg, TCG_REG_CALL_STACK, stack_offset);
+                tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
+                tcg_out_st(s, reg, TCG_REG_CALL_STACK, stack_offset);
             } else if (ts->val_type == TEMP_VAL_CONST) {
                 reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type],
                                     s->reserved_regs);
                 /* XXX: sign extend may be needed on some targets */
                 tcg_out_movi(s, ts->type, reg, ts->val);
-                tcg_out_st(s, ts->type, reg, TCG_REG_CALL_STACK, stack_offset);
+                tcg_out_st(s, reg, TCG_REG_CALL_STACK, stack_offset);
             } else {
                 tcg_abort();
             }
@@ -1761,7 +1761,7 @@ static int tcg_reg_alloc_call(TCGContext *s,
const TCGOpDef *def,
                     tcg_out_mov(s, reg, ts->reg);
                 }
             } else if (ts->val_type == TEMP_VAL_MEM) {
-                tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
+                tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
             } else if (ts->val_type == TEMP_VAL_CONST) {
                 /* XXX: sign extend ? */
                 tcg_out_movi(s, ts->type, reg, ts->val);
@@ -1780,7 +1780,7 @@ static int tcg_reg_alloc_call(TCGContext *s,
const TCGOpDef *def,
     const_func_arg = 0;
     if (ts->val_type == TEMP_VAL_MEM) {
         reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs);
-        tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
+        tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
         func_arg = reg;
         tcg_regset_set_reg(allocated_regs, reg);
     } else if (ts->val_type == TEMP_VAL_REG) {

Comments

Aurelien Jarno Dec. 11, 2009, 6:33 p.m. UTC | #1
On Fri, Dec 11, 2009 at 05:54:06PM +0900, Jun Koi wrote:
> Hi,
> 
> Thanks to everybody helping me to have more understanding on QEmu
> internals. This community is great!
> 
> This trivial patch removes some unused params in tcg_out_st() and
> tcg_out_ld(). Probably this remains from dyngen time?

Thoses parameters are used, simply not on an i386 host. Just look at
tcg/*/tcg-target.c, especially 64-bit hosts.

> 
> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
> index 972b102..484f476 100644
> --- a/tcg/i386/tcg-target.c
> +++ b/tcg/i386/tcg-target.c
> @@ -262,14 +262,14 @@ static inline void tcg_out_movi(TCGContext *s,
> TCGType type,
>      }
>  }
> 
> -static inline void tcg_out_ld(TCGContext *s, TCGType type, int ret,
> +static inline void tcg_out_ld(TCGContext *s, int ret,
>                                int arg1, tcg_target_long arg2)
>  {
>      /* movl */
>      tcg_out_modrm_offset(s, 0x8b, ret, arg1, arg2);
>  }
> 
> -static inline void tcg_out_st(TCGContext *s, TCGType type, int arg,
> +static inline void tcg_out_st(TCGContext *s, int arg,
>                                int arg1, tcg_target_long arg2)
>  {
>      /* movl */
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 3c0e296..abed1c3 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -1333,7 +1333,7 @@ static void tcg_reg_free(TCGContext *s, int reg)
>          if (!ts->mem_coherent) {
>              if (!ts->mem_allocated)
>                  temp_allocate_frame(s, temp);
> -            tcg_out_st(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
> +            tcg_out_st(s, reg, ts->mem_reg, ts->mem_offset);
>          }
>          ts->val_type = TEMP_VAL_MEM;
>          s->reg_to_temp[reg] = -1;
> @@ -1389,7 +1389,7 @@ static void temp_save(TCGContext *s, int temp,
> TCGRegSet allocated_regs)
>              if (!ts->mem_allocated)
>                  temp_allocate_frame(s, temp);
>              tcg_out_movi(s, ts->type, reg, ts->val);
> -            tcg_out_st(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
> +            tcg_out_st(s, reg, ts->mem_reg, ts->mem_offset);
>              ts->val_type = TEMP_VAL_MEM;
>              break;
>          case TEMP_VAL_MEM:
> @@ -1494,7 +1494,7 @@ static void tcg_reg_alloc_mov(TCGContext *s,
> const TCGOpDef *def,
>          } else {
>              reg = tcg_reg_alloc(s, arg_ct->u.regs, s->reserved_regs);
>          }
> -        tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
> +        tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
>      } else if (ts->val_type == TEMP_VAL_CONST) {
>          if (ots->fixed_reg) {
>              reg = ots->reg;
> @@ -1546,7 +1546,7 @@ static void tcg_reg_alloc_op(TCGContext *s,
>          ts = &s->temps[arg];
>          if (ts->val_type == TEMP_VAL_MEM) {
>              reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs);
> -            tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
> +            tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
>              ts->val_type = TEMP_VAL_REG;
>              ts->reg = reg;
>              ts->mem_coherent = 1;
> @@ -1726,19 +1726,19 @@ static int tcg_reg_alloc_call(TCGContext *s,
> const TCGOpDef *def,
>          if (arg != TCG_CALL_DUMMY_ARG) {
>              ts = &s->temps[arg];
>              if (ts->val_type == TEMP_VAL_REG) {
> -                tcg_out_st(s, ts->type, ts->reg, TCG_REG_CALL_STACK,
> stack_offset);
> +                tcg_out_st(s, ts->reg, TCG_REG_CALL_STACK, stack_offset);
>              } else if (ts->val_type == TEMP_VAL_MEM) {
>                  reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type],
>                                      s->reserved_regs);
>                  /* XXX: not correct if reading values from the stack */
> -                tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
> -                tcg_out_st(s, ts->type, reg, TCG_REG_CALL_STACK, stack_offset);
> +                tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
> +                tcg_out_st(s, reg, TCG_REG_CALL_STACK, stack_offset);
>              } else if (ts->val_type == TEMP_VAL_CONST) {
>                  reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type],
>                                      s->reserved_regs);
>                  /* XXX: sign extend may be needed on some targets */
>                  tcg_out_movi(s, ts->type, reg, ts->val);
> -                tcg_out_st(s, ts->type, reg, TCG_REG_CALL_STACK, stack_offset);
> +                tcg_out_st(s, reg, TCG_REG_CALL_STACK, stack_offset);
>              } else {
>                  tcg_abort();
>              }
> @@ -1761,7 +1761,7 @@ static int tcg_reg_alloc_call(TCGContext *s,
> const TCGOpDef *def,
>                      tcg_out_mov(s, reg, ts->reg);
>                  }
>              } else if (ts->val_type == TEMP_VAL_MEM) {
> -                tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
> +                tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
>              } else if (ts->val_type == TEMP_VAL_CONST) {
>                  /* XXX: sign extend ? */
>                  tcg_out_movi(s, ts->type, reg, ts->val);
> @@ -1780,7 +1780,7 @@ static int tcg_reg_alloc_call(TCGContext *s,
> const TCGOpDef *def,
>      const_func_arg = 0;
>      if (ts->val_type == TEMP_VAL_MEM) {
>          reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs);
> -        tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
> +        tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
>          func_arg = reg;
>          tcg_regset_set_reg(allocated_regs, reg);
>      } else if (ts->val_type == TEMP_VAL_REG) {
> 
> 
>
Laurent Desnogues Dec. 12, 2009, 12:50 a.m. UTC | #2
On Fri, Dec 11, 2009 at 7:33 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On Fri, Dec 11, 2009 at 05:54:06PM +0900, Jun Koi wrote:
>> Hi,
>>
>> Thanks to everybody helping me to have more understanding on QEmu
>> internals. This community is great!
>>
>> This trivial patch removes some unused params in tcg_out_st() and
>> tcg_out_ld(). Probably this remains from dyngen time?
>
> Thoses parameters are used, simply not on an i386 host. Just look at
> tcg/*/tcg-target.c, especially 64-bit hosts.

Forward-looking (if that makes any sense for TCG) the parameters
can also be used for FP temps.


Laurent

>>
>> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
>> index 972b102..484f476 100644
>> --- a/tcg/i386/tcg-target.c
>> +++ b/tcg/i386/tcg-target.c
>> @@ -262,14 +262,14 @@ static inline void tcg_out_movi(TCGContext *s,
>> TCGType type,
>>      }
>>  }
>>
>> -static inline void tcg_out_ld(TCGContext *s, TCGType type, int ret,
>> +static inline void tcg_out_ld(TCGContext *s, int ret,
>>                                int arg1, tcg_target_long arg2)
>>  {
>>      /* movl */
>>      tcg_out_modrm_offset(s, 0x8b, ret, arg1, arg2);
>>  }
>>
>> -static inline void tcg_out_st(TCGContext *s, TCGType type, int arg,
>> +static inline void tcg_out_st(TCGContext *s, int arg,
>>                                int arg1, tcg_target_long arg2)
>>  {
>>      /* movl */
>> diff --git a/tcg/tcg.c b/tcg/tcg.c
>> index 3c0e296..abed1c3 100644
>> --- a/tcg/tcg.c
>> +++ b/tcg/tcg.c
>> @@ -1333,7 +1333,7 @@ static void tcg_reg_free(TCGContext *s, int reg)
>>          if (!ts->mem_coherent) {
>>              if (!ts->mem_allocated)
>>                  temp_allocate_frame(s, temp);
>> -            tcg_out_st(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
>> +            tcg_out_st(s, reg, ts->mem_reg, ts->mem_offset);
>>          }
>>          ts->val_type = TEMP_VAL_MEM;
>>          s->reg_to_temp[reg] = -1;
>> @@ -1389,7 +1389,7 @@ static void temp_save(TCGContext *s, int temp,
>> TCGRegSet allocated_regs)
>>              if (!ts->mem_allocated)
>>                  temp_allocate_frame(s, temp);
>>              tcg_out_movi(s, ts->type, reg, ts->val);
>> -            tcg_out_st(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
>> +            tcg_out_st(s, reg, ts->mem_reg, ts->mem_offset);
>>              ts->val_type = TEMP_VAL_MEM;
>>              break;
>>          case TEMP_VAL_MEM:
>> @@ -1494,7 +1494,7 @@ static void tcg_reg_alloc_mov(TCGContext *s,
>> const TCGOpDef *def,
>>          } else {
>>              reg = tcg_reg_alloc(s, arg_ct->u.regs, s->reserved_regs);
>>          }
>> -        tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
>> +        tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
>>      } else if (ts->val_type == TEMP_VAL_CONST) {
>>          if (ots->fixed_reg) {
>>              reg = ots->reg;
>> @@ -1546,7 +1546,7 @@ static void tcg_reg_alloc_op(TCGContext *s,
>>          ts = &s->temps[arg];
>>          if (ts->val_type == TEMP_VAL_MEM) {
>>              reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs);
>> -            tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
>> +            tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
>>              ts->val_type = TEMP_VAL_REG;
>>              ts->reg = reg;
>>              ts->mem_coherent = 1;
>> @@ -1726,19 +1726,19 @@ static int tcg_reg_alloc_call(TCGContext *s,
>> const TCGOpDef *def,
>>          if (arg != TCG_CALL_DUMMY_ARG) {
>>              ts = &s->temps[arg];
>>              if (ts->val_type == TEMP_VAL_REG) {
>> -                tcg_out_st(s, ts->type, ts->reg, TCG_REG_CALL_STACK,
>> stack_offset);
>> +                tcg_out_st(s, ts->reg, TCG_REG_CALL_STACK, stack_offset);
>>              } else if (ts->val_type == TEMP_VAL_MEM) {
>>                  reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type],
>>                                      s->reserved_regs);
>>                  /* XXX: not correct if reading values from the stack */
>> -                tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
>> -                tcg_out_st(s, ts->type, reg, TCG_REG_CALL_STACK, stack_offset);
>> +                tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
>> +                tcg_out_st(s, reg, TCG_REG_CALL_STACK, stack_offset);
>>              } else if (ts->val_type == TEMP_VAL_CONST) {
>>                  reg = tcg_reg_alloc(s, tcg_target_available_regs[ts->type],
>>                                      s->reserved_regs);
>>                  /* XXX: sign extend may be needed on some targets */
>>                  tcg_out_movi(s, ts->type, reg, ts->val);
>> -                tcg_out_st(s, ts->type, reg, TCG_REG_CALL_STACK, stack_offset);
>> +                tcg_out_st(s, reg, TCG_REG_CALL_STACK, stack_offset);
>>              } else {
>>                  tcg_abort();
>>              }
>> @@ -1761,7 +1761,7 @@ static int tcg_reg_alloc_call(TCGContext *s,
>> const TCGOpDef *def,
>>                      tcg_out_mov(s, reg, ts->reg);
>>                  }
>>              } else if (ts->val_type == TEMP_VAL_MEM) {
>> -                tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
>> +                tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
>>              } else if (ts->val_type == TEMP_VAL_CONST) {
>>                  /* XXX: sign extend ? */
>>                  tcg_out_movi(s, ts->type, reg, ts->val);
>> @@ -1780,7 +1780,7 @@ static int tcg_reg_alloc_call(TCGContext *s,
>> const TCGOpDef *def,
>>      const_func_arg = 0;
>>      if (ts->val_type == TEMP_VAL_MEM) {
>>          reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs);
>> -        tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
>> +        tcg_out_ld(s, reg, ts->mem_reg, ts->mem_offset);
>>          func_arg = reg;
>>          tcg_regset_set_reg(allocated_regs, reg);
>>      } else if (ts->val_type == TEMP_VAL_REG) {
>>
>>
>>
>
> --
> Aurelien Jarno                          GPG: 1024D/F1BCDB73
> aurelien@aurel32.net                 http://www.aurel32.net
>
>
>
diff mbox

Patch

diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index 972b102..484f476 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -262,14 +262,14 @@  static inline void tcg_out_movi(TCGContext *s,
TCGType type,
     }
 }

-static inline void tcg_out_ld(TCGContext *s, TCGType type, int ret,
+static inline void tcg_out_ld(TCGContext *s, int ret,
                               int arg1, tcg_target_long arg2)
 {
     /* movl */
     tcg_out_modrm_offset(s, 0x8b, ret, arg1, arg2);
 }

-static inline void tcg_out_st(TCGContext *s, TCGType type, int arg,
+static inline void tcg_out_st(TCGContext *s, int arg,
                               int arg1, tcg_target_long arg2)
 {
     /* movl */
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 3c0e296..abed1c3 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1333,7 +1333,7 @@  static void tcg_reg_free(TCGContext *s, int reg)
         if (!ts->mem_coherent) {
             if (!ts->mem_allocated)
                 temp_allocate_frame(s, temp);
-            tcg_out_st(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
+            tcg_out_st(s, reg, ts->mem_reg, ts->mem_offset);
         }
         ts->val_type = TEMP_VAL_MEM;
         s->reg_to_temp[reg] = -1;
@@ -1389,7 +1389,7 @@  static void temp_save(TCGContext *s, int temp,
TCGRegSet allocated_regs)
             if (!ts->mem_allocated)
                 temp_allocate_frame(s, temp);
             tcg_out_movi(s, ts->type, reg, ts->val);
-            tcg_out_st(s, ts->type, reg, ts->mem_reg, ts->mem_offset);
+            tcg_out_st(s, reg, ts->mem_reg, ts->mem_offset);
             ts->val_type = TEMP_VAL_MEM;
             break;