aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
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/tree.c
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/tree.c')
-rw-r--r--gcc/tree.c12
1 files changed, 12 insertions, 0 deletions
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. */