summaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index de2a25b07c8..9c2801d3c35 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -841,18 +841,18 @@ loop_optimize (rtx f, FILE *dumpfile, int flags)
Leave some space for labels allocated by find_and_verify_loops. */
max_uid_for_loop = get_max_uid () + 1 + max_loop_num * 32;
- uid_luid = xcalloc (max_uid_for_loop, sizeof (int));
- uid_loop = xcalloc (max_uid_for_loop, sizeof (struct loop *));
+ uid_luid = XCNEWVEC (int, max_uid_for_loop);
+ uid_loop = XCNEWVEC (struct loop *, max_uid_for_loop);
/* Allocate storage for array of loops. */
- loops->array = xcalloc (loops->num, sizeof (struct loop));
+ loops->array = XCNEWVEC (struct loop, loops->num);
/* Find and process each loop.
First, find them, and record them in order of their beginnings. */
find_and_verify_loops (f, loops);
/* Allocate and initialize auxiliary loop information. */
- loops_info = xcalloc (loops->num, sizeof (struct loop_info));
+ loops_info = XCNEWVEC (struct loop_info, loops->num);
for (i = 0; i < (int) loops->num; i++)
loops->array[i].aux = loops_info + i;
@@ -1328,7 +1328,7 @@ scan_loop (struct loop *loop, int flags)
continue;
}
- m = xmalloc (sizeof (struct movable));
+ m = XNEW (struct movable);
m->next = 0;
m->insn = p;
m->set_src = src;
@@ -1416,7 +1416,7 @@ scan_loop (struct loop *loop, int flags)
if (regs->array[regno].set_in_loop == 2)
{
struct movable *m;
- m = xmalloc (sizeof (struct movable));
+ m = XNEW (struct movable);
m->next = 0;
m->insn = p;
m->set_dest = SET_DEST (set);
@@ -1853,7 +1853,7 @@ static void
combine_movables (struct loop_movables *movables, struct loop_regs *regs)
{
struct movable *m;
- char *matched_regs = xmalloc (regs->num);
+ char *matched_regs = XNEWVEC (char, regs->num);
enum machine_mode mode;
/* Regs that are set more than once are not allowed to match
@@ -2188,8 +2188,8 @@ move_movables (struct loop *loop, struct loop_movables *movables,
/* Map of pseudo-register replacements to handle combining
when we move several insns that load the same value
into different pseudo-registers. */
- rtx *reg_map = xcalloc (nregs, sizeof (rtx));
- char *already_moved = xcalloc (nregs, sizeof (char));
+ rtx *reg_map = XCNEWVEC (rtx, nregs);
+ char *already_moved = XCNEWVEC (char, nregs);
for (m = movables->head; m; m = m->next)
{
@@ -2537,8 +2537,7 @@ move_movables (struct loop *loop, struct loop_movables *movables,
}
else if (m->insert_temp)
{
- rtx *reg_map2 = xcalloc (REGNO (newreg),
- sizeof(rtx));
+ rtx *reg_map2 = XCNEWVEC (rtx, REGNO(newreg));
reg_map2 [m->regno] = newreg;
i1 = loop_insn_hoist (loop, copy_rtx (PATTERN (p)));
@@ -6382,7 +6381,7 @@ strength_reduce (struct loop *loop, int flags)
addr_placeholder = gen_reg_rtx (Pmode);
ivs->n_regs = max_reg_before_loop;
- ivs->regs = xcalloc (ivs->n_regs, sizeof (struct iv));
+ ivs->regs = XCNEWVEC (struct iv, ivs->n_regs);
/* Find all BIVs in loop. */
loop_bivs_find (loop);
@@ -6431,7 +6430,7 @@ strength_reduce (struct loop *loop, int flags)
Some givs might have been made from biv increments, so look at
ivs->reg_iv_type for a suitable size. */
reg_map_size = ivs->n_regs;
- reg_map = xcalloc (reg_map_size, sizeof (rtx));
+ reg_map = XCNEWVEC (rtx, reg_map_size);
/* Examine each iv class for feasibility of strength reduction/induction
variable elimination. */
@@ -6649,7 +6648,7 @@ check_insn_for_bivs (struct loop *loop, rtx p, int not_every_iteration,
/* It is a possible basic induction variable.
Create and initialize an induction structure for it. */
- struct induction *v = xmalloc (sizeof (struct induction));
+ struct induction *v = XNEW (struct induction);
record_biv (loop, v, p, dest_reg, inc_val, mult_val, location,
not_every_iteration, maybe_multiple);
@@ -6712,7 +6711,7 @@ check_insn_for_givs (struct loop *loop, rtx p, int not_every_iteration,
&add_val, &mult_val, &ext_val,
&last_consec_insn))))
{
- struct induction *v = xmalloc (sizeof (struct induction));
+ struct induction *v = XNEW (struct induction);
/* If this is a library call, increase benefit. */
if (find_reg_note (p, REG_RETVAL, NULL_RTX))
@@ -6828,7 +6827,7 @@ find_mem_givs (const struct loop *loop, rtx x, rtx insn,
GET_MODE (x)))
{
/* Found one; record it. */
- struct induction *v = xmalloc (sizeof (struct induction));
+ struct induction *v = XNEW (struct induction);
record_giv (loop, v, insn, src_reg, addr_placeholder, mult_val,
add_val, ext_val, benefit, DEST_ADDR,
@@ -6901,7 +6900,7 @@ record_biv (struct loop *loop, struct induction *v, rtx insn, rtx dest_reg,
{
/* Create and initialize new iv_class. */
- bl = xmalloc (sizeof (struct iv_class));
+ bl = XNEW (struct iv_class);
bl->regno = REGNO (dest_reg);
bl->biv = 0;
@@ -9024,8 +9023,8 @@ combine_givs (struct loop_regs *regs, struct iv_class *bl)
if (!g1->ignore)
giv_array[i++] = g1;
- stats = xcalloc (giv_count, sizeof (*stats));
- can_combine = xcalloc (giv_count, giv_count * sizeof (rtx));
+ stats = XCNEWVEC (struct combine_givs_stats, giv_count);
+ can_combine = XCNEWVEC (rtx, giv_count * giv_count);
for (i = 0; i < giv_count; i++)
{
@@ -10617,7 +10616,7 @@ loop_regs_scan (const struct loop *loop, int extra_size)
regs->array[i].single_usage = NULL_RTX;
}
- last_set = xcalloc (regs->num, sizeof (rtx));
+ last_set = XCNEWVEC (rtx, regs->num);
/* Scan the loop, recording register usage. */
for (insn = loop->top ? loop->top : loop->start; insn != loop->end;