]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2011-04-27 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Apr 2011 14:16:49 +0000 (14:16 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Apr 2011 14:16:49 +0000 (14:16 +0000)
* Makefile.in (tree-ssa-structalias.o): Remove
gt-tree-ssa-structalias.h dependency.
(GTFILES): Remove tree-ssa-structalias.c.
* tree.c (allocate_decl_uid): New function.
(make_node_stat): Use it.
(copy_node_stat): Likewise.
* tree.h (allocate_decl_uid): Declare.
* tree-ssa-alias.h (delete_alias_heapvars): Remove.
* tree-ssa.c (delete_tree_ssa): Do not call delete_alias_heapvars.
* tree-flow.h (struct var_ann_d): Remove is_heapvar flag.
* tree-ssa-live.c (remove_unused_locals): Do not check is_heapvar
flag.
* tree-ssa-structalias.c (heapvar_for_stmt): Remove.
(struct heapvar_map): Likewise.
(heapvar_map_eq, heapvar_map_hash, heapvar_lookup,
heapvar_insert): Likewise.
(make_heapvar_for): Rename to ...
(make_heapvar): ... this.  Simplify.
(fake_var_decl_obstack): New global var.
(build_fake_var_decl): New function.
(make_constraint_from_heapvar): Adjust.
(handle_lhs_call): Likewise.
(create_function_info_for): Likewise.
(intra_create_variable_infos): Likewise.
(init_alias_vars): Allocate fake_var_decl_obstack.
(init_alias_heapvars, delete_alias_heapvars): Remove.
(compute_points_to_sets): Do not call init_alias_heapvars.
(ipa_pta_execute): Likewise.
(delete_points_to_sets): Free fake_var_decl_obstack.

* gcc.dg/tree-ssa/pr23382.c: Remove.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173030 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr23382.c [deleted file]
gcc/tree-flow.h
gcc/tree-ssa-alias.h
gcc/tree-ssa-live.c
gcc/tree-ssa-structalias.c
gcc/tree-ssa.c
gcc/tree.c
gcc/tree.h

index f2b75b07e91df90e7a098fc9889de47cf8e94643..885529ec7c503b90e0e1f386a7083edb8ddd9f06 100644 (file)
@@ -1,3 +1,35 @@
+2011-04-27  Richard Guenther  <rguenther@suse.de>
+
+       * Makefile.in (tree-ssa-structalias.o): Remove
+       gt-tree-ssa-structalias.h dependency.
+       (GTFILES): Remove tree-ssa-structalias.c.
+       * tree.c (allocate_decl_uid): New function.
+       (make_node_stat): Use it.
+       (copy_node_stat): Likewise.
+       * tree.h (allocate_decl_uid): Declare.
+       * tree-ssa-alias.h (delete_alias_heapvars): Remove.
+       * tree-ssa.c (delete_tree_ssa): Do not call delete_alias_heapvars.
+       * tree-flow.h (struct var_ann_d): Remove is_heapvar flag.
+       * tree-ssa-live.c (remove_unused_locals): Do not check is_heapvar
+       flag.
+       * tree-ssa-structalias.c (heapvar_for_stmt): Remove.
+       (struct heapvar_map): Likewise.
+       (heapvar_map_eq, heapvar_map_hash, heapvar_lookup,
+       heapvar_insert): Likewise.
+       (make_heapvar_for): Rename to ...
+       (make_heapvar): ... this.  Simplify.
+       (fake_var_decl_obstack): New global var.
+       (build_fake_var_decl): New function.
+       (make_constraint_from_heapvar): Adjust.
+       (handle_lhs_call): Likewise.
+       (create_function_info_for): Likewise.
+       (intra_create_variable_infos): Likewise.
+       (init_alias_vars): Allocate fake_var_decl_obstack.
+       (init_alias_heapvars, delete_alias_heapvars): Remove.
+       (compute_points_to_sets): Do not call init_alias_heapvars.
+       (ipa_pta_execute): Likewise.
+       (delete_points_to_sets): Free fake_var_decl_obstack.
+
 2011-04-27  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
        * config/spu/divmovti4.c (union qword_UTItype): New data type.
index 9b85ad0564c21dde0a891a3e63b44887d16a6e0e..618046c0b1a417ee030f2e5e34fa99b60f752e43 100644 (file)
@@ -2381,7 +2381,7 @@ tree-ssa-structalias.o: tree-ssa-structalias.c \
    $(DIAGNOSTIC_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) \
    $(GIMPLE_H) $(HASHTAB_H) $(FUNCTION_H) $(CGRAPH_H) \
    $(TREE_PASS_H) $(TIMEVAR_H) alloc-pool.h $(SPLAY_TREE_H) $(PARAMS_H) \
-   gt-tree-ssa-structalias.h $(CGRAPH_H) $(ALIAS_H) pointer-set.h
+   $(CGRAPH_H) $(ALIAS_H) pointer-set.h
 tree-ssa-uninit.o : tree-ssa-uninit.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
    $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \
    $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
@@ -3776,7 +3776,6 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
   $(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \
   $(srcdir)/tree-ssa-propagate.c \
   $(srcdir)/tree-phinodes.c \
-  $(srcdir)/tree-ssa-structalias.c \
   $(srcdir)/lto-symtab.c \
   $(srcdir)/tree-ssa-alias.h \
   $(srcdir)/ipa-prop.h \
index 6fca754f1e5f24489a0f3c03f4539b97d33fd3ea..a745edcac56e6d966f9eb682f0a13696426c2ff3 100644 (file)
@@ -1,3 +1,7 @@
+2011-04-27  Richard Guenther  <rguenther@suse.de>
+
+       * gcc.dg/tree-ssa/pr23382.c: Remove.
+
 2011-04-27  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        PR target/48767
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23382.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23382.c
deleted file mode 100644 (file)
index fd74af8..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile } */ 
-/* { dg-options "-O2 -fdump-tree-pre-details" } */
-struct a
-{
-  int length;
-  int a1[256];
-};
-
-void *malloc(__SIZE_TYPE__ size) __attribute__((malloc));
-
-int f(void)
-{
-   struct a *a = malloc(sizeof(struct a));
-   return a->length;
-}
-/* { dg-final { scan-tree-dump-times "Variable: HEAP" 1 "pre"} } */
-/* { dg-final { cleanup-tree-dump "pre" } } */
index 2ac2bbb66f51d85e678195ee627b90a5e8c89a89..adae4630b01b165b13d4d3d34464966aad4c5879 100644 (file)
@@ -172,10 +172,6 @@ struct GTY(()) var_ann_d {
      states.  */
   ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
 
-  /* True for HEAP artificial variables.  These variables represent
-     the memory area allocated by a call to malloc.  */
-  unsigned is_heapvar : 1;
-
   /* Used by var_map for the base index of ssa base variables.  */
   unsigned base_index;
 
index 8a9da0e7726f86e196e6202d2e66d00a3940ce1b..75e4303a7ab54aea20688bb73f030ba6d1b9907e 100644 (file)
@@ -125,7 +125,6 @@ extern void dump_alias_stats (FILE *);
 
 /* In tree-ssa-structalias.c  */
 extern unsigned int compute_may_aliases (void);
-extern void delete_alias_heapvars (void);
 extern bool pt_solution_empty_p (struct pt_solution *);
 extern bool pt_solution_includes_global (struct pt_solution *);
 extern bool pt_solution_includes (struct pt_solution *, const_tree);
index 4216b22585109252f681c93d1f0e6c53f5c54c27..65b3855775a9af0ae22a08c024c3fe3db45742b4 100644 (file)
@@ -820,8 +820,7 @@ remove_unused_locals (void)
     if (!is_global_var (t)
        && TREE_CODE (t) != PARM_DECL
        && TREE_CODE (t) != RESULT_DECL
-       && !is_used_p (t)
-       && !var_ann (t)->is_heapvar)
+       && !is_used_p (t))
       remove_referenced_var (t);
   remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
   if (dump_file && (dump_flags & TDF_DETAILS))
index 70405a16137f629874348ec9541f3c619e052c44..1119c387d155946b1f852780dfb17a8437ec5ee4 100644 (file)
    keep the set of called functions for indirect calls.
 
    And probably more.  */
-static GTY ((if_marked ("tree_map_marked_p"), param_is (struct heapvar_map)))
-htab_t heapvar_for_stmt;
 
 static bool use_field_sensitive = true;
 static int in_ipa_mode = 0;
@@ -333,61 +331,6 @@ enum { nothing_id = 0, anything_id = 1, readonly_id = 2,
        escaped_id = 3, nonlocal_id = 4,
        storedanything_id = 5, integer_id = 6 };
 
-struct GTY(()) heapvar_map {
-  struct tree_map map;
-  unsigned HOST_WIDE_INT offset;
-};
-
-static int
-heapvar_map_eq (const void *p1, const void *p2)
-{
-  const struct heapvar_map *h1 = (const struct heapvar_map *)p1;
-  const struct heapvar_map *h2 = (const struct heapvar_map *)p2;
-  return (h1->map.base.from == h2->map.base.from
-         && h1->offset == h2->offset);
-}
-
-static unsigned int
-heapvar_map_hash (struct heapvar_map *h)
-{
-  return iterative_hash_host_wide_int (h->offset,
-                                      htab_hash_pointer (h->map.base.from));
-}
-
-/* Lookup a heap var for FROM, and return it if we find one.  */
-
-static tree
-heapvar_lookup (tree from, unsigned HOST_WIDE_INT offset)
-{
-  struct heapvar_map *h, in;
-  in.map.base.from = from;
-  in.offset = offset;
-  h = (struct heapvar_map *) htab_find_with_hash (heapvar_for_stmt, &in,
-                                                 heapvar_map_hash (&in));
-  if (h)
-    return h->map.to;
-  return NULL_TREE;
-}
-
-/* Insert a mapping FROM->TO in the heap var for statement
-   hashtable.  */
-
-static void
-heapvar_insert (tree from, unsigned HOST_WIDE_INT offset, tree to)
-{
-  struct heapvar_map *h;
-  void **loc;
-
-  h = ggc_alloc_heapvar_map ();
-  h->map.base.from = from;
-  h->offset = offset;
-  h->map.hash = heapvar_map_hash (h);
-  h->map.to = to;
-  loc = htab_find_slot_with_hash (heapvar_for_stmt, h, h->map.hash, INSERT);
-  gcc_assert (*loc == NULL);
-  *(struct heapvar_map **) loc = h;
-}
-
 /* Return a new variable info structure consisting for a variable
    named NAME, and using constraint graph node NODE.  Append it
    to the vector of variable info structures.  */
@@ -3664,31 +3607,35 @@ make_transitive_closure_constraints (varinfo_t vi)
   process_constraint (new_constraint (lhs, rhs));
 }
 
+/* Temporary storage for fake var decls.  */
+struct obstack fake_var_decl_obstack;
+
+/* Build a fake VAR_DECL acting as referrer to a DECL_UID.  */
+
+static tree
+build_fake_var_decl (tree type)
+{
+  tree decl = (tree) XOBNEW (&fake_var_decl_obstack, struct tree_var_decl);
+  memset (decl, 0, sizeof (struct tree_var_decl));
+  TREE_SET_CODE (decl, VAR_DECL);
+  TREE_TYPE (decl) = type;
+  DECL_UID (decl) = allocate_decl_uid ();
+  SET_DECL_PT_UID (decl, -1);
+  layout_decl (decl, 0);
+  return decl;
+}
+
 /* Create a new artificial heap variable with NAME.
    Return the created variable.  */
 
 static varinfo_t
-make_heapvar_for (varinfo_t lhs, const char *name)
+make_heapvar (const char *name)
 {
   varinfo_t vi;
-  tree heapvar = heapvar_lookup (lhs->decl, lhs->offset);
-
-  if (heapvar == NULL_TREE)
-    {
-      var_ann_t ann;
-      heapvar = create_tmp_var_raw (ptr_type_node, name);
-      DECL_EXTERNAL (heapvar) = 1;
-
-      heapvar_insert (lhs->decl, lhs->offset, heapvar);
-
-      ann = get_var_ann (heapvar);
-      ann->is_heapvar = 1;
-    }
-
-  /* For global vars we need to add a heapvar to the list of referenced
-     vars of a different function than it was created for originally.  */
-  if (cfun && gimple_referenced_vars (cfun))
-    add_referenced_var (heapvar);
+  tree heapvar;
+  
+  heapvar = build_fake_var_decl (ptr_type_node);
+  DECL_EXTERNAL (heapvar) = 1;
 
   vi = new_var_info (heapvar, name);
   vi->is_artificial_var = true;
@@ -3709,7 +3656,7 @@ make_heapvar_for (varinfo_t lhs, const char *name)
 static varinfo_t
 make_constraint_from_heapvar (varinfo_t lhs, const char *name)
 {
-  varinfo_t vi = make_heapvar_for (lhs, name);
+  varinfo_t vi = make_heapvar (name);
   make_constraint_from (lhs, vi->id);
 
   return vi;
@@ -3907,7 +3854,7 @@ handle_lhs_call (gimple stmt, tree lhs, int flags, VEC(ce_s, heap) *rhsc,
       varinfo_t vi;
       struct constraint_expr tmpc;
       rhsc = NULL;
-      vi = make_heapvar_for (get_vi_for_tree (lhs), "HEAP");
+      vi = make_heapvar ("HEAP");
       /* We delay marking allocated storage global until we know if
          it escapes.  */
       DECL_EXTERNAL (vi->decl) = 0;
@@ -5323,8 +5270,7 @@ create_function_info_for (tree decl, const char *name)
       free (tempname);
 
       /* We need sth that can be pointed to for va_start.  */
-      decl = create_tmp_var_raw (ptr_type_node, name);
-      get_var_ann (decl);
+      decl = build_fake_var_decl (ptr_type_node);
 
       argvi = new_var_info (decl, newname);
       argvi->offset = fi_parm_base + num_args;
@@ -5587,23 +5533,13 @@ intra_create_variable_infos (void)
        {
          struct constraint_expr lhsc, rhsc;
          varinfo_t vi;
-         tree heapvar = heapvar_lookup (t, 0);
-         if (heapvar == NULL_TREE)
-           {
-             var_ann_t ann;
-             heapvar = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (t)),
-                                           "PARM_NOALIAS");
-             DECL_EXTERNAL (heapvar) = 1;
-             heapvar_insert (t, 0, heapvar);
-             ann = get_var_ann (heapvar);
-             ann->is_heapvar = 1;
-           }
-         if (gimple_referenced_vars (cfun))
-           add_referenced_var (heapvar);
+         tree heapvar = build_fake_var_decl (TREE_TYPE (TREE_TYPE (t)));
+         DECL_EXTERNAL (heapvar) = 1;
+         vi = get_varinfo (create_variable_info_for (heapvar, "PARM_NOALIAS"));
          lhsc.var = get_vi_for_tree (t)->id;
          lhsc.type = SCALAR;
          lhsc.offset = 0;
-         rhsc.var = (vi = get_vi_for_tree (heapvar))->id;
+         rhsc.var = vi->id;
          rhsc.type = ADDRESSOF;
          rhsc.offset = 0;
          process_constraint (new_constraint (lhsc, rhsc));
@@ -6371,6 +6307,8 @@ init_alias_vars (void)
   shared_bitmap_table = htab_create (511, shared_bitmap_hash,
                                     shared_bitmap_eq, free);
   init_base_vars ();
+
+  gcc_obstack_init (&fake_var_decl_obstack);
 }
 
 /* Remove the REF and ADDRESS edges from GRAPH, as well as all the
@@ -6409,26 +6347,6 @@ remove_preds_and_fake_succs (constraint_graph_t graph)
   bitmap_obstack_release (&predbitmap_obstack);
 }
 
-/* Initialize the heapvar for statement mapping.  */
-
-static void
-init_alias_heapvars (void)
-{
-  if (!heapvar_for_stmt)
-    heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, heapvar_map_eq,
-                                       NULL);
-}
-
-/* Delete the heapvar for statement mapping.  */
-
-void
-delete_alias_heapvars (void)
-{
-  if (heapvar_for_stmt)
-    htab_delete (heapvar_for_stmt);
-  heapvar_for_stmt = NULL;
-}
-
 /* Solve the constraint set.  */
 
 static void
@@ -6500,7 +6418,6 @@ compute_points_to_sets (void)
   timevar_push (TV_TREE_PTA);
 
   init_alias_vars ();
-  init_alias_heapvars ();
 
   intra_create_variable_infos ();
 
@@ -6651,6 +6568,8 @@ delete_points_to_sets (void)
   VEC_free (varinfo_t, heap, varmap);
   free_alloc_pool (variable_info_pool);
   free_alloc_pool (constraint_pool);
+
+  obstack_free (&fake_var_decl_obstack, NULL);
 }
 
 
@@ -6776,7 +6695,6 @@ ipa_pta_execute (void)
 
   in_ipa_mode = 1;
 
-  init_alias_heapvars ();
   init_alias_vars ();
 
   /* Build the constraints.  */
@@ -7119,6 +7037,3 @@ struct simple_ipa_opt_pass pass_ipa_pta =
   TODO_update_ssa                       /* todo_flags_finish */
  }
 };
-
-
-#include "gt-tree-ssa-structalias.h"
index 9ae280a7e32a9d51656b4edfcee22c5a9109163c..9bdcdfcb1d28495a3d4a9a84fa8dbb3e8cc59b26 100644 (file)
@@ -1187,8 +1187,6 @@ delete_tree_ssa (void)
   if (ssa_operands_active ())
     fini_ssa_operands ();
 
-  delete_alias_heapvars ();
-
   htab_delete (cfun->gimple_df->default_defs);
   cfun->gimple_df->default_defs = NULL;
   pt_solution_reset (&cfun->gimple_df->escaped);
index 6f93fb16336c2487532bfe31abf36ec2d2ff0e02..b175221c779292954524c27a76158a50bed458b1 100644 (file)
@@ -814,6 +814,14 @@ record_node_allocation_statistics (enum tree_code code ATTRIBUTE_UNUSED,
 #endif
 }
 
+/* Allocate and return a new UID from the DECL_UID namespace.  */
+
+int
+allocate_decl_uid (void)
+{
+  return next_decl_uid++;
+}
+
 /* Return a newly allocated node of code CODE.  For decl and type
    nodes, some other fields are initialized.  The rest of the node is
    initialized to zero.  This function cannot be used for TREE_VEC or
@@ -857,7 +865,7 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
        DECL_UID (t) = --next_debug_decl_uid;
       else
        {
-         DECL_UID (t) = next_decl_uid++;
+         DECL_UID (t) = allocate_decl_uid ();
          SET_DECL_PT_UID (t, -1);
        }
       if (TREE_CODE (t) == LABEL_DECL)
@@ -942,7 +950,7 @@ copy_node_stat (tree node MEM_STAT_DECL)
        DECL_UID (t) = --next_debug_decl_uid;
       else
        {
-         DECL_UID (t) = next_decl_uid++;
+         DECL_UID (t) = allocate_decl_uid ();
          if (DECL_PT_UID_SET_P (node))
            SET_DECL_PT_UID (t, DECL_PT_UID (node));
        }
index 8f25832589f570d05ed8403dd93f5c95f6e5a1f0..8baaf7b7fd01f5d5a75dcf760c604979ab0d55ed 100644 (file)
@@ -4017,6 +4017,9 @@ extern size_t tree_size (const_tree);
    length.  */
 extern size_t tree_code_size (enum tree_code);
 
+/* Allocate and return a new UID from the DECL_UID namespace.  */
+extern int allocate_decl_uid (void);
+
 /* Lowest level primitive for allocating a node.
    The TREE_CODE is the only argument.  Contents are initialized
    to zero except for a few of the common fields.  */