static int nonlocal_set_p_1 (rtx *, void *);
static int nonlocal_set_p (rtx);
static void memory_modified_1 (rtx, rtx, void *);
+static void record_alias_subset (HOST_WIDE_INT, HOST_WIDE_INT);
/* Set up all info needed to perform alias analysis on memory references. */
static inline int
mems_in_disjoint_alias_sets_p (rtx mem1, rtx mem2)
{
-#ifdef ENABLE_CHECKING
/* Perform a basic sanity check. Namely, that there are no alias sets
if we're not using strict aliasing. This helps to catch bugs
whereby someone uses PUT_CODE, but doesn't clear MEM_ALIAS_SET, or
gen_rtx_MEM, and the MEM_ALIAS_SET is not cleared. If we begin to
use alias sets to indicate that spilled registers cannot alias each
other, we might need to remove this check. */
- if (! flag_strict_aliasing
- && (MEM_ALIAS_SET (mem1) != 0 || MEM_ALIAS_SET (mem2) != 0))
- abort ();
-#endif
+ gcc_assert (flag_strict_aliasing
+ || (!MEM_ALIAS_SET (mem1) && !MEM_ALIAS_SET (mem2)));
return ! alias_sets_conflict_p (MEM_ALIAS_SET (mem1), MEM_ALIAS_SET (mem2));
}
static tree
find_base_decl (tree t)
{
- tree d0, d1, d2;
+ tree d0, d1;
if (t == 0 || t == error_mark_node || ! POINTER_TYPE_P (TREE_TYPE (t)))
return 0;
/* If this is a declaration, return it. */
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 'd')
+ if (DECL_P (t))
return t;
/* Handle general expressions. It would be nice to deal with
same, then `a->f' and `b->f' are also the same. */
switch (TREE_CODE_CLASS (TREE_CODE (t)))
{
- case '1':
+ case tcc_unary:
return find_base_decl (TREE_OPERAND (t, 0));
- case '2':
+ case tcc_binary:
/* Return 0 if found in neither or both are the same. */
d0 = find_base_decl (TREE_OPERAND (t, 0));
d1 = find_base_decl (TREE_OPERAND (t, 1));
else
return 0;
- case '3':
- d0 = find_base_decl (TREE_OPERAND (t, 0));
- d1 = find_base_decl (TREE_OPERAND (t, 1));
- d2 = find_base_decl (TREE_OPERAND (t, 2));
-
- /* Set any nonzero values from the last, then from the first. */
- if (d1 == 0) d1 = d2;
- if (d0 == 0) d0 = d1;
- if (d1 == 0) d1 = d0;
- if (d2 == 0) d2 = d1;
-
- /* At this point all are nonzero or all are zero. If all three are the
- same, return it. Otherwise, return zero. */
- return (d0 == d1 && d1 == d2) ? d0 : 0;
-
default:
return 0;
}
}
/* Check for accesses through restrict-qualified pointers. */
- if (TREE_CODE (inner) == INDIRECT_REF)
+ if (INDIRECT_REF_P (inner))
{
tree decl = find_base_decl (TREE_OPERAND (inner, 0));
type, then we would believe that other subsets
of the pointed-to type (such as fields of that
type) do not conflict with the type pointed to
- by the restricted pointer. */
+ by the restricted pointer. */
DECL_POINTER_ALIAS_SET (decl)
= pointed_to_alias_set;
else
It is illegal for SUPERSET to be zero; everything is implicitly a
subset of alias set zero. */
-void
+static void
record_alias_subset (HOST_WIDE_INT superset, HOST_WIDE_INT subset)
{
alias_set_entry superset_entry;
if (superset == subset)
return;
- if (superset == 0)
- abort ();
+ gcc_assert (superset);
superset_entry = get_alias_set_entry (superset);
if (superset_entry == 0)
regno = REGNO (dest);
- if (regno >= VARRAY_SIZE (reg_base_value))
- abort ();
+ gcc_assert (regno < VARRAY_SIZE (reg_base_value));
/* If this spans multiple hard registers, then we must indicate that every
register has an unusable value. */
contain anything but integers and other rtx's,
except for within LABEL_REFs and SYMBOL_REFs. */
default:
- abort ();
+ gcc_unreachable ();
}
}
return 1;
where SIZE is the size in bytes of the memory reference. If ADDR
is not modified by the memory reference then ADDR is returned. */
-rtx
+static rtx
addr_side_effect_eval (rtx addr, int size, int n_refs)
{
int offset = 0;
moffsetx = adjust_offset_for_component_ref (exprx, moffsetx);
exprx = t;
}
- else if (TREE_CODE (exprx) == INDIRECT_REF)
+ else if (INDIRECT_REF_P (exprx))
{
exprx = TREE_OPERAND (exprx, 0);
if (flag_argument_noalias < 2
moffsety = adjust_offset_for_component_ref (expry, moffsety);
expry = t;
}
- else if (TREE_CODE (expry) == INDIRECT_REF)
+ else if (INDIRECT_REF_P (expry))
{
expry = TREE_OPERAND (expry, 0);
if (flag_argument_noalias < 2
/* Return true when INSN possibly modify memory contents of MEM
- (ie address can be modified). */
+ (i.e. address can be modified). */
bool
memory_modified_in_insn_p (rtx mem, rtx insn)
{
new_reg_base_value = xmalloc (maxreg * sizeof (rtx));
reg_seen = xmalloc (maxreg);
- if (! reload_completed && flag_old_unroll_loops)
- {
- alias_invariant = ggc_calloc (maxreg, sizeof (rtx));
- alias_invariant_size = maxreg;
- }
/* The basic idea is that each pass through this loop will use the
"constant" information from the previous pass to propagate alias
}
/* Now propagate values from new_reg_base_value to reg_base_value. */
- if (maxreg != (unsigned int) max_reg_num())
- abort ();
+ gcc_assert (maxreg == (unsigned int) max_reg_num());
+
for (ui = 0; ui < maxreg; ui++)
{
if (new_reg_base_value[ui]