]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/tree-ssa-operands.c
tree.def (VTABLE_REF): Remove.
[gcc.git] / gcc / tree-ssa-operands.c
index f1edfa18e185c39f6df0bef3a590d036a9854998..68da398c9ef7588f8166536ccebbaa21957f519c 100644 (file)
@@ -88,65 +88,15 @@ static void add_call_clobber_ops (tree, voperands_t);
 static void add_call_read_ops (tree, voperands_t);
 static void add_stmt_operand (tree *, tree, int, voperands_t);
 
-
-struct freelist_d GTY((chain_next ("%h.next")))
-{
-   struct freelist_d *next;
-};
-
-#define NUM_FREE       5
-static GTY ((length ("NUM_FREE"))) struct freelist_d optype_freelist[NUM_FREE] = { {0}, {0}, {0}, {0}, {0} };
-
-
-static inline void *
-check_optype_freelist (size_t num ATTRIBUTE_UNUSED)
-{
-  return NULL;
-#if 0
-  void *vec = NULL;
-
-  if (num <= NUM_FREE && optype_freelist[num - 1].next)
-    {
-      vec = (void *)optype_freelist[num - 1].next;
-      optype_freelist[num - 1].next = optype_freelist[num - 1].next->next;
-    }
-  return vec;
-#endif
-}
 /* Return a vector of contiguous memory of a specified size.  */
 
-
-static inline void
-add_optype_freelist (void *vec ATTRIBUTE_UNUSED, size_t size ATTRIBUTE_UNUSED)
-{
-#if 0
-  struct freelist_d *ptr;
-#ifdef ENABLE_CHECKING
-  if (size == 0)
-    abort ();
-#endif
-
-  /* if its bigger than one of our lists, simply let it go and let GC 
-     collect it.  */
-  if (size > NUM_FREE)
-    return;
-
-  ptr = vec;
-  ptr->next = optype_freelist[size - 1].next;;
-  optype_freelist[size - 1].next = ptr;
-#endif
-}
-
-
 static inline def_optype
 allocate_def_optype (unsigned num)
 {
   def_optype def_ops;
   unsigned size;
   size = sizeof (struct def_optype_d) + sizeof (tree *) * (num - 1);
-  def_ops = check_optype_freelist (num);
-  if (!def_ops)
-    def_ops =  ggc_alloc (size);
+  def_ops =  ggc_alloc (size);
   def_ops->num_defs = num;
   return def_ops;
 }
@@ -157,9 +107,7 @@ allocate_use_optype (unsigned num)
   use_optype use_ops;
   unsigned size;
   size = sizeof (struct use_optype_d) + sizeof (tree *) * (num - 1);
-  use_ops = check_optype_freelist (num);
-  if (!use_ops)
-    use_ops =  ggc_alloc (size);
+  use_ops =  ggc_alloc (size);
   use_ops->num_uses = num;
   return use_ops;
 }
@@ -170,9 +118,7 @@ allocate_v_may_def_optype (unsigned num)
   v_may_def_optype v_may_def_ops;
   unsigned size;
   size = sizeof (struct v_may_def_optype_d) + sizeof (tree) * ((num * 2) - 1);
-  v_may_def_ops = check_optype_freelist (num * 2);
-  if (!v_may_def_ops)
-    v_may_def_ops =  ggc_alloc (size);
+  v_may_def_ops =  ggc_alloc (size);
   v_may_def_ops->num_v_may_defs = num;
   return v_may_def_ops;
 }
@@ -183,9 +129,7 @@ allocate_vuse_optype (unsigned num)
   vuse_optype vuse_ops;
   unsigned size;
   size = sizeof (struct vuse_optype_d) + sizeof (tree) * (num - 1);
-  vuse_ops = check_optype_freelist (num);
-  if (!vuse_ops)
-    vuse_ops =  ggc_alloc (size);
+  vuse_ops =  ggc_alloc (size);
   vuse_ops->num_vuses = num;
   return vuse_ops;
 }
@@ -196,9 +140,7 @@ allocate_v_must_def_optype (unsigned num)
   v_must_def_optype v_must_def_ops;
   unsigned size;
   size = sizeof (struct v_must_def_optype_d) + sizeof (tree *) * (num - 1);
-  v_must_def_ops = check_optype_freelist (num);
-  if (!v_must_def_ops)
-    v_must_def_ops =  ggc_alloc (size);
+  v_must_def_ops =  ggc_alloc (size);
   v_must_def_ops->num_v_must_defs = num;
   return v_must_def_ops;
 }
@@ -209,7 +151,7 @@ free_uses (use_optype *uses, bool dealloc)
   if (*uses)
     {
       if (dealloc)
-       add_optype_freelist (*uses, (*uses)->num_uses);
+       ggc_free (*uses);
       *uses = NULL;
     }
 }
@@ -220,7 +162,7 @@ free_defs (def_optype *defs, bool dealloc)
   if (*defs)
     {
       if (dealloc)
-       add_optype_freelist (*defs, (*defs)->num_defs);
+       ggc_free (*defs);
       *defs = NULL;
     }
 }
@@ -231,7 +173,7 @@ free_vuses (vuse_optype *vuses, bool dealloc)
   if (*vuses)
     {
       if (dealloc)
-       add_optype_freelist (*vuses, (*vuses)->num_vuses);
+       ggc_free (*vuses);
       *vuses = NULL;
     }
 }
@@ -242,7 +184,7 @@ free_v_may_defs (v_may_def_optype *v_may_defs, bool dealloc)
   if (*v_may_defs)
     {
       if (dealloc)
-       add_optype_freelist (*v_may_defs, (*v_may_defs)->num_v_may_defs);
+       ggc_free (*v_may_defs);
       *v_may_defs = NULL;
     }
 }
@@ -253,7 +195,7 @@ free_v_must_defs (v_must_def_optype *v_must_defs, bool dealloc)
   if (*v_must_defs)
     {
       if (dealloc)
-       add_optype_freelist (*v_must_defs, (*v_must_defs)->num_v_must_defs);
+       ggc_free (*v_must_defs);
       *v_must_defs = NULL;
     }
 }
@@ -291,24 +233,16 @@ remove_v_must_defs (tree stmt)
 void
 init_ssa_operands (void)
 {
-  int x;
-
   VARRAY_TREE_PTR_INIT (build_defs, 5, "build defs");
   VARRAY_TREE_PTR_INIT (build_uses, 10, "build uses");
   VARRAY_TREE_INIT (build_v_may_defs, 10, "build v_may_defs");
   VARRAY_TREE_INIT (build_vuses, 10, "build vuses");
   VARRAY_TREE_INIT (build_v_must_defs, 10, "build v_must_defs");
-
-  for (x = 0; x < NUM_FREE; x++)
-    optype_freelist[x].next = NULL;
 }
 
 void
 fini_ssa_operands (void)
 {
-  int x;
-  for (x = 0; x < NUM_FREE; x++)
-    optype_freelist[x].next = NULL;
 }
 
 static void
@@ -330,7 +264,7 @@ finalize_ssa_defs (tree stmt)
 
   def_ops = allocate_def_optype (num);
   for (x = 0; x < num ; x++)
-    def_ops->defs[x] = VARRAY_TREE_PTR (build_defs, x);
+    def_ops->defs[x].def = VARRAY_TREE_PTR (build_defs, x);
   VARRAY_POP_ALL (build_defs);
 
   ann = stmt_ann (stmt);
@@ -363,7 +297,7 @@ finalize_ssa_uses (tree stmt)
 
   use_ops = allocate_use_optype (num);
   for (x = 0; x < num ; x++)
-    use_ops->uses[x] = VARRAY_TREE_PTR (build_uses, x);
+    use_ops->uses[x].use = VARRAY_TREE_PTR (build_uses, x);
   VARRAY_POP_ALL (build_uses);
 
   ann = stmt_ann (stmt);
@@ -963,30 +897,18 @@ get_expr_operands (tree stmt, tree *expr_p, int flags, voperands_t prev_vops)
   code = TREE_CODE (expr);
   class = TREE_CODE_CLASS (code);
 
-  /* Expressions that make no memory references.  */
-  if (class == 'c'
-      || class == 't'
-      || code == BLOCK
-      || code == FUNCTION_DECL
-      || code == EXC_PTR_EXPR
-      || code == FILTER_EXPR
-      || code == LABEL_DECL)
-    return;
-
   /* We could have the address of a component, array member, etc which
      has interesting variable references.  */
   if (code == ADDR_EXPR)
     {
-      enum tree_code subcode = TREE_CODE (TREE_OPERAND (expr, 0));
-
       /* Taking the address of a variable does not represent a
         reference to it, but the fact that STMT takes its address will be
         of interest to some passes (e.g. alias resolution).  */
       add_stmt_operand (expr_p, stmt, 0, NULL);
 
-      /* If the address is invariant, there may be no interesting variable
-        references inside.  */
-      if (is_gimple_min_invariant (expr))
+      /* If the address is constant (invariant is not sufficient), there will
+        be no interesting variable references inside.  */
+      if (TREE_CONSTANT (expr))
        return;
 
       /* There should be no VUSEs created, since the referenced objects are
@@ -996,12 +918,22 @@ get_expr_operands (tree stmt, tree *expr_p, int flags, voperands_t prev_vops)
       flags |= opf_no_vops;
 
       /* Avoid recursion.  */
-      code = subcode;
-      class = TREE_CODE_CLASS (code);
       expr_p = &TREE_OPERAND (expr, 0);
       expr = *expr_p;
+      code =  TREE_CODE (expr);
+      class = TREE_CODE_CLASS (code);
     }
 
+  /* Expressions that make no memory references.  */
+  if (class == 'c'
+      || class == 't'
+      || code == BLOCK
+      || code == FUNCTION_DECL
+      || code == EXC_PTR_EXPR
+      || code == FILTER_EXPR
+      || code == LABEL_DECL)
+    return;
+
   /* If we found a variable, add it to DEFS or USES depending on the
      operand flags.  */
   if (SSA_VAR_P (expr))
@@ -1109,7 +1041,7 @@ get_expr_operands (tree stmt, tree *expr_p, int flags, voperands_t prev_vops)
   /* Treat array references as references to the virtual variable
      representing the array.  The virtual variable for an ARRAY_REF
      is the VAR_DECL for the array.  */
-  if (code == ARRAY_REF)
+  if (code == ARRAY_REF || code == ARRAY_RANGE_REF)
     {
       /* Add the virtual variable for the ARRAY_REF to VDEFS or VUSES
         according to the value of IS_DEF.  Recurse if the LHS of the
@@ -1120,6 +1052,8 @@ get_expr_operands (tree stmt, tree *expr_p, int flags, voperands_t prev_vops)
        get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags, prev_vops);
 
       get_expr_operands (stmt, &TREE_OPERAND (expr, 1), opf_none, prev_vops);
+      get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_none, prev_vops);
+      get_expr_operands (stmt, &TREE_OPERAND (expr, 3), opf_none, prev_vops);
       return;
     }
 
@@ -1144,6 +1078,8 @@ get_expr_operands (tree stmt, tree *expr_p, int flags, voperands_t prev_vops)
       else
        get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags, prev_vops);
 
+      if (code == COMPONENT_REF)
+       get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_none, prev_vops);
       return;
     }
 
@@ -1233,7 +1169,8 @@ get_expr_operands (tree stmt, tree *expr_p, int flags, voperands_t prev_vops)
       || code == TRUTH_AND_EXPR
       || code == TRUTH_OR_EXPR
       || code == TRUTH_XOR_EXPR
-      || code == COMPOUND_EXPR)
+      || code == COMPOUND_EXPR
+      || code == OBJ_TYPE_REF)
     {
       tree op0 = TREE_OPERAND (expr, 0);
       tree op1 = TREE_OPERAND (expr, 1);
This page took 0.039845 seconds and 5 git commands to generate.