Commit 387c47a3 by Andreas Schwab Committed by Jason Merrill

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
parent e3258cef
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.
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment