mirror of https://github.com/proxmox/mirror_qemu
tcg/optimize: Split out copy_propagate
Continue splitting tcg_optimize. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> 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>master
parent
e2577ea24f
commit
8774dded02
|
@ -611,6 +611,19 @@ static void init_arguments(OptContext *ctx, TCGOp *op, int nb_args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void copy_propagate(OptContext *ctx, TCGOp *op,
|
||||||
|
int nb_oargs, int nb_iargs)
|
||||||
|
{
|
||||||
|
TCGContext *s = ctx->tcg;
|
||||||
|
|
||||||
|
for (int i = nb_oargs; i < nb_oargs + nb_iargs; i++) {
|
||||||
|
TCGTemp *ts = arg_temp(op->args[i]);
|
||||||
|
if (ts && ts_is_copy(ts)) {
|
||||||
|
op->args[i] = temp_arg(find_better_copy(s, ts));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Propagate constants and copies, fold constant expressions. */
|
/* Propagate constants and copies, fold constant expressions. */
|
||||||
void tcg_optimize(TCGContext *s)
|
void tcg_optimize(TCGContext *s)
|
||||||
{
|
{
|
||||||
|
@ -646,14 +659,7 @@ void tcg_optimize(TCGContext *s)
|
||||||
nb_iargs = def->nb_iargs;
|
nb_iargs = def->nb_iargs;
|
||||||
}
|
}
|
||||||
init_arguments(&ctx, op, nb_oargs + nb_iargs);
|
init_arguments(&ctx, op, nb_oargs + nb_iargs);
|
||||||
|
copy_propagate(&ctx, op, nb_oargs, nb_iargs);
|
||||||
/* Do copy propagation */
|
|
||||||
for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) {
|
|
||||||
TCGTemp *ts = arg_temp(op->args[i]);
|
|
||||||
if (ts && ts_is_copy(ts)) {
|
|
||||||
op->args[i] = temp_arg(find_better_copy(s, ts));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For commutative operations make constant second argument */
|
/* For commutative operations make constant second argument */
|
||||||
switch (opc) {
|
switch (opc) {
|
||||||
|
|
Loading…
Reference in New Issue