/* Value Numbering routines for tree expressions.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dan@dberlin.org>, Steven Bosscher
<stevenb@suse.de> and Diego Novillo <dnovillo@redhat.com>
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
expressions_equal_p (tree e1, tree e2)
{
tree te1, te2;
-
+
if (e1 == e2)
return true;
return true;
}
- else if (TREE_CODE (e1) == TREE_CODE (e2)
+ else if (TREE_CODE (e1) == TREE_CODE (e2)
&& (te1 == te2
|| types_compatible_p (te1, te2))
&& operand_equal_p (e1, e2, OEP_PURE_SAME))
}
/* Set the value handle for expression E to value V. */
-
+
void
set_value_handle (tree e, tree v)
{
print_generic_expr (dump_file, v, dump_flags);
fprintf (dump_file, " for ");
print_generic_expr (dump_file, expr, dump_flags);
-
+
if (vuses && VEC_length (tree, vuses) != 0)
{
size_t i;
tree vuse;
-
+
fprintf (dump_file, " vuses: (");
for (i = 0; VEC_iterate (tree, vuses, i, vuse); i++)
{
fprintf (dump_file, ",");
}
fprintf (dump_file, ")");
- }
+ }
fprintf (dump_file, "\n");
}
/* Sort the VUSE array so that we can do equality comparisons
quicker on two vuse vecs. */
-void
+void
sort_vuses (VEC (tree,gc) *vuses)
{
if (VEC_length (tree, vuses) > 1)
/* Sort the VUSE array so that we can do equality comparisons
quicker on two vuse vecs. */
-void
+void
sort_vuses_heap (VEC (tree,heap) *vuses)
{
if (VEC_length (tree, vuses) > 1)
if (TREE_CODE (expr) == CALL_EXPR || DECL_P (expr))
return vn_reference_lookup (expr, NULL);
else if (TREE_CODE (expr) == SSA_NAME)
- return SSA_NAME_VALUE (expr);
+ return SSA_NAME_VALUE (expr);
else if (TREE_CODE (expr) == ADDR_EXPR)
return vn_unary_op_lookup (expr);
/* FALLTHROUGH */
/* Search in the value numbering tables for an existing instance of
expression EXPR, and return its value, or NULL if none has been set. STMT
- represents the stmt associated with EXPR. It is used when computing the
+ represents the stmt associated with EXPR. It is used when computing the
hash value for EXPR for reference operations. */
tree
create_value_handle_for_expr (tree expr, VEC(tree, gc) *vuses)
{
tree v;
-
+
v = make_value_handle (TREE_TYPE (expr));
-
+
if (dump_file && (dump_flags & TDF_DETAILS))
print_creation_to_file (v, expr, vuses);
return v;
vn_lookup_or_add (tree expr)
{
tree v = vn_lookup (expr);
-
+
if (v == NULL_TREE)
{
v = create_value_handle_for_expr (expr, NULL);
vn_lookup_or_add_with_vuses (tree expr, VEC (tree, gc) *vuses)
{
tree v;
-
+
if (!vuses || VEC_length (tree, vuses) == 0)
return vn_lookup_or_add (expr);
-
+
v = vn_lookup_with_vuses (expr, vuses);
if (v == NULL_TREE)
{