/* The alias set number, as stored in MEM_ALIAS_SET. */
alias_set_type alias_set;
+ /* Nonzero if would have a child of zero: this effectively makes this
+ alias set the same as alias set zero. */
+ int has_zero_child;
+
/* The children of the alias set. These are not just the immediate
children, but, in fact, all descendants. So, if we have:
continuing our example above, the children here will be all of
`int', `double', `float', and `struct S'. */
splay_tree GTY((param1_is (int), param2_is (int))) children;
-
- /* Nonzero if would have a child of zero: this effectively makes this
- alias set the same as alias set zero. */
- int has_zero_child;
};
typedef struct alias_set_entry *alias_set_entry;
static bool nonoverlapping_component_refs_p (const_tree, const_tree);
static tree decl_for_component_ref (tree);
static rtx adjust_offset_for_component_ref (tree, rtx);
-static int nonoverlapping_memrefs_p (const_rtx, const_rtx);
static int write_dependence_p (const_rtx, const_rtx, int);
-static void memory_modified_1 (const_rtx, const_rtx, const void *);
+static void memory_modified_1 (rtx, const_rtx, void *);
static void record_alias_subset (alias_set_type, alias_set_type);
/* Set up all info needed to perform alias analysis on memory references. */
/* Otherwise, check if set1 is a subset of set2. */
ase = get_alias_set_entry (set2);
if (ase != 0
- && (splay_tree_lookup (ase->children,
- (splay_tree_key) set1)))
+ && ((ase->has_zero_child && set1 == 0)
+ || splay_tree_lookup (ase->children,
+ (splay_tree_key) set1)))
return true;
return false;
}
/* Check for accesses through restrict-qualified pointers. */
if (INDIRECT_REF_P (inner))
{
- tree decl = find_base_decl (TREE_OPERAND (inner, 0));
+ tree decl;
+
+ if (TREE_CODE (TREE_OPERAND (inner, 0)) == SSA_NAME)
+ decl = SSA_NAME_VAR (TREE_OPERAND (inner, 0));
+ else
+ decl = find_base_decl (TREE_OPERAND (inner, 0));
if (decl && DECL_POINTER_ALIAS_SET_KNOWN_P (decl))
{
if (TYPE_ALIAS_SET_KNOWN_P (t))
return TYPE_ALIAS_SET (t);
+ /* We don't want to set TYPE_ALIAS_SET for incomplete types. */
+ if (!COMPLETE_TYPE_P (t))
+ {
+ /* For arrays with unknown size the conservative answer is the
+ alias set of the element type. */
+ if (TREE_CODE (t) == ARRAY_TYPE)
+ return get_alias_set (TREE_TYPE (t));
+
+ /* But return zero as a conservative answer for incomplete types. */
+ return 0;
+ }
+
/* See if the language has special handling for this type. */
set = lang_hooks.get_alias_set (t);
if (set != -1)
/* Return nonzero if we can determine the exprs corresponding to memrefs
X and Y and they do not overlap. */
-static int
+int
nonoverlapping_memrefs_p (const_rtx x, const_rtx y)
{
tree exprx = MEM_EXPR (x), expry = MEM_EXPR (y);
\f
void
-init_alias_once (void)
+init_alias_target (void)
{
int i;
+ memset (static_reg_base_value, 0, sizeof static_reg_base_value);
+
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
/* Check whether this register can hold an incoming pointer
argument. FUNCTION_ARG_REGNO_P tests outgoing register
to be memory reference. */
static bool memory_modified;
static void
-memory_modified_1 (const_rtx x, const_rtx pat ATTRIBUTE_UNUSED, const void *data)
+memory_modified_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
{
if (MEM_P (x))
{
if (!INSN_P (insn))
return false;
memory_modified = false;
- const_note_stores (PATTERN (insn), memory_modified_1, mem);
+ note_stores (PATTERN (insn), memory_modified_1, CONST_CAST_RTX(mem));
return memory_modified;
}