aboutsummaryrefslogtreecommitdiff
path: root/tcg/optimize.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2011-07-30 19:18:32 +0000
committerBlue Swirl <blauwirbel@gmail.com>2011-08-28 07:17:27 +0000
commitfe0de7aa5ecb8917acb181eea6e5c29657c8c36c (patch)
tree52a550ac8151b22d0beb35587e48951e5d80fde4 /tcg/optimize.c
parente5b34f37793dc239c2f65442046e12a5dd7b61ec (diff)
TCG: improve optimizer debugging
Use enum TCGOpcode instead of plain old int so that the name of current op can be seen in GDB. Add a default case to switch so that GCC does not complain about unhandled enum cases. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'tcg/optimize.c')
-rw-r--r--tcg/optimize.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 7e7f2b2020..9c65474a8c 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -87,13 +87,13 @@ static void reset_temp(TCGArg temp, int nb_temps, int nb_globals)
}
}
-static int op_bits(enum TCGOpcode op)
+static int op_bits(TCGOpcode op)
{
const TCGOpDef *def = &tcg_op_defs[op];
return def->flags & TCG_OPF_64BIT ? 64 : 32;
}
-static int op_to_movi(int op)
+static TCGOpcode op_to_movi(TCGOpcode op)
{
switch (op_bits(op)) {
case 32:
@@ -143,7 +143,7 @@ static void tcg_opt_gen_movi(TCGArg *gen_args, TCGArg dst, TCGArg val,
gen_args[1] = val;
}
-static int op_to_mov(int op)
+static TCGOpcode op_to_mov(TCGOpcode op)
{
switch (op_bits(op)) {
case 32:
@@ -157,7 +157,7 @@ static int op_to_mov(int op)
}
}
-static TCGArg do_constant_folding_2(int op, TCGArg x, TCGArg y)
+static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y)
{
switch (op) {
CASE_OP_32_64(add):
@@ -258,7 +258,7 @@ static TCGArg do_constant_folding_2(int op, TCGArg x, TCGArg y)
}
}
-static TCGArg do_constant_folding(int op, TCGArg x, TCGArg y)
+static TCGArg do_constant_folding(TCGOpcode op, TCGArg x, TCGArg y)
{
TCGArg res = do_constant_folding_2(op, x, y);
if (op_bits(op) == 32) {
@@ -271,7 +271,8 @@ static TCGArg do_constant_folding(int op, TCGArg x, TCGArg y)
static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
TCGArg *args, TCGOpDef *tcg_op_defs)
{
- int i, nb_ops, op_index, op, nb_temps, nb_globals, nb_call_args;
+ int i, nb_ops, op_index, nb_temps, nb_globals, nb_call_args;
+ TCGOpcode op;
const TCGOpDef *def;
TCGArg *gen_args;
TCGArg tmp;
@@ -377,6 +378,8 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
continue;
}
break;
+ default:
+ break;
}
/* Propagate constants through copy operations and do constant