diff options
author | Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> | 1998-02-13 02:26:35 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-02-12 21:26:35 -0500 |
commit | 387c47a3801e961f6fa0d7688f2db225a490fe86 (patch) | |
tree | dc560cd0e00fd5fb5c9a70b0623cefd7c8fb813a /gcc | |
parent | e3258cef3011a2f6c8a465b7fb8027dfb24867aa (diff) | |
download | gcc-387c47a3801e961f6fa0d7688f2db225a490fe86.zip gcc-387c47a3801e961f6fa0d7688f2db225a490fe86.tar.gz gcc-387c47a3801e961f6fa0d7688f2db225a490fe86.tar.bz2 |
call.c (build_over_call): Convert builtin abs, labs and fabs to tree-codes.
* call.c (build_over_call): Convert builtin abs, labs and fabs to
tree-codes.
* decl.c (init_decl_processing): Reenable abs, labs and fabs as
builtins.
From-SVN: r17900
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/call.c | 17 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 |
3 files changed, 24 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0054db6..2f1f6f0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +Fri Feb 13 02:26:10 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * call.c (build_over_call): Convert builtin abs, labs and fabs to + tree-codes. + * decl.c (init_decl_processing): Reenable abs, labs and fabs as + builtins. + Fri Feb 13 01:36:42 1998 Jason Merrill <jason@yorick.cygnus.com> * call.c (standard_conversion): A BASE_CONV replaces an RVALUE_CONV. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 299e0a4..424bfd5 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5656,6 +5656,23 @@ build_over_call (fn, convs, args, flags) else fn = build_addr_func (fn); + /* Recognize certain built-in functions so we can make tree-codes + other than CALL_EXPR. We do this when it enables fold-const.c + to do something useful. */ + + if (TREE_CODE (fn) == ADDR_EXPR + && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL + && DECL_BUILT_IN (TREE_OPERAND (fn, 0))) + switch (DECL_FUNCTION_CODE (TREE_OPERAND (fn, 0))) + { + case BUILT_IN_ABS: + case BUILT_IN_LABS: + case BUILT_IN_FABS: + if (converted_args == 0) + return integer_zero_node; + return build_unary_op (ABS_EXPR, TREE_VALUE (converted_args), 0); + } + fn = build_call (fn, TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), converted_args); if (TREE_TYPE (fn) == void_type_node) return fn; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e378f4a..c9eaeb8 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5333,11 +5333,9 @@ init_decl_processing () if (!flag_no_builtin) { -#if 0 /* These do not work well with libg++. */ builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR); builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR); builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR); -#endif builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR); builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS, NULL_PTR); |