aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-07-14 14:15:22 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-07-14 14:15:22 -0400
commitb35c81608887526d18a068f9c84192a7efaf2b25 (patch)
treec0b398487e8aaf1c8bade8ef6a6bd94d09c89785 /gcc/builtins.c
parente02e8e58c405770d1192d849fc2712e65d3f023b (diff)
downloadgcc-b35c81608887526d18a068f9c84192a7efaf2b25.zip
gcc-b35c81608887526d18a068f9c84192a7efaf2b25.tar.gz
gcc-b35c81608887526d18a068f9c84192a7efaf2b25.tar.bz2
builtins.c (can_trust_pointer_alignment): New fn.
* 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. From-SVN: r149635
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index de1984e..a5f41fc 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)))