diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-11-02 16:34:16 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-11-02 16:34:16 +0000 |
commit | 5c1a2e639a26f1582318ac6f547a8819ea7c6034 (patch) | |
tree | 4ad1a84f126d5e19c09ab7325f6a810a7daf2032 /gcc/fold-const-call.h | |
parent | 6aadd15a4128d8afdca93be311449876cc2dc4d5 (diff) | |
download | gcc-5c1a2e639a26f1582318ac6f547a8819ea7c6034.tar.gz |
Move constant folds for maths functions to new file
The new routines operate on the built-in enum rather than on tree decls.
The idea is to extend this to handle internal functions too, with a
combined enum for both.
The patch also moves fold_fma too, with the same prototype. The long-term
plan is to replace FMA_EXPR with an internal function, for consistency
with the way that things like SQRT will be handled.
Tested on x86_64-linux-gnu, arm-linux-gnueabi and aarch64-linux-gnu.
gcc/
* builtins.h (fold_fma): Move to fold-const-call.h.
* builtins.c: Include fold-const-call.h.
(mathfn_built_in_2): New function, split out from...
(mathfn_built_in_1): ...here.
(do_real_to_int_conversion, fold_const_builtin_pow)
(fold_const_builtin_logb, fold_const_builtin_significand)
(fold_const_builtin_load_exponent, do_mpfr_arg1, do_mpfr_arg2)
(do_mpfr_arg3, do_mpfr_sincos, do_mpfr_bessel_n, do_mpc_arg1): Delete.
(fold_builtin_sincos): Use fold_const_call to handle constants.
(fold_builtin_1, fold_builtin_2, fold_builtin_3): Add explicit
checks for ERROR_MARK. Use fold_const_call to handle constant
folds for math functions.
(fold_fma): Move to fold-const-call.c.
* fold-const.c: Include fold-const-call.h.
* Makefile.in (OBJS): Add fold-const-call.o.
(PLUGIN_HEADERS): Add fold-const-call.h.
* realmpfr.h (real_from_mpfr): Allow the format to be specified
directly.
* realmpfr.c (real_from_mpfr): Likewise.
* fold-const-call.h, fold-const-call.c: New files.
From-SVN: r229669
Diffstat (limited to 'gcc/fold-const-call.h')
-rw-r--r-- | gcc/fold-const-call.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/fold-const-call.h b/gcc/fold-const-call.h new file mode 100644 index 00000000000..6befc9bc10d --- /dev/null +++ b/gcc/fold-const-call.h @@ -0,0 +1,28 @@ +/* Fold calls to built-in and internal functions with constant arguments. + Copyright (C) 2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef GCC_FOLD_CONST_CALL_H +#define GCC_FOLD_CONST_CALL_H + +tree fold_const_call (built_in_function, tree, tree); +tree fold_const_call (built_in_function, tree, tree, tree); +tree fold_const_call (built_in_function, tree, tree, tree, tree); +tree fold_fma (location_t, tree, tree, tree, tree); + +#endif |