From 7abca321b6cf84e08125e8ebc2f56b4b6292d133 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 14 Jul 2009 18:15:22 +0000 Subject: * builtins.c (can_trust_pointer_alignment): New fn. (get_pointer_alignment): Factor it out from here. * tree.h: Declare it. * cp/call.c (build_over_call): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149635 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/builtins.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gcc/builtins.c') diff --git a/gcc/builtins.c b/gcc/builtins.c index de1984e5ab5..a5f41fc91f8 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -344,6 +344,16 @@ get_object_alignment (tree exp, unsigned int align, unsigned int max_align) return MIN (align, max_align); } +/* Returns true iff we can trust that alignment information has been + calculated properly. */ + +bool +can_trust_pointer_alignment (void) +{ + /* We rely on TER to compute accurate alignment information. */ + return (optimize && flag_tree_ter); +} + /* Return the alignment in bits of EXP, a pointer valued expression. But don't return more than MAX_ALIGN no matter what. The alignment returned is, by default, the alignment of the thing that @@ -357,8 +367,7 @@ get_pointer_alignment (tree exp, unsigned int max_align) { unsigned int align, inner; - /* We rely on TER to compute accurate alignment information. */ - if (!(optimize && flag_tree_ter)) + if (!can_trust_pointer_alignment ()) return 0; if (!POINTER_TYPE_P (TREE_TYPE (exp))) -- cgit v1.2.1