summaryrefslogtreecommitdiff
path: root/gcc/ira.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-08 06:29:12 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-08 06:29:12 +0000
commit1076ab348c61447489e673d5f1bbd97523e42aa8 (patch)
tree85ff7b9a2224e6cc10cb44bcc6599cb4bdc69a5b /gcc/ira.c
parent7d75ffa3722405a3befff005c300edaa6f6acd02 (diff)
downloadgcc-1076ab348c61447489e673d5f1bbd97523e42aa8.tar.gz
PR middle-end/54146
* ira.c (init_live_subregs): Take live_subregs_used as a bitmap. (build_insn_chain): Make live_subregs_used a bitmap. Use SBITMAP_SIZE to ignore the paradoxical bytes of subregs. Use sbitmap_free to free the live_subreg sbitmaps. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190223 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ira.c')
-rw-r--r--gcc/ira.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/gcc/ira.c b/gcc/ira.c
index 3825498bc67..6699d2bacf7 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3251,7 +3251,7 @@ pseudo_for_reload_consideration_p (int regno)
initialization. ALLOCNUM need not be the regno of REG. */
static void
init_live_subregs (bool init_value, sbitmap *live_subregs,
- int *live_subregs_used, int allocnum, rtx reg)
+ bitmap live_subregs_used, int allocnum, rtx reg)
{
unsigned int regno = REGNO (SUBREG_REG (reg));
int size = GET_MODE_SIZE (GET_MODE (regno_reg_rtx[regno]));
@@ -3259,10 +3259,10 @@ init_live_subregs (bool init_value, sbitmap *live_subregs,
gcc_assert (size > 0);
/* Been there, done that. */
- if (live_subregs_used[allocnum])
+ if (bitmap_bit_p (live_subregs_used, allocnum))
return;
- /* Create a new one with zeros. */
+ /* Create a new one. */
if (live_subregs[allocnum] == NULL)
live_subregs[allocnum] = sbitmap_alloc (size);
@@ -3273,8 +3273,7 @@ init_live_subregs (bool init_value, sbitmap *live_subregs,
else
sbitmap_zero (live_subregs[allocnum]);
- /* Set the number of bits that we really want. */
- live_subregs_used[allocnum] = size;
+ bitmap_set_bit (live_subregs_used, allocnum);
}
/* Walk the insns of the current function and build reload_insn_chain,
@@ -3293,11 +3292,11 @@ build_insn_chain (void)
which hardregs are live in multiword pseudos. live_subregs and
live_subregs_used are indexed by pseudo number. The live_subreg
entry for a particular pseudo is only used if the corresponding
- element is non zero in live_subregs_used. The value in
- live_subregs_used is number of bytes that the pseudo can
+ element is non zero in live_subregs_used. The sbitmap size of
+ live_subreg[allocno] is number of bytes that the pseudo can
occupy. */
sbitmap *live_subregs = XCNEWVEC (sbitmap, max_regno);
- int *live_subregs_used = XNEWVEC (int, max_regno);
+ bitmap live_subregs_used = BITMAP_ALLOC (NULL);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (eliminable_regset, i))
@@ -3308,7 +3307,7 @@ build_insn_chain (void)
rtx insn;
CLEAR_REG_SET (live_relevant_regs);
- memset (live_subregs_used, 0, max_regno * sizeof (int));
+ bitmap_clear (live_subregs_used);
EXECUTE_IF_SET_IN_BITMAP (DF_LR_OUT (bb), 0, i, bi)
{
@@ -3393,8 +3392,8 @@ build_insn_chain (void)
}
/* Ignore the paradoxical bits. */
- if ((int)last > live_subregs_used[regno])
- last = live_subregs_used[regno];
+ if (last > SBITMAP_SIZE (live_subregs[regno]))
+ last = SBITMAP_SIZE (live_subregs[regno]);
while (start < last)
{
@@ -3404,7 +3403,7 @@ build_insn_chain (void)
if (sbitmap_empty_p (live_subregs[regno]))
{
- live_subregs_used[regno] = 0;
+ bitmap_clear_bit (live_subregs_used, regno);
bitmap_clear_bit (live_relevant_regs, regno);
}
else
@@ -3422,8 +3421,8 @@ build_insn_chain (void)
modeling the def as a killing def. */
if (!DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL))
{
+ bitmap_clear_bit (live_subregs_used, regno);
bitmap_clear_bit (live_relevant_regs, regno);
- live_subregs_used[regno] = 0;
}
}
}
@@ -3479,8 +3478,8 @@ build_insn_chain (void)
live_subregs, live_subregs_used, regno, reg);
/* Ignore the paradoxical bits. */
- if ((int)last > live_subregs_used[regno])
- last = live_subregs_used[regno];
+ if (last > SBITMAP_SIZE (live_subregs[regno]))
+ last = SBITMAP_SIZE (live_subregs[regno]);
while (start < last)
{
@@ -3493,7 +3492,7 @@ build_insn_chain (void)
effectively saying do not use the subregs
because we are reading the whole
pseudo. */
- live_subregs_used[regno] = 0;
+ bitmap_clear_bit (live_subregs_used, regno);
bitmap_set_bit (live_relevant_regs, regno);
}
}
@@ -3536,14 +3535,14 @@ build_insn_chain (void)
}
}
- for (i = 0; i < (unsigned int) max_regno; i++)
- free (live_subregs[i]);
-
reload_insn_chain = c;
*p = NULL;
+ for (i = 0; i < (unsigned int) max_regno; i++)
+ if (live_subregs[i] != NULL)
+ sbitmap_free (live_subregs[i]);
free (live_subregs);
- free (live_subregs_used);
+ BITMAP_FREE (live_subregs_used);
BITMAP_FREE (live_relevant_regs);
BITMAP_FREE (elim_regset);