diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-14 18:15:22 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-14 18:15:22 +0000 |
commit | 7abca321b6cf84e08125e8ebc2f56b4b6292d133 (patch) | |
tree | c0b398487e8aaf1c8bade8ef6a6bd94d09c89785 /gcc/builtins.c | |
parent | 519c979486255f01682f327bb1731a3f609f18b2 (diff) | |
download | gcc-7abca321b6cf84e08125e8ebc2f56b4b6292d133.tar.gz |
* 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
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 13 |
1 files changed, 11 insertions, 2 deletions
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))) |