diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2005-08-17 04:00:21 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2005-08-17 04:00:21 +0000 |
commit | 00d1b1d67536c0dc5737c721030798cde876c38a (patch) | |
tree | 2bb5d9e1189e47b349ef13e5d10f2a801b6115b0 /gcc/fold-const.c | |
parent | f457cf402e8d2ba9a9ac27c74e4af5f9b6259b1e (diff) | |
download | gcc-00d1b1d67536c0dc5737c721030798cde876c38a.zip gcc-00d1b1d67536c0dc5737c721030798cde876c38a.tar.gz gcc-00d1b1d67536c0dc5737c721030798cde876c38a.tar.bz2 |
c-typeck.c (build_function_call): Call fold_buildN_initializer or fold_buildN instead of buildN then...
2005-08-16 James A. Morrison <phython@gcc.gnu.org>
* c-typeck.c (build_function_call): Call fold_buildN_initializer or
fold_buildN instead of buildN then fold_initializer or fold.
(build_unary_op): Likewise.
(build_binary_op): Likewise.
* fold-const.c (fold_initializer): Remove.
(fold_build1_initializer): New function.
(fold_build2_initializer): New function.
(fold_build3_initializer): New function.
* tree.h (fold_initializer): Remove.
(fold_build1_initializer): New function.
(fold_build2_initializer): New function.
(fold_build3_initializer): New function.
From-SVN: r103201
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 62 |
1 files changed, 47 insertions, 15 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6853b41..52a9a42 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10571,33 +10571,65 @@ fold_build3_stat (enum tree_code code, tree type, tree op0, tree op1, tree op2 } /* Perform constant folding and related simplification of initializer - expression EXPR. This behaves identically to "fold" but ignores + expression EXPR. These behave identically to "fold_buildN" but ignore potential run-time traps and exceptions that fold must preserve. */ +#define START_FOLD_INIT \ + int saved_signaling_nans = flag_signaling_nans;\ + int saved_trapping_math = flag_trapping_math;\ + int saved_rounding_math = flag_rounding_math;\ + int saved_trapv = flag_trapv;\ + flag_signaling_nans = 0;\ + flag_trapping_math = 0;\ + flag_rounding_math = 0;\ + flag_trapv = 0 + +#define END_FOLD_INIT \ + flag_signaling_nans = saved_signaling_nans;\ + flag_trapping_math = saved_trapping_math;\ + flag_rounding_math = saved_rounding_math;\ + flag_trapv = saved_trapv + +tree +fold_build1_initializer (enum tree_code code, tree type, tree op) +{ + tree result; + START_FOLD_INIT; + + result = fold_build1 (code, type, op); + + END_FOLD_INIT; + return result; +} + tree -fold_initializer (tree expr) +fold_build2_initializer (enum tree_code code, tree type, tree op0, tree op1) { - int saved_signaling_nans = flag_signaling_nans; - int saved_trapping_math = flag_trapping_math; - int saved_rounding_math = flag_rounding_math; - int saved_trapv = flag_trapv; tree result; + START_FOLD_INIT; + + result = fold_build2 (code, type, op0, op1); - flag_signaling_nans = 0; - flag_trapping_math = 0; - flag_rounding_math = 0; - flag_trapv = 0; + END_FOLD_INIT; + return result; +} - result = fold (expr); +tree +fold_build3_initializer (enum tree_code code, tree type, tree op0, tree op1, + tree op2) +{ + tree result; + START_FOLD_INIT; - flag_signaling_nans = saved_signaling_nans; - flag_trapping_math = saved_trapping_math; - flag_rounding_math = saved_rounding_math; - flag_trapv = saved_trapv; + result = fold_build3 (code, type, op0, op1, op2); + END_FOLD_INIT; return result; } +#undef START_FOLD_INIT +#undef END_FOLD_INIT + /* Determine if first argument is a multiple of second argument. Return 0 if it is not, or we cannot easily determined it to be. |