re PR middle-end/38212 (restrict implementation causes wrong-code)
2009-06-29 Richard Guenther <rguenther@suse.de> PR middle-end/38212 * alias.c (find_base_decl): Remove. (get_deref_alias_set_1): Remove restrict handling. * c-common.c (c_apply_type_quals_to_decl): Do not set DECL_POINTER_ALIAS_SET. * gimplify.c (find_single_pointer_decl_1): Remove. (find_single_pointer_decl): Likewise. (internal_get_tmp_var): Remove restrict handling. (gimple_regimplify_operands): Likewise. * omp-low.c (expand_omp_atomic_pipeline): Do not set DECL_POINTER_ALIAS_SET. Use ref-all pointers. * print-tree.c (print_node): Do not print DECL_POINTER_ALIAS_SET. * tree.c (restrict_base_for_decl): Remove. (init_ttree): Do not allocate it. (make_node_stat): Do not set DECL_POINTER_ALIAS_SET. Set LABEL_DECL_UID for label decls. (copy_node_stat): Do not copy restrict information. (decl_restrict_base_lookup): Remove. (decl_restrict_base_insert): Likewise. (print_restrict_base_statistics): Likewise. (dump_tree_statistics): Do not call print_restrict_base_statistics. * tree.h (DECL_POINTER_ALIAS_SET): Remove. (DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise. (struct tree_decl_common): Rename pointer_alias_set to label_decl_uid. (LABEL_DECL_UID): Adjust. (DECL_BASED_ON_RESTRICT_P): Remove. (DECL_GET_RESTRICT_BASE): Likewise. (SET_DECL_RESTRICT_BASE): Likewise. (struct tree_decl_with_vis): Remove based_on_restrict_p flag. * config/i386/i386.c (ix86_gimplify_va_arg): Use ref-all pointers instead of DECL_POINTER_ALIAS_SET. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. * config/s390/s390.c (s390_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_gimplify_va_arg_expr): Likewise. * gcc.c-torture/execute/pr38212.c: New testcase. From-SVN: r149047
This commit is contained in:
parent
09a782ebda
commit
5b21f0f37d
|
@ -1,3 +1,41 @@
|
|||
2009-06-29 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/38212
|
||||
* alias.c (find_base_decl): Remove.
|
||||
(get_deref_alias_set_1): Remove restrict handling.
|
||||
* c-common.c (c_apply_type_quals_to_decl): Do not set
|
||||
DECL_POINTER_ALIAS_SET.
|
||||
* gimplify.c (find_single_pointer_decl_1): Remove.
|
||||
(find_single_pointer_decl): Likewise.
|
||||
(internal_get_tmp_var): Remove restrict handling.
|
||||
(gimple_regimplify_operands): Likewise.
|
||||
* omp-low.c (expand_omp_atomic_pipeline): Do not set
|
||||
DECL_POINTER_ALIAS_SET. Use ref-all pointers.
|
||||
* print-tree.c (print_node): Do not print DECL_POINTER_ALIAS_SET.
|
||||
* tree.c (restrict_base_for_decl): Remove.
|
||||
(init_ttree): Do not allocate it.
|
||||
(make_node_stat): Do not set DECL_POINTER_ALIAS_SET. Set
|
||||
LABEL_DECL_UID for label decls.
|
||||
(copy_node_stat): Do not copy restrict information.
|
||||
(decl_restrict_base_lookup): Remove.
|
||||
(decl_restrict_base_insert): Likewise.
|
||||
(print_restrict_base_statistics): Likewise.
|
||||
(dump_tree_statistics): Do not call print_restrict_base_statistics.
|
||||
* tree.h (DECL_POINTER_ALIAS_SET): Remove.
|
||||
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
|
||||
(struct tree_decl_common): Rename pointer_alias_set to label_decl_uid.
|
||||
(LABEL_DECL_UID): Adjust.
|
||||
(DECL_BASED_ON_RESTRICT_P): Remove.
|
||||
(DECL_GET_RESTRICT_BASE): Likewise.
|
||||
(SET_DECL_RESTRICT_BASE): Likewise.
|
||||
(struct tree_decl_with_vis): Remove based_on_restrict_p flag.
|
||||
|
||||
* config/i386/i386.c (ix86_gimplify_va_arg): Use ref-all pointers
|
||||
instead of DECL_POINTER_ALIAS_SET.
|
||||
* config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise.
|
||||
* config/s390/s390.c (s390_gimplify_va_arg): Likewise.
|
||||
* config/spu/spu.c (spu_gimplify_va_arg_expr): Likewise.
|
||||
|
||||
2009-06-29 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/40579
|
||||
|
|
103
gcc/alias.c
103
gcc/alias.c
|
@ -155,7 +155,6 @@ static int base_alias_check (rtx, rtx, enum machine_mode,
|
|||
static rtx find_base_value (rtx);
|
||||
static int mems_in_disjoint_alias_sets_p (const_rtx, const_rtx);
|
||||
static int insert_subset_children (splay_tree_node, void*);
|
||||
static tree find_base_decl (tree);
|
||||
static alias_set_entry get_alias_set_entry (alias_set_type);
|
||||
static const_rtx fixed_scalar_and_varying_struct_p (const_rtx, const_rtx, rtx, rtx,
|
||||
bool (*) (const_rtx, bool));
|
||||
|
@ -422,57 +421,6 @@ objects_must_conflict_p (tree t1, tree t2)
|
|||
return alias_sets_must_conflict_p (set1, set2);
|
||||
}
|
||||
|
||||
/* T is an expression with pointer type. Find the DECL on which this
|
||||
expression is based. (For example, in `a[i]' this would be `a'.)
|
||||
If there is no such DECL, or a unique decl cannot be determined,
|
||||
NULL_TREE is returned. */
|
||||
|
||||
static tree
|
||||
find_base_decl (tree t)
|
||||
{
|
||||
tree d0, d1;
|
||||
|
||||
if (t == 0 || t == error_mark_node || ! POINTER_TYPE_P (TREE_TYPE (t)))
|
||||
return 0;
|
||||
|
||||
if (TREE_CODE (t) == SSA_NAME)
|
||||
t = SSA_NAME_VAR (t);
|
||||
|
||||
/* If this is a declaration, return it. If T is based on a restrict
|
||||
qualified decl, return that decl. */
|
||||
if (DECL_P (t))
|
||||
{
|
||||
if (TREE_CODE (t) == VAR_DECL && DECL_BASED_ON_RESTRICT_P (t))
|
||||
t = DECL_GET_RESTRICT_BASE (t);
|
||||
return t;
|
||||
}
|
||||
|
||||
/* Handle general expressions. It would be nice to deal with
|
||||
COMPONENT_REFs here. If we could tell that `a' and `b' were the
|
||||
same, then `a->f' and `b->f' are also the same. */
|
||||
switch (TREE_CODE_CLASS (TREE_CODE (t)))
|
||||
{
|
||||
case tcc_unary:
|
||||
return find_base_decl (TREE_OPERAND (t, 0));
|
||||
|
||||
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));
|
||||
if (d0 == d1)
|
||||
return d0;
|
||||
else if (d0 == 0)
|
||||
return d1;
|
||||
else if (d1 == 0)
|
||||
return d0;
|
||||
else
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return true if all nested component references handled by
|
||||
get_inner_reference in T are such that we should use the alias set
|
||||
provided by the object at the heart of T.
|
||||
|
@ -532,56 +480,9 @@ get_deref_alias_set_1 (tree t)
|
|||
if (!flag_strict_aliasing)
|
||||
return 0;
|
||||
|
||||
/* All we care about is the type. */
|
||||
if (! TYPE_P (t))
|
||||
{
|
||||
tree decl = find_base_decl (t);
|
||||
|
||||
if (decl && DECL_POINTER_ALIAS_SET_KNOWN_P (decl))
|
||||
{
|
||||
/* If we haven't computed the actual alias set, do it now. */
|
||||
if (DECL_POINTER_ALIAS_SET (decl) == -2)
|
||||
{
|
||||
tree pointed_to_type = TREE_TYPE (TREE_TYPE (decl));
|
||||
|
||||
/* No two restricted pointers can point at the same thing.
|
||||
However, a restricted pointer can point at the same thing
|
||||
as an unrestricted pointer, if that unrestricted pointer
|
||||
is based on the restricted pointer. So, we make the
|
||||
alias set for the restricted pointer a subset of the
|
||||
alias set for the type pointed to by the type of the
|
||||
decl. */
|
||||
alias_set_type pointed_to_alias_set
|
||||
= get_alias_set (pointed_to_type);
|
||||
|
||||
if (pointed_to_alias_set == 0)
|
||||
/* It's not legal to make a subset of alias set zero. */
|
||||
DECL_POINTER_ALIAS_SET (decl) = 0;
|
||||
else if (AGGREGATE_TYPE_P (pointed_to_type))
|
||||
/* For an aggregate, we must treat the restricted
|
||||
pointer the same as an ordinary pointer. If we
|
||||
were to make the type pointed to by the
|
||||
restricted pointer a subset of the pointed-to
|
||||
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. */
|
||||
DECL_POINTER_ALIAS_SET (decl)
|
||||
= pointed_to_alias_set;
|
||||
else
|
||||
{
|
||||
DECL_POINTER_ALIAS_SET (decl) = new_alias_set ();
|
||||
record_alias_subset (pointed_to_alias_set,
|
||||
DECL_POINTER_ALIAS_SET (decl));
|
||||
}
|
||||
}
|
||||
|
||||
/* We use the alias set indicated in the declaration. */
|
||||
return DECL_POINTER_ALIAS_SET (decl);
|
||||
}
|
||||
|
||||
/* Now all we care about is the type. */
|
||||
t = TREE_TYPE (t);
|
||||
}
|
||||
t = TREE_TYPE (t);
|
||||
|
||||
/* If we have an INDIRECT_REF via a void pointer, we don't
|
||||
know anything about what that might alias. Likewise if the
|
||||
|
|
|
@ -4046,11 +4046,6 @@ c_apply_type_quals_to_decl (int type_quals, tree decl)
|
|||
|| !POINTER_TYPE_P (type)
|
||||
|| !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type)))
|
||||
error ("invalid use of %<restrict%>");
|
||||
else if (flag_strict_aliasing && type == TREE_TYPE (decl))
|
||||
/* Indicate we need to make a unique alias set for this pointer.
|
||||
We can't do it here because it might be pointing to an
|
||||
incomplete type. */
|
||||
DECL_POINTER_ALIAS_SET (decl) = -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6928,7 +6928,6 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||
/* Pull the value out of the saved registers. */
|
||||
|
||||
addr = create_tmp_var (ptr_type_node, "addr");
|
||||
DECL_POINTER_ALIAS_SET (addr) = get_varargs_alias_set ();
|
||||
|
||||
if (container)
|
||||
{
|
||||
|
@ -6983,9 +6982,7 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||
else
|
||||
{
|
||||
int_addr = create_tmp_var (ptr_type_node, "int_addr");
|
||||
DECL_POINTER_ALIAS_SET (int_addr) = get_varargs_alias_set ();
|
||||
sse_addr = create_tmp_var (ptr_type_node, "sse_addr");
|
||||
DECL_POINTER_ALIAS_SET (sse_addr) = get_varargs_alias_set ();
|
||||
}
|
||||
|
||||
/* First ensure that we fit completely in registers. */
|
||||
|
@ -7123,7 +7120,7 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||
if (container)
|
||||
gimple_seq_add_stmt (pre_p, gimple_build_label (lab_over));
|
||||
|
||||
ptrtype = build_pointer_type (type);
|
||||
ptrtype = build_pointer_type_for_mode (type, ptr_mode, true);
|
||||
addr = fold_convert (ptrtype, addr);
|
||||
|
||||
if (indirect_p)
|
||||
|
|
|
@ -7620,7 +7620,7 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||
int size, rsize, n_reg, sav_ofs, sav_scale;
|
||||
tree lab_false, lab_over, addr;
|
||||
int align;
|
||||
tree ptrtype = build_pointer_type (type);
|
||||
tree ptrtype = build_pointer_type_for_mode (type, ptr_mode, true);
|
||||
int regalign = 0;
|
||||
gimple stmt;
|
||||
|
||||
|
@ -7711,7 +7711,6 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||
|
||||
lab_over = NULL;
|
||||
addr = create_tmp_var (ptr_type_node, "addr");
|
||||
DECL_POINTER_ALIAS_SET (addr) = get_varargs_alias_set ();
|
||||
|
||||
/* AltiVec vectors never go in registers when -mabi=altivec. */
|
||||
if (TARGET_ALTIVEC_ABI && ALTIVEC_VECTOR_MODE (TYPE_MODE (type)))
|
||||
|
|
|
@ -8624,7 +8624,6 @@ s390_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||
lab_false = create_artificial_label (UNKNOWN_LOCATION);
|
||||
lab_over = create_artificial_label (UNKNOWN_LOCATION);
|
||||
addr = create_tmp_var (ptr_type_node, "addr");
|
||||
DECL_POINTER_ALIAS_SET (addr) = get_varargs_alias_set ();
|
||||
|
||||
t = fold_convert (TREE_TYPE (reg), size_int (max_reg));
|
||||
t = build2 (GT_EXPR, boolean_type_node, reg, t);
|
||||
|
@ -8671,13 +8670,14 @@ s390_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||
|
||||
if (indirect_p)
|
||||
{
|
||||
t = build_pointer_type (build_pointer_type (type));
|
||||
t = build_pointer_type_for_mode (build_pointer_type (type),
|
||||
ptr_mode, true);
|
||||
addr = fold_convert (t, addr);
|
||||
addr = build_va_arg_indirect_ref (addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = build_pointer_type (type);
|
||||
t = build_pointer_type_for_mode (type, ptr_mode, true);
|
||||
addr = fold_convert (t, addr);
|
||||
}
|
||||
|
||||
|
|
|
@ -4068,7 +4068,6 @@ spu_gimplify_va_arg_expr (tree valist, tree type, gimple_seq * pre_p,
|
|||
build3 (COMPONENT_REF, TREE_TYPE (f_skip), valist, f_skip, NULL_TREE);
|
||||
|
||||
addr = create_tmp_var (ptr_type_node, "va_arg");
|
||||
DECL_POINTER_ALIAS_SET (addr) = get_varargs_alias_set ();
|
||||
|
||||
/* if an object is dynamically sized, a pointer to it is passed
|
||||
instead of the object itself. */
|
||||
|
@ -4098,7 +4097,8 @@ spu_gimplify_va_arg_expr (tree valist, tree type, gimple_seq * pre_p,
|
|||
tmp = build2 (POINTER_PLUS_EXPR, ptr_type_node, addr, paddedsize);
|
||||
gimplify_assign (unshare_expr (args), tmp, pre_p);
|
||||
|
||||
addr = fold_convert (build_pointer_type (type), addr);
|
||||
addr = fold_convert (build_pointer_type_for_mode (type, ptr_mode, true),
|
||||
addr);
|
||||
|
||||
if (pass_by_reference_p)
|
||||
addr = build_va_arg_indirect_ref (addr);
|
||||
|
|
|
@ -430,57 +430,6 @@ remove_suffix (char *name, int len)
|
|||
}
|
||||
}
|
||||
|
||||
/* Subroutine for find_single_pointer_decl. */
|
||||
|
||||
static tree
|
||||
find_single_pointer_decl_1 (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
|
||||
void *data)
|
||||
{
|
||||
tree *pdecl = (tree *) data;
|
||||
|
||||
/* We are only looking for pointers at the same level as the
|
||||
original tree; we must not look through any indirections.
|
||||
Returning anything other than NULL_TREE will cause the caller to
|
||||
not find a base. */
|
||||
if (REFERENCE_CLASS_P (*tp))
|
||||
return *tp;
|
||||
|
||||
if (DECL_P (*tp) && POINTER_TYPE_P (TREE_TYPE (*tp)))
|
||||
{
|
||||
if (*pdecl)
|
||||
{
|
||||
/* We already found a pointer decl; return anything other
|
||||
than NULL_TREE to unwind from walk_tree signalling that
|
||||
we have a duplicate. */
|
||||
return *tp;
|
||||
}
|
||||
*pdecl = *tp;
|
||||
}
|
||||
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Find the single DECL of pointer type in the tree T, used directly
|
||||
rather than via an indirection, and return it. If there are zero
|
||||
or more than one such DECLs, return NULL. */
|
||||
|
||||
static tree
|
||||
find_single_pointer_decl (tree t)
|
||||
{
|
||||
tree decl = NULL_TREE;
|
||||
|
||||
if (walk_tree (&t, find_single_pointer_decl_1, &decl, NULL))
|
||||
{
|
||||
/* find_single_pointer_decl_1 returns a nonzero value, causing
|
||||
walk_tree to return a nonzero value, to indicate that it
|
||||
found more than one pointer DECL or that it found an
|
||||
indirection. */
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
/* Create a new temporary name with PREFIX. Returns an identifier. */
|
||||
|
||||
static GTY(()) unsigned int tmp_var_id_num;
|
||||
|
@ -653,27 +602,10 @@ internal_get_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p,
|
|||
|
||||
t = lookup_tmp_var (val, is_formal);
|
||||
|
||||
if (is_formal)
|
||||
{
|
||||
tree u = find_single_pointer_decl (val);
|
||||
|
||||
if (u && TREE_CODE (u) == VAR_DECL && DECL_BASED_ON_RESTRICT_P (u))
|
||||
u = DECL_GET_RESTRICT_BASE (u);
|
||||
if (u && TYPE_RESTRICT (TREE_TYPE (u)))
|
||||
{
|
||||
if (DECL_BASED_ON_RESTRICT_P (t))
|
||||
gcc_assert (u == DECL_GET_RESTRICT_BASE (t));
|
||||
else
|
||||
{
|
||||
DECL_BASED_ON_RESTRICT_P (t) = 1;
|
||||
SET_DECL_RESTRICT_BASE (t, u);
|
||||
}
|
||||
}
|
||||
|
||||
if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
|
||||
|| TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
|
||||
DECL_GIMPLE_REG_P (t) = 1;
|
||||
}
|
||||
if (is_formal
|
||||
&& (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
|
||||
|| TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE))
|
||||
DECL_GIMPLE_REG_P (t) = 1;
|
||||
|
||||
mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val));
|
||||
|
||||
|
@ -7766,13 +7698,6 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
|
|||
DECL_GIMPLE_REG_P (temp) = 1;
|
||||
if (TREE_CODE (orig_lhs) == SSA_NAME)
|
||||
orig_lhs = SSA_NAME_VAR (orig_lhs);
|
||||
if (TREE_CODE (orig_lhs) == VAR_DECL
|
||||
&& DECL_BASED_ON_RESTRICT_P (orig_lhs))
|
||||
{
|
||||
DECL_BASED_ON_RESTRICT_P (temp) = 1;
|
||||
SET_DECL_RESTRICT_BASE (temp,
|
||||
DECL_GET_RESTRICT_BASE (orig_lhs));
|
||||
}
|
||||
|
||||
if (gimple_in_ssa_p (cfun))
|
||||
temp = make_ssa_name (temp, NULL);
|
||||
|
|
|
@ -5016,14 +5016,14 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
|
|||
{
|
||||
tree iaddr_val;
|
||||
|
||||
iaddr = create_tmp_var (build_pointer_type (itype), NULL);
|
||||
iaddr = create_tmp_var (build_pointer_type_for_mode (itype, ptr_mode,
|
||||
true), NULL);
|
||||
iaddr_val
|
||||
= force_gimple_operand_gsi (&si,
|
||||
fold_convert (TREE_TYPE (iaddr), addr),
|
||||
false, NULL_TREE, true, GSI_SAME_STMT);
|
||||
stmt = gimple_build_assign (iaddr, iaddr_val);
|
||||
gsi_insert_before (&si, stmt, GSI_SAME_STMT);
|
||||
DECL_POINTER_ALIAS_SET (iaddr) = 0;
|
||||
loadedi = create_tmp_var (itype, NULL);
|
||||
if (gimple_in_ssa_p (cfun))
|
||||
{
|
||||
|
|
|
@ -483,10 +483,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
|
||||
built_in_names[(int) DECL_FUNCTION_CODE (node)]);
|
||||
}
|
||||
|
||||
if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
|
||||
fprintf (file, " alias set " HOST_WIDE_INT_PRINT_DEC,
|
||||
(HOST_WIDE_INT) DECL_POINTER_ALIAS_SET (node));
|
||||
}
|
||||
if (code == FIELD_DECL)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2009-06-29 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/38212
|
||||
* gcc.c-torture/execute/pr38212.c: New testcase.
|
||||
|
||||
2009-06-29 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/40579
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
int __attribute__((noinline))
|
||||
foo (int *__restrict p, int i)
|
||||
{
|
||||
int *__restrict q;
|
||||
int *__restrict r;
|
||||
int v, w;
|
||||
q = p + 1;
|
||||
r = q - i;
|
||||
v = *r;
|
||||
*p = 1;
|
||||
w = *r;
|
||||
return v + w;
|
||||
}
|
||||
extern void abort (void);
|
||||
int main()
|
||||
{
|
||||
int i = 0;
|
||||
if (foo (&i, 1) != 1)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
59
gcc/tree.c
59
gcc/tree.c
|
@ -194,9 +194,6 @@ static GTY ((if_marked ("tree_priority_map_marked_p"),
|
|||
param_is (struct tree_priority_map)))
|
||||
htab_t init_priority_for_decl;
|
||||
|
||||
static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
|
||||
htab_t restrict_base_for_decl;
|
||||
|
||||
static void set_type_quals (tree, int);
|
||||
static int type_hash_eq (const void *, const void *);
|
||||
static hashval_t type_hash_hash (const void *);
|
||||
|
@ -273,8 +270,6 @@ init_ttree (void)
|
|||
tree_map_eq, 0);
|
||||
init_priority_for_decl = htab_create_ggc (512, tree_priority_map_hash,
|
||||
tree_priority_map_eq, 0);
|
||||
restrict_base_for_decl = htab_create_ggc (256, tree_map_hash,
|
||||
tree_map_eq, 0);
|
||||
|
||||
int_cst_hash_table = htab_create_ggc (1024, int_cst_hash_hash,
|
||||
int_cst_hash_eq, NULL);
|
||||
|
@ -658,11 +653,11 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
|
|||
}
|
||||
else
|
||||
DECL_ALIGN (t) = 1;
|
||||
/* We have not yet computed the alias set for this declaration. */
|
||||
DECL_POINTER_ALIAS_SET (t) = -1;
|
||||
}
|
||||
DECL_SOURCE_LOCATION (t) = input_location;
|
||||
DECL_UID (t) = next_decl_uid++;
|
||||
if (TREE_CODE (t) == LABEL_DECL)
|
||||
LABEL_DECL_UID (t) = -1;
|
||||
|
||||
break;
|
||||
|
||||
|
@ -748,11 +743,6 @@ copy_node_stat (tree node MEM_STAT_DECL)
|
|||
SET_DECL_INIT_PRIORITY (t, DECL_INIT_PRIORITY (node));
|
||||
DECL_HAS_INIT_PRIORITY_P (t) = 1;
|
||||
}
|
||||
if (TREE_CODE (node) == VAR_DECL && DECL_BASED_ON_RESTRICT_P (node))
|
||||
{
|
||||
SET_DECL_RESTRICT_BASE (t, DECL_GET_RESTRICT_BASE (node));
|
||||
DECL_BASED_ON_RESTRICT_P (t) = 1;
|
||||
}
|
||||
}
|
||||
else if (TREE_CODE_CLASS (code) == tcc_type)
|
||||
{
|
||||
|
@ -4523,36 +4513,6 @@ decl_fini_priority_insert (tree decl, priority_type priority)
|
|||
h->fini = priority;
|
||||
}
|
||||
|
||||
/* Look up a restrict qualified base decl for FROM. */
|
||||
|
||||
tree
|
||||
decl_restrict_base_lookup (tree from)
|
||||
{
|
||||
struct tree_map *h;
|
||||
struct tree_map in;
|
||||
|
||||
in.base.from = from;
|
||||
h = (struct tree_map *) htab_find_with_hash (restrict_base_for_decl, &in,
|
||||
htab_hash_pointer (from));
|
||||
return h ? h->to : NULL_TREE;
|
||||
}
|
||||
|
||||
/* Record the restrict qualified base TO for FROM. */
|
||||
|
||||
void
|
||||
decl_restrict_base_insert (tree from, tree to)
|
||||
{
|
||||
struct tree_map *h;
|
||||
void **loc;
|
||||
|
||||
h = GGC_NEW (struct tree_map);
|
||||
h->hash = htab_hash_pointer (from);
|
||||
h->base.from = from;
|
||||
h->to = to;
|
||||
loc = htab_find_slot_with_hash (restrict_base_for_decl, h, h->hash, INSERT);
|
||||
*(struct tree_map **) loc = h;
|
||||
}
|
||||
|
||||
/* Print out the statistics for the DECL_DEBUG_EXPR hash table. */
|
||||
|
||||
static void
|
||||
|
@ -4575,20 +4535,6 @@ print_value_expr_statistics (void)
|
|||
htab_collisions (value_expr_for_decl));
|
||||
}
|
||||
|
||||
/* Print out statistics for the RESTRICT_BASE_FOR_DECL hash table, but
|
||||
don't print anything if the table is empty. */
|
||||
|
||||
static void
|
||||
print_restrict_base_statistics (void)
|
||||
{
|
||||
if (htab_elements (restrict_base_for_decl) != 0)
|
||||
fprintf (stderr,
|
||||
"RESTRICT_BASE hash: size %ld, %ld elements, %f collisions\n",
|
||||
(long) htab_size (restrict_base_for_decl),
|
||||
(long) htab_elements (restrict_base_for_decl),
|
||||
htab_collisions (restrict_base_for_decl));
|
||||
}
|
||||
|
||||
/* Lookup a debug expression for FROM, and return it if we find one. */
|
||||
|
||||
tree
|
||||
|
@ -7100,7 +7046,6 @@ dump_tree_statistics (void)
|
|||
print_type_hash_statistics ();
|
||||
print_debug_expr_statistics ();
|
||||
print_value_expr_statistics ();
|
||||
print_restrict_base_statistics ();
|
||||
lang_hooks.print_statistics ();
|
||||
}
|
||||
|
||||
|
|
50
gcc/tree.h
50
gcc/tree.h
|
@ -2565,16 +2565,6 @@ struct GTY(()) tree_decl_minimal {
|
|||
#define DECL_LANG_FLAG_6(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_6)
|
||||
#define DECL_LANG_FLAG_7(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_7)
|
||||
|
||||
/* Used to indicate an alias set for the memory pointed to by this
|
||||
particular FIELD_DECL, PARM_DECL, or VAR_DECL, which must have
|
||||
pointer (or reference) type. */
|
||||
#define DECL_POINTER_ALIAS_SET(NODE) \
|
||||
(DECL_COMMON_CHECK (NODE)->decl_common.pointer_alias_set)
|
||||
|
||||
/* Nonzero if an alias set has been assigned to this declaration. */
|
||||
#define DECL_POINTER_ALIAS_SET_KNOWN_P(NODE) \
|
||||
(DECL_POINTER_ALIAS_SET (NODE) != - 1)
|
||||
|
||||
/* Nonzero for a decl which is at file scope. */
|
||||
#define DECL_FILE_SCOPE_P(EXP) \
|
||||
(! DECL_CONTEXT (EXP) \
|
||||
|
@ -2646,7 +2636,7 @@ struct GTY(()) tree_decl_common {
|
|||
/* DECL_ALIGN. It should have the same size as TYPE_ALIGN. */
|
||||
unsigned int align;
|
||||
|
||||
alias_set_type pointer_alias_set;
|
||||
int label_decl_uid;
|
||||
/* Points to a structure whose details depend on the language in use. */
|
||||
struct lang_decl *lang_specific;
|
||||
};
|
||||
|
@ -2776,7 +2766,7 @@ struct GTY(()) tree_field_decl {
|
|||
dense, unique within any one function, and may be used to index arrays.
|
||||
If the value is -1, then no UID has been assigned. */
|
||||
#define LABEL_DECL_UID(NODE) \
|
||||
(LABEL_DECL_CHECK (NODE)->decl_common.pointer_alias_set)
|
||||
(LABEL_DECL_CHECK (NODE)->decl_common.label_decl_uid)
|
||||
|
||||
/* In LABEL_DECL nodes, nonzero means that an error message about
|
||||
jumping into such a binding contour has been printed for this label. */
|
||||
|
@ -2828,21 +2818,6 @@ struct GTY(()) tree_parm_decl {
|
|||
/* Used to indicate that the DECL is a dllimport. */
|
||||
#define DECL_DLLIMPORT_P(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.dllimport_flag)
|
||||
|
||||
/* DECL_BASED_ON_RESTRICT_P records whether a VAR_DECL is a temporary
|
||||
based on a variable with a restrict qualified type. If it is,
|
||||
DECL_RESTRICT_BASE returns the restrict qualified variable on which
|
||||
it is based. */
|
||||
|
||||
#define DECL_BASED_ON_RESTRICT_P(NODE) \
|
||||
(VAR_DECL_CHECK (NODE)->decl_with_vis.based_on_restrict_p)
|
||||
#define DECL_GET_RESTRICT_BASE(NODE) \
|
||||
(decl_restrict_base_lookup (VAR_DECL_CHECK (NODE)))
|
||||
#define SET_DECL_RESTRICT_BASE(NODE, VAL) \
|
||||
(decl_restrict_base_insert (VAR_DECL_CHECK (NODE), (VAL)))
|
||||
|
||||
extern tree decl_restrict_base_lookup (tree);
|
||||
extern void decl_restrict_base_insert (tree, tree);
|
||||
|
||||
/* Used in a DECL to indicate that, even if it TREE_PUBLIC, it need
|
||||
not be put out unless it is needed in this translation unit.
|
||||
Entities like this are shared across translation units (like weak
|
||||
|
@ -2933,28 +2908,27 @@ struct GTY(()) tree_decl_with_vis {
|
|||
tree comdat_group;
|
||||
|
||||
/* Belong to VAR_DECL exclusively. */
|
||||
unsigned defer_output:1;
|
||||
unsigned hard_register:1;
|
||||
unsigned thread_local:1;
|
||||
unsigned common_flag:1;
|
||||
unsigned defer_output : 1;
|
||||
unsigned hard_register : 1;
|
||||
unsigned thread_local : 1;
|
||||
unsigned common_flag : 1;
|
||||
unsigned in_text_section : 1;
|
||||
unsigned dllimport_flag : 1;
|
||||
unsigned based_on_restrict_p : 1;
|
||||
/* Used by C++. Might become a generic decl flag. */
|
||||
unsigned shadowed_for_var_p : 1;
|
||||
|
||||
/* Don't belong to VAR_DECL exclusively. */
|
||||
unsigned weak_flag:1;
|
||||
unsigned weak_flag : 1;
|
||||
|
||||
unsigned seen_in_bind_expr : 1;
|
||||
unsigned comdat_flag : 1;
|
||||
ENUM_BITFIELD(symbol_visibility) visibility : 2;
|
||||
unsigned visibility_specified : 1;
|
||||
/* Belong to FUNCTION_DECL exclusively. */
|
||||
unsigned init_priority_p:1;
|
||||
|
||||
/* Belongs to VAR_DECL exclusively. */
|
||||
ENUM_BITFIELD(tls_model) tls_model : 3;
|
||||
/* 14 unused bits. */
|
||||
|
||||
/* Belong to FUNCTION_DECL exclusively. */
|
||||
unsigned init_priority_p : 1;
|
||||
/* 15 unused bits. */
|
||||
};
|
||||
|
||||
/* In a VAR_DECL that's static,
|
||||
|
|
Loading…
Reference in New Issue