From 5c1a2e639a26f1582318ac6f547a8819ea7c6034 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 2 Nov 2015 16:34:16 +0000 Subject: 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 --- gcc/Makefile.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gcc/Makefile.in') diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 7d53a7d..34d2356 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1260,6 +1260,7 @@ OBJS = \ final.o \ fixed-value.o \ fold-const.o \ + fold-const-call.o \ function.o \ fwprop.o \ gcse.o \ @@ -3273,10 +3274,10 @@ PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ prefix.h tree-inline.h $(GIMPLE_PRETTY_PRINT_H) realmpfr.h \ $(IPA_PROP_H) $(TARGET_H) $(RTL_H) $(TM_P_H) $(CFGLOOP_H) $(EMIT_RTL_H) \ version.h stringpool.h gimplify.h gimple-iterator.h gimple-ssa.h \ - fold-const.h tree-cfg.h tree-into-ssa.h tree-ssanames.h print-tree.h \ - varasm.h context.h tree-phinodes.h stor-layout.h ssa-iterators.h \ - $(RESOURCE_H) tree-cfgcleanup.h attribs.h calls.h cfgexpand.h \ - diagnostic-color.h gcc-symtab.h gimple-builder.h gimple-low.h \ + fold-const.h fold-const-call.h tree-cfg.h tree-into-ssa.h tree-ssanames.h \ + print-tree.h varasm.h context.h tree-phinodes.h stor-layout.h \ + ssa-iterators.h $(RESOURCE_H) tree-cfgcleanup.h attribs.h calls.h \ + cfgexpand.h diagnostic-color.h gcc-symtab.h gimple-builder.h gimple-low.h \ gimple-walk.h gimplify-me.h pass_manager.h print-rtl.h stmt.h \ tree-dfa.h tree-hasher.h tree-nested.h tree-object-size.h tree-outof-ssa.h \ tree-parloops.h tree-ssa-address.h tree-ssa-coalesce.h tree-ssa-dom.h \ -- cgit v1.1