aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-09-01 08:41:53 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-09-01 08:41:53 +0000
commit71c00b5c9996d96beed71c4998df027363b19091 (patch)
tree9cd3add9e373b84961bc956ed0b4d7217321694d /gcc
parent58f986ca91089e045b33129a6525bc0e399431e5 (diff)
downloadgcc-71c00b5c9996d96beed71c4998df027363b19091.zip
gcc-71c00b5c9996d96beed71c4998df027363b19091.tar.gz
gcc-71c00b5c9996d96beed71c4998df027363b19091.tar.bz2
tree.c (tree_expr_size): New function.
2009-09-01 Richard Guenther <rguenther@suse.de> * tree.c (tree_expr_size): New function. * tree.h (tree_expr_size): Declare. * rtlanal.c (rtx_addr_can_trap_p_1): Adjust comment. * builtins.c (fold_builtin_memory_op): Use tree_expr_size. * langhooks.c (lhd_expr_size): Remove. * langhooks.h (struct lang_hooks): Remove expr_size. * explow.c (expr_size): Use tree_expr_size. (int_expr_size): Likewise. * langhooks-def.h (lhd_expr_size): Remove. (LANG_HOOKS_EXPR_SIZE): Likewise. (LANG_HOOKS_INITIALIZER): Adjust. cp/ * cp-objcp-common.c (cp_expr_size): Use tree_expr_size. * cp-objcp-common.h (LANG_HOOKS_EXPR_SIZE): Do not define. From-SVN: r151261
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/builtins.c4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/cp-objcp-common.c2
-rw-r--r--gcc/cp/cp-objcp-common.h2
-rw-r--r--gcc/explow.c4
-rw-r--r--gcc/langhooks-def.h3
-rw-r--r--gcc/langhooks.c13
-rw-r--r--gcc/langhooks.h6
-rw-r--r--gcc/rtlanal.c2
-rw-r--r--gcc/tree.c12
-rw-r--r--gcc/tree.h1
12 files changed, 38 insertions, 30 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9b1577c..dc65f0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,19 @@
2009-09-01 Richard Guenther <rguenther@suse.de>
+ * tree.c (tree_expr_size): New function.
+ * tree.h (tree_expr_size): Declare.
+ * rtlanal.c (rtx_addr_can_trap_p_1): Adjust comment.
+ * builtins.c (fold_builtin_memory_op): Use tree_expr_size.
+ * langhooks.c (lhd_expr_size): Remove.
+ * langhooks.h (struct lang_hooks): Remove expr_size.
+ * explow.c (expr_size): Use tree_expr_size.
+ (int_expr_size): Likewise.
+ * langhooks-def.h (lhd_expr_size): Remove.
+ (LANG_HOOKS_EXPR_SIZE): Likewise.
+ (LANG_HOOKS_INITIALIZER): Adjust.
+
+2009-09-01 Richard Guenther <rguenther@suse.de>
+
* tree-flow.h (mark_addressable): Move declaration ...
* tree.h (mark_addressable): ... here.
* stmt.c (expand_asm_operands): Use mark_addressable, not
diff --git a/gcc/builtins.c b/gcc/builtins.c
index ed97d48..7ea899d 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -9092,7 +9092,7 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
srcvar = build_fold_indirect_ref_loc (loc, src);
if (TREE_THIS_VOLATILE (srcvar))
return NULL_TREE;
- else if (!tree_int_cst_equal (lang_hooks.expr_size (srcvar), len))
+ else if (!tree_int_cst_equal (tree_expr_size (srcvar), len))
srcvar = NULL_TREE;
/* With memcpy, it is possible to bypass aliasing rules, so without
this check i.e. execute/20060930-2.c would be misoptimized,
@@ -9110,7 +9110,7 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
destvar = build_fold_indirect_ref_loc (loc, dest);
if (TREE_THIS_VOLATILE (destvar))
return NULL_TREE;
- else if (!tree_int_cst_equal (lang_hooks.expr_size (destvar), len))
+ else if (!tree_int_cst_equal (tree_expr_size (destvar), len))
destvar = NULL_TREE;
else if (!var_decl_component_p (destvar))
destvar = NULL_TREE;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 19c17be..b391672 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2009-09-01 Richard Guenther <rguenther@suse.de>
+ * cp-objcp-common.c (cp_expr_size): Use tree_expr_size.
+ * cp-objcp-common.h (LANG_HOOKS_EXPR_SIZE): Do not define.
+
+2009-09-01 Richard Guenther <rguenther@suse.de>
+
* cp-objcp-common.h (LANG_HOOKS_MARK_ADDRESSABLE): Remove.
2009-08-31 Dodji Seketeli <dodji@redhat.com>
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 2363cd7..32e5530 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -109,7 +109,7 @@ cp_expr_size (const_tree exp)
}
else
/* Use the default code. */
- return lhd_expr_size (exp);
+ return tree_expr_size (exp);
}
/* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index fe8a047..19fce29 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -99,8 +99,6 @@ extern bool cp_function_decl_explicit_p (tree decl);
#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN cp_dump_tree
#undef LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN
#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN cp_type_quals
-#undef LANG_HOOKS_EXPR_SIZE
-#define LANG_HOOKS_EXPR_SIZE cp_expr_size
#undef LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR
#define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR cxx_callgraph_analyze_expr
diff --git a/gcc/explow.c b/gcc/explow.c
index 933eac8..3073ff0 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -246,7 +246,7 @@ expr_size (tree exp)
size = TREE_OPERAND (exp, 1);
else
{
- size = lang_hooks.expr_size (exp);
+ size = tree_expr_size (exp);
gcc_assert (size);
gcc_assert (size == SUBSTITUTE_PLACEHOLDER_IN_EXPR (size, exp));
}
@@ -266,7 +266,7 @@ int_expr_size (tree exp)
size = TREE_OPERAND (exp, 1);
else
{
- size = lang_hooks.expr_size (exp);
+ size = tree_expr_size (exp);
gcc_assert (size);
}
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index afbab6f..aebab55 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -58,7 +58,6 @@ extern void lhd_incomplete_type_error (const_tree, const_tree);
extern tree lhd_type_promotes_to (tree);
extern void lhd_register_builtin_type (tree, const char *);
extern bool lhd_decl_ok_for_sibcall (const_tree);
-extern tree lhd_expr_size (const_tree);
extern size_t lhd_tree_size (enum tree_code);
extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT);
extern tree lhd_expr_to_decl (tree, bool *, bool *);
@@ -100,7 +99,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
#define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function
#define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name
#define LANG_HOOKS_DWARF_NAME lhd_dwarf_name
-#define LANG_HOOKS_EXPR_SIZE lhd_expr_size
#define LANG_HOOKS_TREE_SIZE lhd_tree_size
#define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p
#define LANG_HOOKS_BUILTIN_FUNCTION lhd_builtin_function
@@ -254,7 +252,6 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_DWARF_NAME, \
LANG_HOOKS_TYPES_COMPATIBLE_P, \
LANG_HOOKS_PRINT_ERROR_FUNCTION, \
- LANG_HOOKS_EXPR_SIZE, \
LANG_HOOKS_TO_TARGET_CHARSET, \
LANG_HOOKS_ATTRIBUTE_TABLE, \
LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 194993f..7d2c0b0 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -260,19 +260,6 @@ lhd_tree_dump_type_quals (const_tree t)
return TYPE_QUALS (t);
}
-/* lang_hooks.expr_size: Determine the size of the value of an expression T
- in a language-specific way. Returns a tree for the size in bytes. */
-
-tree
-lhd_expr_size (const_tree exp)
-{
- if (DECL_P (exp)
- && DECL_SIZE_UNIT (exp) != 0)
- return DECL_SIZE_UNIT (exp);
- else
- return size_in_bytes (TREE_TYPE (exp));
-}
-
/* lang_hooks.gimplify_expr re-writes *EXPR_P into GIMPLE form. */
int
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 4a590de..cf3bda0 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -348,12 +348,6 @@ struct lang_hooks
void (*print_error_function) (struct diagnostic_context *, const char *,
struct diagnostic_info *);
- /* Called from expr_size to calculate the size of the value of an
- expression in a language-dependent way. Returns a tree for the size
- in bytes. A frontend can call lhd_expr_size to get the default
- semantics in cases that it doesn't want to handle specially. */
- tree (*expr_size) (const_tree);
-
/* Convert a character from the host's to the target's character
set. The character should be in what C calls the "basic source
character set" (roughly, the set of characters defined by plain
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index aebcfa6..27a46d9 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -293,7 +293,7 @@ rtx_addr_can_trap_p_1 (const_rtx x, HOST_WIDE_INT offset, HOST_WIDE_INT size,
decl = SYMBOL_REF_DECL (x);
/* Else check that the access is in bounds. TODO: restructure
- expr_size/lhd_expr_size/int_expr_size and just use the latter. */
+ expr_size/tree_expr_size/int_expr_size and just use the latter. */
if (!decl)
decl_size = -1;
else if (DECL_P (decl) && DECL_SIZE_UNIT (decl))
diff --git a/gcc/tree.c b/gcc/tree.c
index 60416d3..66ac702 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2194,6 +2194,18 @@ max_int_size_in_bytes (const_tree type)
return size;
}
+
+/* Returns a tree for the size of EXP in bytes. */
+
+tree
+tree_expr_size (const_tree exp)
+{
+ if (DECL_P (exp)
+ && DECL_SIZE_UNIT (exp) != 0)
+ return DECL_SIZE_UNIT (exp);
+ else
+ return size_in_bytes (TREE_TYPE (exp));
+}
/* Return the bit position of FIELD, in bits from the start of the record.
This is a tree of type bitsizetype. */
diff --git a/gcc/tree.h b/gcc/tree.h
index 441612a..110beb1 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4180,6 +4180,7 @@ extern tree expr_last (tree);
extern tree size_in_bytes (const_tree);
extern HOST_WIDE_INT int_size_in_bytes (const_tree);
extern HOST_WIDE_INT max_int_size_in_bytes (const_tree);
+extern tree tree_expr_size (const_tree);
extern tree bit_position (const_tree);
extern HOST_WIDE_INT int_bit_position (const_tree);
extern tree byte_position (const_tree);