mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 02:54:58 -06:00
tcg/optimize: Split out fold_mov
This is the final entry in the main switch that was in a different form. After this, we have the option to convert the switch into a function dispatch table. Reviewed-by: Luis Pires <luis.pires@eldorado.org.br> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
8cdb3fcb8e
commit
2cfac7fa48
1 changed files with 14 additions and 13 deletions
|
@ -1015,6 +1015,11 @@ static bool fold_mb(OptContext *ctx, TCGOp *op)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool fold_mov(OptContext *ctx, TCGOp *op)
|
||||||
|
{
|
||||||
|
return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
static bool fold_movcond(OptContext *ctx, TCGOp *op)
|
static bool fold_movcond(OptContext *ctx, TCGOp *op)
|
||||||
{
|
{
|
||||||
TCGOpcode opc = op->opc;
|
TCGOpcode opc = op->opc;
|
||||||
|
@ -1748,20 +1753,11 @@ void tcg_optimize(TCGContext *s)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Propagate constants through copy operations and do constant
|
/*
|
||||||
folding. Constants will be substituted to arguments by register
|
* Process each opcode.
|
||||||
allocator where needed and possible. Also detect copies. */
|
* Sorted alphabetically by opcode as much as possible.
|
||||||
|
*/
|
||||||
switch (opc) {
|
switch (opc) {
|
||||||
CASE_OP_32_64_VEC(mov):
|
|
||||||
done = tcg_opt_gen_mov(&ctx, op, op->args[0], op->args[1]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------- */
|
|
||||||
/* Sorted alphabetically by opcode as much as possible. */
|
|
||||||
|
|
||||||
CASE_OP_32_64_VEC(add):
|
CASE_OP_32_64_VEC(add):
|
||||||
done = fold_add(&ctx, op);
|
done = fold_add(&ctx, op);
|
||||||
break;
|
break;
|
||||||
|
@ -1831,6 +1827,9 @@ void tcg_optimize(TCGContext *s)
|
||||||
case INDEX_op_mb:
|
case INDEX_op_mb:
|
||||||
done = fold_mb(&ctx, op);
|
done = fold_mb(&ctx, op);
|
||||||
break;
|
break;
|
||||||
|
CASE_OP_32_64_VEC(mov):
|
||||||
|
done = fold_mov(&ctx, op);
|
||||||
|
break;
|
||||||
CASE_OP_32_64(movcond):
|
CASE_OP_32_64(movcond):
|
||||||
done = fold_movcond(&ctx, op);
|
done = fold_movcond(&ctx, op);
|
||||||
break;
|
break;
|
||||||
|
@ -1900,6 +1899,8 @@ void tcg_optimize(TCGContext *s)
|
||||||
CASE_OP_32_64_VEC(xor):
|
CASE_OP_32_64_VEC(xor):
|
||||||
done = fold_xor(&ctx, op);
|
done = fold_xor(&ctx, op);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done) {
|
if (!done) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue