diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-06-27 18:52:23 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-06-27 18:52:23 +0200 |
commit | 45d439ac1a9e2df33ac7ef573009749dbebf581b (patch) | |
tree | efa39246412ef14d5214fe10b53a962abeab3d20 /gcc/builtins.c | |
parent | dc2a58daabf95cfac0dd346ff717902bdc6e3d93 (diff) | |
download | gcc-45d439ac1a9e2df33ac7ef573009749dbebf581b.zip gcc-45d439ac1a9e2df33ac7ef573009749dbebf581b.tar.gz gcc-45d439ac1a9e2df33ac7ef573009749dbebf581b.tar.bz2 |
builtin-types.def (BT_FN_PTR_CONST_PTR_SIZE_VAR): New.
* builtin-types.def (BT_FN_PTR_CONST_PTR_SIZE_VAR): New.
* builtins.def (BUILT_IN_ASSUME_ALIGNED): New builtin.
* tree-ssa-structalias.c (find_func_aliases_for_builtin_call,
find_func_clobbers): Handle BUILT_IN_ASSUME_ALIGNED.
* tree-ssa-ccp.c (bit_value_assume_aligned): New function.
(evaluate_stmt, execute_fold_all_builtins): Handle
BUILT_IN_ASSUME_ALIGNED.
* tree-ssa-dce.c (propagate_necessity): Likewise.
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1,
call_may_clobber_ref_p_1): Likewise.
* builtins.c (is_simple_builtin, expand_builtin): Likewise.
(expand_builtin_assume_aligned): New function.
* doc/extend.texi (__builtin_assume_aligned): Document.
* c-common.c (check_builtin_function_arguments): Handle
BUILT_IN_ASSUME_ALIGNED.
* gcc.dg/builtin-assume-aligned-1.c: New test.
* gcc.dg/builtin-assume-aligned-2.c: New test.
* gcc.target/i386/builtin-assume-aligned-1.c: New test.
From-SVN: r175541
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 4e8a95f..0747e04 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -4604,6 +4604,23 @@ expand_builtin_expect (tree exp, rtx target) return target; } +/* Expand a call to __builtin_assume_aligned. We just return our first + argument as the builtin_assume_aligned semantic should've been already + executed by CCP. */ + +static rtx +expand_builtin_assume_aligned (tree exp, rtx target) +{ + if (call_expr_nargs (exp) < 2) + return const0_rtx; + target = expand_expr (CALL_EXPR_ARG (exp, 0), target, VOIDmode, + EXPAND_NORMAL); + gcc_assert (!TREE_SIDE_EFFECTS (CALL_EXPR_ARG (exp, 1)) + && (call_expr_nargs (exp) < 3 + || !TREE_SIDE_EFFECTS (CALL_EXPR_ARG (exp, 2)))); + return target; +} + void expand_builtin_trap (void) { @@ -5823,6 +5840,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, return expand_builtin_va_copy (exp); case BUILT_IN_EXPECT: return expand_builtin_expect (exp, target); + case BUILT_IN_ASSUME_ALIGNED: + return expand_builtin_assume_aligned (exp, target); case BUILT_IN_PREFETCH: expand_builtin_prefetch (exp); return const0_rtx; @@ -13461,6 +13480,7 @@ is_simple_builtin (tree decl) case BUILT_IN_OBJECT_SIZE: case BUILT_IN_UNREACHABLE: /* Simple register moves or loads from stack. */ + case BUILT_IN_ASSUME_ALIGNED: case BUILT_IN_RETURN_ADDRESS: case BUILT_IN_EXTRACT_RETURN_ADDR: case BUILT_IN_FROB_RETURN_ADDR: |