/* Generic partial redundancy elimination with lazy code motion support.
- Copyright (C) 1998-2015 Free Software Foundation, Inc.
+ Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of GCC.
#include "system.h"
#include "coretypes.h"
#include "backend.h"
-#include "rtl.h"
-#include "regs.h"
-#include "flags.h"
-#include "insn-config.h"
-#include "recog.h"
#include "cfganal.h"
#include "lcm.h"
-#include "tm_p.h"
-#include "dumpfile.h"
/* Edge based LCM routines. */
static void compute_antinout_edge (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
sbitmap *antout, sbitmap *avout, sbitmap *kill,
sbitmap *earliest)
{
- sbitmap difference, temp_bitmap;
int x, num_edges;
basic_block pred, succ;
num_edges = NUM_EDGES (edge_list);
- difference = sbitmap_alloc (n_exprs);
- temp_bitmap = sbitmap_alloc (n_exprs);
-
+ auto_sbitmap difference (n_exprs), temp_bitmap (n_exprs);
for (x = 0; x < num_edges; x++)
{
pred = INDEX_EDGE_PRED_BB (edge_list, x);
}
}
}
-
- sbitmap_free (temp_bitmap);
- sbitmap_free (difference);
}
/* later(p,s) is dependent on the calculation of laterin(p).
/* Add all the blocks to the worklist. This prevents an early exit from
the loop given our optimistic initialization of LATER above. */
- int *postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
- int postorder_num = inverted_post_order_compute (postorder);
- for (int i = 0; i < postorder_num; ++i)
+ auto_vec<int, 20> postorder;
+ inverted_post_order_compute (&postorder);
+ for (unsigned int i = 0; i < postorder.length (); ++i)
{
bb = BASIC_BLOCK_FOR_FN (cfun, postorder[i]);
if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
*qin++ = bb;
bb->aux = bb;
}
- free (postorder);
/* Note that we do not use the last allocated element for our queue,
as EXIT_BLOCK is never inserted into it. */
/* Put every block on the worklist; this is necessary because of the
optimistic initialization of AVOUT above. Use inverted postorder
to make the dataflow problem require less iterations. */
- int *postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
- int postorder_num = inverted_post_order_compute (postorder);
- for (int i = 0; i < postorder_num; ++i)
+ auto_vec<int, 20> postorder;
+ inverted_post_order_compute (&postorder);
+ for (unsigned int i = 0; i < postorder.length (); ++i)
{
bb = BASIC_BLOCK_FOR_FN (cfun, postorder[i]);
if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
*qin++ = bb;
bb->aux = bb;
}
- free (postorder);
qin = worklist;
qend = &worklist[n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS];
sbitmap *st_avout, sbitmap *st_avin, sbitmap *st_antin,
sbitmap *kill, sbitmap *farthest)
{
- sbitmap difference, temp_bitmap;
int x, num_edges;
basic_block pred, succ;
num_edges = NUM_EDGES (edge_list);
- difference = sbitmap_alloc (n_exprs);
- temp_bitmap = sbitmap_alloc (n_exprs);
-
+ auto_sbitmap difference (n_exprs), temp_bitmap (n_exprs);
for (x = 0; x < num_edges; x++)
{
pred = INDEX_EDGE_PRED_BB (edge_list, x);
}
}
}
-
- sbitmap_free (temp_bitmap);
- sbitmap_free (difference);
}
/* Compute nearer and nearerout vectors for edge based lcm.