OSDN Git Service

2012-04-13 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-sccvn.h
index bd8b9bc..b37b084 100644 (file)
@@ -42,10 +42,18 @@ typedef struct vn_nary_op_s
   hashval_t hashcode;
   tree result;
   tree type;
-  tree op[4];
+  tree op[1];
 } *vn_nary_op_t;
 typedef const struct vn_nary_op_s *const_vn_nary_op_t;
 
+/* Return the size of a vn_nary_op_t with LENGTH operands.  */
+
+static inline size_t
+sizeof_vn_nary_op (unsigned int length)
+{
+  return sizeof (struct vn_nary_op_s) + sizeof (tree) * (length - 1);
+}
+
 /* Phi nodes in the hashtable consist of their non-VN_TOP phi
    arguments, and the basic block the phi is in. Result is the value
    number of the operation, and hashcode is stored to avoid having to
@@ -165,22 +173,22 @@ typedef struct vn_ssa_aux
   unsigned needs_insertion : 1;
 } *vn_ssa_aux_t;
 
+typedef enum { VN_NOWALK, VN_WALK, VN_WALKREWRITE } vn_lookup_kind;
+
 /* Return the value numbering info for an SSA_NAME.  */
 extern vn_ssa_aux_t VN_INFO (tree);
 extern vn_ssa_aux_t VN_INFO_GET (tree);
 tree vn_get_expr_for (tree);
-bool run_scc_vn (void);
+bool run_scc_vn (vn_lookup_kind);
 void free_scc_vn (void);
 tree vn_nary_op_lookup (tree, vn_nary_op_t *);
 tree vn_nary_op_lookup_stmt (gimple, vn_nary_op_t *);
 tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code,
-                              tree, tree, tree, tree, tree,
-                              vn_nary_op_t *);
+                              tree, tree *, vn_nary_op_t *);
 vn_nary_op_t vn_nary_op_insert (tree, tree);
 vn_nary_op_t vn_nary_op_insert_stmt (gimple, tree);
 vn_nary_op_t vn_nary_op_insert_pieces (unsigned int, enum tree_code,
-                                      tree, tree, tree, tree,
-                                      tree, tree, unsigned int);
+                                      tree, tree *, tree, unsigned int);
 void vn_reference_fold_indirect (VEC (vn_reference_op_s, heap) **,
                                 unsigned int *);
 void copy_reference_ops_from_ref (tree, VEC(vn_reference_op_s, heap) **);
@@ -189,8 +197,8 @@ bool ao_ref_init_from_vn_reference (ao_ref *, alias_set_type, tree,
                                    VEC (vn_reference_op_s, heap) *);
 tree vn_reference_lookup_pieces (tree, alias_set_type, tree,
                                 VEC (vn_reference_op_s, heap) *,
-                                vn_reference_t *, bool);
-tree vn_reference_lookup (tree, tree, bool, vn_reference_t *);
+                                vn_reference_t *, vn_lookup_kind);
+tree vn_reference_lookup (tree, tree, vn_lookup_kind, vn_reference_t *);
 vn_reference_t vn_reference_insert (tree, tree, tree);
 vn_reference_t vn_reference_insert_pieces (tree, alias_set_type, tree,
                                           VEC (vn_reference_op_s, heap) *,
@@ -207,4 +215,18 @@ unsigned int get_constant_value_id (tree);
 unsigned int get_or_alloc_constant_value_id (tree);
 bool value_id_constant_p (unsigned int);
 tree fully_constant_vn_reference_p (vn_reference_t);
+
+/* Valueize NAME if it is an SSA name, otherwise just return it.  */
+
+static inline tree
+vn_valueize (tree name)
+{
+  if (TREE_CODE (name) == SSA_NAME)
+    {
+      tree tem = VN_INFO (name)->valnum;
+      return tem == VN_TOP ? name : tem;
+    }
+  return name;
+}
+
 #endif /* TREE_SSA_SCCVN_H  */