mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
tcg: Dynamically allocate TCGOps
With no fixed array allocation, we can't overflow a buffer. This will be important as optimizations related to host vectors may expand the number of ops used. Use QTAILQ to link the ops together. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
f764718d0c
commit
15fa08f845
12 changed files with 78 additions and 158 deletions
|
@ -602,8 +602,8 @@ static bool swap_commutative2(TCGArg *p1, TCGArg *p2)
|
|||
/* Propagate constants and copies, fold constant expressions. */
|
||||
void tcg_optimize(TCGContext *s)
|
||||
{
|
||||
int oi, oi_next, nb_temps, nb_globals;
|
||||
TCGOp *prev_mb = NULL;
|
||||
int nb_temps, nb_globals;
|
||||
TCGOp *op, *op_next, *prev_mb = NULL;
|
||||
struct tcg_temp_info *infos;
|
||||
TCGTempSet temps_used;
|
||||
|
||||
|
@ -617,17 +617,13 @@ void tcg_optimize(TCGContext *s)
|
|||
bitmap_zero(temps_used.l, nb_temps);
|
||||
infos = tcg_malloc(sizeof(struct tcg_temp_info) * nb_temps);
|
||||
|
||||
for (oi = s->gen_op_buf[0].next; oi != 0; oi = oi_next) {
|
||||
QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) {
|
||||
tcg_target_ulong mask, partmask, affected;
|
||||
int nb_oargs, nb_iargs, i;
|
||||
TCGArg tmp;
|
||||
|
||||
TCGOp * const op = &s->gen_op_buf[oi];
|
||||
TCGOpcode opc = op->opc;
|
||||
const TCGOpDef *def = &tcg_op_defs[opc];
|
||||
|
||||
oi_next = op->next;
|
||||
|
||||
/* Count the arguments, and initialize the temps that are
|
||||
going to be used */
|
||||
if (opc == INDEX_op_call) {
|
||||
|
@ -1261,9 +1257,6 @@ void tcg_optimize(TCGContext *s)
|
|||
rh = op->args[1];
|
||||
tcg_opt_gen_movi(s, op, rl, (int32_t)a);
|
||||
tcg_opt_gen_movi(s, op2, rh, (int32_t)(a >> 32));
|
||||
|
||||
/* We've done all we need to do with the movi. Skip it. */
|
||||
oi_next = op2->next;
|
||||
break;
|
||||
}
|
||||
goto do_default;
|
||||
|
@ -1280,9 +1273,6 @@ void tcg_optimize(TCGContext *s)
|
|||
rh = op->args[1];
|
||||
tcg_opt_gen_movi(s, op, rl, (int32_t)r);
|
||||
tcg_opt_gen_movi(s, op2, rh, (int32_t)(r >> 32));
|
||||
|
||||
/* We've done all we need to do with the movi. Skip it. */
|
||||
oi_next = op2->next;
|
||||
break;
|
||||
}
|
||||
goto do_default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue