This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Implicit generation of runtime calls


Hi,
this patch adds the infrastructure to determine whether the function call can
be produced implicitly or not.  I am doing that by new array of declarations
implicit_built_in_decls that has entry nonzero just for those builtins that are
safe.
In future we may want to modify the declarations so the builtin expansion can
behave differently for implicit calls as they do already for __builtin_XXX calls
and XXX calls.

DEF_BUILTIN now allows to declare whehter the function is available and I've
categorized the functions according to C99 and C90 standards.
I also added the TARGET_C99_FUNCTIONS defined to 1 by default and function
to get the declaration in proper mode so conversions can be done easilly.

Thats it.  In the next step I would like to re-enable the transformation as
next step once this part is polished.  I would also like to turn
TARGET_MEM_FUNCTIONS into this scheme.  I intended to do this in one step but
the patch is getting bigger than I would like it to be already.

I will happily add -fno-c99-builtins switch to configure and manage it to
control TARGET_C99_FUNCTIONS if someone will make me believe that this is good.
I think this is static knowledge about the particular port and the problems
with autoconfiguration being different in different contexts, so it will
bring us problems in reproducing failures reported in cross envorinment
and so on.

I also don't think it makes sense to allow controlling each function
individually.  We already support about 10-20 such functions and the number of
them will increase.  I don't think runtimes are crazy enought to commonly
support just arbitary subset of these, so this would just anoy.  We can invent
1-2 new categories (perhaps there can be category for runtimes deifning sinf
but not sinl or cabs if such exists)

Bootstrapped/regtested mainline.
OK?

Honza

	* builtins.c (DEF_BUILTIN): Accept 10 arguments.
	(implicit_built_in_decls): New global array.
	(mathfn_built_in): New global function.
	(fold_trunc_transparent_mathfn): New static function
	(expand_builtin_strstr, expand_bultin_strchr,
	expand_builtin_strpbrk, expand_builtin_strcpy,
	expand_builtin_strncpy, expand_bultin_strcmp,
	expand_bultin_strncat, expand_builtin_fputs): Use
	implicint_built_in_decls.
	(fold_builtin): Fold floor/trunc/round/ceil/nearbyint.
	* builtins.def: Fix comments.
	(DEF_GCC_BUILTIN, DEF_FALLBACK_BUILTIN, DEF_EXT_FALLBACK_BUILTIN,
	DEF_LIB_BUILTIN, DEF_LIB_ALWAYS_BUILTIN, DEF_EXT_LIB_BUILTIN,
	DEF_C99_BULTIN, DEF_FRONT_END_LIB_BUILTIN,
	DEF_EXT_FRONT_END_LIB_BUILTIN): Pass implicit as needed.
	(DEF_C99_C90RES_BULTIN): New.
	(*f, *l builtins): Update.
	* c-common.c (DEF_BUILTIN): Initialize implicit array.
	(c_expand_builtin_printf, c_expand_builtin_fprintf): Update.
	* convert.c (strip_float_extensions): New global function.
	* tree.h (DEF_BUILTIN): Accept 10 arguments.
	(implicit_built_in_decls, mathfn_built_in, strip_float_extension):
	Declare.
	* java/builtins.c (define_builtin): Handle implicit.
	(DEF_BUILTIN): Update.
	* tm.texi (TARGET_C99_FUNCTIONS): Document.
	* defaults.h (TARGET_C99_FUNCTIONS): Default to 0.

Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.166
diff -c -3 -p -r1.166 builtins.c
*** builtins.c	16 Dec 2002 18:18:59 -0000	1.166
--- builtins.c	17 Dec 2002 22:02:45 -0000
*************** Software Foundation, 59 Temple Place - S
*** 64,70 ****
  const char *const built_in_class_names[4]
    = {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"};
  
! #define DEF_BUILTIN(X, N, C, T, LT, B, F, NA, AT) STRINGX(X),
  const char *const built_in_names[(int) END_BUILTINS] =
  {
  #include "builtins.def"
--- 64,70 ----
  const char *const built_in_class_names[4]
    = {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"};
  
! #define DEF_BUILTIN(X, N, C, T, LT, B, F, NA, AT, IM) STRINGX(X),
  const char *const built_in_names[(int) END_BUILTINS] =
  {
  #include "builtins.def"
*************** const char *const built_in_names[(int) E
*** 74,79 ****
--- 74,83 ----
  /* Setup an array of _DECL trees, make sure each element is
     initialized to NULL_TREE.  */
  tree built_in_decls[(int) END_BUILTINS];
+ /* Declarations used when constructing the builtin implicitly in the compiler.
+    It may be NULL_TREE when this is invalid (for instance runtime is not
+    required to implement the function call in all cases.  */
+ tree implicit_built_in_decls[(int) END_BUILTINS];
  
  static int get_pointer_alignment	PARAMS ((tree, unsigned int));
  static tree c_strlen			PARAMS ((tree));
*************** static tree fold_builtin_classify_type	P
*** 153,158 ****
--- 157,163 ----
  static tree fold_builtin_inf		PARAMS ((tree, int));
  static tree fold_builtin_nan		PARAMS ((tree, tree, int));
  static int validate_arglist		PARAMS ((tree, ...));
+ static tree fold_trunc_transparent_mathfn PARAMS ((tree));
  
  /* Return the alignment in bits of EXP, a pointer valued expression.
     But don't return more than MAX_ALIGN no matter what.
*************** expand_builtin_constant_p (exp)
*** 1469,1474 ****
--- 1474,1643 ----
    return tmp;
  }
  
+ /* Return mathematic function equivalent to FN but operating directly on TYPE,
+    if available.  */
+ tree
+ mathfn_built_in (type, fn)
+      tree type;
+      enum built_in_function fn;
+ {
+   enum built_in_function fcode = NOT_BUILT_IN;
+   if (TYPE_MODE (type) == TYPE_MODE (double_type_node))
+     switch (fn)
+       {
+       case BUILT_IN_SQRT:
+       case BUILT_IN_SQRTF:
+       case BUILT_IN_SQRTL:
+ 	fcode = BUILT_IN_SQRT;
+ 	break;
+       case BUILT_IN_SIN:
+       case BUILT_IN_SINF:
+       case BUILT_IN_SINL:
+ 	fcode = BUILT_IN_SIN;
+ 	break;
+       case BUILT_IN_COS:
+       case BUILT_IN_COSF:
+       case BUILT_IN_COSL:
+ 	fcode = BUILT_IN_COS;
+ 	break;
+       case BUILT_IN_EXP:
+       case BUILT_IN_EXPF:
+       case BUILT_IN_EXPL:
+ 	fcode = BUILT_IN_EXP;
+ 	break;
+       case BUILT_IN_FLOOR:
+       case BUILT_IN_FLOORF:
+       case BUILT_IN_FLOORL:
+ 	fcode = BUILT_IN_FLOOR;
+ 	break;
+       case BUILT_IN_CEIL:
+       case BUILT_IN_CEILF:
+       case BUILT_IN_CEILL:
+ 	fcode = BUILT_IN_CEIL;
+ 	break;
+       case BUILT_IN_TRUNC:
+       case BUILT_IN_TRUNCF:
+       case BUILT_IN_TRUNCL:
+ 	fcode = BUILT_IN_TRUNC;
+ 	break;
+       case BUILT_IN_ROUND:
+       case BUILT_IN_ROUNDF:
+       case BUILT_IN_ROUNDL:
+ 	fcode = BUILT_IN_ROUND;
+ 	break;
+       case BUILT_IN_NEARBYINT:
+       case BUILT_IN_NEARBYINTF:
+       case BUILT_IN_NEARBYINTL:
+ 	fcode = BUILT_IN_NEARBYINT;
+ 	break;
+       default:
+ 	abort ();
+       }
+   else if (TYPE_MODE (type) == TYPE_MODE (float_type_node))
+     switch (fn)
+       {
+       case BUILT_IN_SQRT:
+       case BUILT_IN_SQRTF:
+       case BUILT_IN_SQRTL:
+ 	fcode = BUILT_IN_SQRTF;
+ 	break;
+       case BUILT_IN_SIN:
+       case BUILT_IN_SINF:
+       case BUILT_IN_SINL:
+ 	fcode = BUILT_IN_SINF;
+ 	break;
+       case BUILT_IN_COS:
+       case BUILT_IN_COSF:
+       case BUILT_IN_COSL:
+ 	fcode = BUILT_IN_COSF;
+ 	break;
+       case BUILT_IN_EXP:
+       case BUILT_IN_EXPF:
+       case BUILT_IN_EXPL:
+ 	fcode = BUILT_IN_EXPF;
+ 	break;
+       case BUILT_IN_FLOOR:
+       case BUILT_IN_FLOORF:
+       case BUILT_IN_FLOORL:
+ 	fcode = BUILT_IN_FLOORF;
+ 	break;
+       case BUILT_IN_CEIL:
+       case BUILT_IN_CEILF:
+       case BUILT_IN_CEILL:
+ 	fcode = BUILT_IN_CEILF;
+ 	break;
+       case BUILT_IN_TRUNC:
+       case BUILT_IN_TRUNCF:
+       case BUILT_IN_TRUNCL:
+ 	fcode = BUILT_IN_TRUNCF;
+ 	break;
+       case BUILT_IN_ROUND:
+       case BUILT_IN_ROUNDF:
+       case BUILT_IN_ROUNDL:
+ 	fcode = BUILT_IN_ROUNDF;
+ 	break;
+       case BUILT_IN_NEARBYINT:
+       case BUILT_IN_NEARBYINTF:
+       case BUILT_IN_NEARBYINTL:
+ 	fcode = BUILT_IN_NEARBYINTF;
+ 	break;
+       default:
+ 	abort ();
+       }
+   else if (TYPE_MODE (type) == TYPE_MODE (long_double_type_node))
+     switch (fn)
+       {
+       case BUILT_IN_SQRT:
+       case BUILT_IN_SQRTF:
+       case BUILT_IN_SQRTL:
+ 	fcode = BUILT_IN_SQRTL;
+ 	break;
+       case BUILT_IN_SIN:
+       case BUILT_IN_SINF:
+       case BUILT_IN_SINL:
+ 	fcode = BUILT_IN_SINL;
+ 	break;
+       case BUILT_IN_COS:
+       case BUILT_IN_COSF:
+       case BUILT_IN_COSL:
+ 	fcode = BUILT_IN_COSL;
+ 	break;
+       case BUILT_IN_EXP:
+       case BUILT_IN_EXPF:
+       case BUILT_IN_EXPL:
+ 	fcode = BUILT_IN_EXPL;
+ 	break;
+       case BUILT_IN_FLOOR:
+       case BUILT_IN_FLOORF:
+       case BUILT_IN_FLOORL:
+ 	fcode = BUILT_IN_FLOORL;
+ 	break;
+       case BUILT_IN_CEIL:
+       case BUILT_IN_CEILF:
+       case BUILT_IN_CEILL:
+ 	fcode = BUILT_IN_CEILL;
+ 	break;
+       case BUILT_IN_TRUNC:
+       case BUILT_IN_TRUNCF:
+       case BUILT_IN_TRUNCL:
+ 	fcode = BUILT_IN_TRUNCL;
+ 	break;
+       case BUILT_IN_ROUND:
+       case BUILT_IN_ROUNDF:
+       case BUILT_IN_ROUNDL:
+ 	fcode = BUILT_IN_ROUNDL;
+ 	break;
+       case BUILT_IN_NEARBYINT:
+       case BUILT_IN_NEARBYINTF:
+       case BUILT_IN_NEARBYINTL:
+ 	fcode = BUILT_IN_NEARBYINTL;
+ 	break;
+       default:
+ 	abort ();
+       }
+   return implicit_built_in_decls[fcode];
+ }
+ 
  /* Expand a call to one of the builtin math functions (sin, cos, or sqrt).
     Return 0 if a normal call should be emitted rather than expanding the
     function in-line.  EXP is the expression that is a call to the builtin
*************** expand_builtin_strstr (arglist, target, 
*** 1756,1762 ****
        if (p2[1] != '\0')
  	return 0;
  
!       fn = built_in_decls[BUILT_IN_STRCHR];
        if (!fn)
  	return 0;
  
--- 1925,1931 ----
        if (p2[1] != '\0')
  	return 0;
  
!       fn = implicit_built_in_decls[BUILT_IN_STRCHR];
        if (!fn)
  	return 0;
  
*************** expand_builtin_strrchr (arglist, target,
*** 1860,1866 ****
        if (! integer_zerop (s2))
  	return 0;
  
!       fn = built_in_decls[BUILT_IN_STRCHR];
        if (!fn)
  	return 0;
  
--- 2029,2035 ----
        if (! integer_zerop (s2))
  	return 0;
  
!       fn = implicit_built_in_decls[BUILT_IN_STRCHR];
        if (!fn)
  	return 0;
  
*************** expand_builtin_strpbrk (arglist, target,
*** 1918,1924 ****
        if (p2[1] != '\0')
  	return 0;  /* Really call strpbrk.  */
  
!       fn = built_in_decls[BUILT_IN_STRCHR];
        if (!fn)
  	return 0;
  
--- 2087,2093 ----
        if (p2[1] != '\0')
  	return 0;  /* Really call strpbrk.  */
  
!       fn = implicit_built_in_decls[BUILT_IN_STRCHR];
        if (!fn)
  	return 0;
  
*************** expand_builtin_strcpy (exp, target, mode
*** 2057,2063 ****
    if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
      return 0;
  
!   fn = built_in_decls[BUILT_IN_MEMCPY];
    if (!fn)
      return 0;
  
--- 2226,2232 ----
    if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
      return 0;
  
!   fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
    if (!fn)
      return 0;
  
*************** expand_builtin_strncpy (arglist, target,
*** 2159,2165 ****
  	}
  
        /* OK transform into builtin memcpy.  */
!       fn = built_in_decls[BUILT_IN_MEMCPY];
        if (!fn)
  	return 0;
        return expand_expr (build_function_call_expr (fn, arglist),
--- 2328,2334 ----
  	}
  
        /* OK transform into builtin memcpy.  */
!       fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
        if (!fn)
  	return 0;
        return expand_expr (build_function_call_expr (fn, arglist),
*************** expand_builtin_strcmp (exp, target, mode
*** 2575,2581 ****
    if (TREE_SIDE_EFFECTS (len))
      return 0;
  
!   fn = built_in_decls[BUILT_IN_MEMCMP];
    if (!fn)
      return 0;
  
--- 2744,2750 ----
    if (TREE_SIDE_EFFECTS (len))
      return 0;
  
!   fn = implicit_built_in_decls[BUILT_IN_MEMCMP];
    if (!fn)
      return 0;
  
*************** expand_builtin_strncmp (exp, target, mod
*** 2669,2675 ****
    if (!len)
      return 0;
  
!   fn = built_in_decls[BUILT_IN_MEMCMP];
    if (!fn)
      return 0;
  
--- 2838,2844 ----
    if (!len)
      return 0;
  
!   fn = implicit_built_in_decls[BUILT_IN_MEMCMP];
    if (!fn)
      return 0;
  
*************** expand_builtin_strncat (arglist, target,
*** 2750,2756 ****
  	{
  	  tree newarglist
  	    = tree_cons (NULL_TREE, dst, build_tree_list (NULL_TREE, src));
! 	  tree fn = built_in_decls[BUILT_IN_STRCAT];
  
  	  /* If the replacement _DECL isn't initialized, don't do the
  	     transformation.  */
--- 2919,2925 ----
  	{
  	  tree newarglist
  	    = tree_cons (NULL_TREE, dst, build_tree_list (NULL_TREE, src));
! 	  tree fn = implicit_built_in_decls[BUILT_IN_STRCAT];
  
  	  /* If the replacement _DECL isn't initialized, don't do the
  	     transformation.  */
*************** expand_builtin_strcspn (arglist, target,
*** 2838,2844 ****
        if (p2 && *p2 == '\0')
  	{
  	  tree newarglist = build_tree_list (NULL_TREE, s1),
! 	    fn = built_in_decls[BUILT_IN_STRLEN];
  
  	  /* If the replacement _DECL isn't initialized, don't do the
  	     transformation.  */
--- 3007,3013 ----
        if (p2 && *p2 == '\0')
  	{
  	  tree newarglist = build_tree_list (NULL_TREE, s1),
! 	    fn = implicit_built_in_decls[BUILT_IN_STRLEN];
  
  	  /* If the replacement _DECL isn't initialized, don't do the
  	     transformation.  */
*************** expand_builtin_fputs (arglist, ignore, u
*** 3445,3454 ****
       int unlocked;
  {
    tree len, fn;
!   tree fn_fputc = unlocked ? built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
!     : built_in_decls[BUILT_IN_FPUTC];
!   tree fn_fwrite = unlocked ? built_in_decls[BUILT_IN_FWRITE_UNLOCKED]
!     : built_in_decls[BUILT_IN_FWRITE];
  
    /* If the return value is used, or the replacement _DECL isn't
       initialized, don't do the transformation.  */
--- 3614,3623 ----
       int unlocked;
  {
    tree len, fn;
!   tree fn_fputc = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
!     : implicit_built_in_decls[BUILT_IN_FPUTC];
!   tree fn_fwrite = unlocked ? implicit_built_in_decls[BUILT_IN_FWRITE_UNLOCKED]
!     : implicit_built_in_decls[BUILT_IN_FWRITE];
  
    /* If the return value is used, or the replacement _DECL isn't
       initialized, don't do the transformation.  */
Index: builtins.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.def,v
retrieving revision 1.40
diff -c -3 -p -r1.40 builtins.def
*** builtins.def	16 Dec 2002 18:19:00 -0000	1.40
--- builtins.def	17 Dec 2002 22:02:46 -0000
*************** Software Foundation, 59 Temple Place - S
*** 22,28 ****
  /* Before including this file, you should define a macro:
  
       DEF_BUILTIN (ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P,
!                   FALLBACK_P, NONANSI_P, ATTRS)
  
     This macro will be called once for each builtin function.  The
     ENUM will be of type `enum built_in_function', and will indicate
--- 22,28 ----
  /* Before including this file, you should define a macro:
  
       DEF_BUILTIN (ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P,
!                   FALLBACK_P, NONANSI_P, ATTRS, IMPLICIT)
  
     This macro will be called once for each builtin function.  The
     ENUM will be of type `enum built_in_function', and will indicate
*************** Software Foundation, 59 Temple Place - S
*** 53,59 ****
     exist when compiling in ANSI conformant mode.
  
     ATTRs is an attribute list as defined in builtin-attrs.def that
!    describes the attributes of this builtin function.  */
     
  /* A GCC builtin (like __builtin_saveregs) is provided by the
     compiler, but does not correspond to a function in the standard
--- 53,65 ----
     exist when compiling in ANSI conformant mode.
  
     ATTRs is an attribute list as defined in builtin-attrs.def that
!    describes the attributes of this builtin function.  
! 
!    IMPLICIT specifies condition when the builtin can be produced by
!    compiler.  For instance C90 reserves floorf function, but does not
!    define it's meaning.  When user uses floorf we may assume that the
!    floorf has the meaning we expect, but we can't produce floorf by
!    simplifing floor((double)float) since runtime don't need to implement it.  */
     
  /* A GCC builtin (like __builtin_saveregs) is provided by the
     compiler, but does not correspond to a function in the standard
*************** Software Foundation, 59 Temple Place - S
*** 61,67 ****
  #undef DEF_GCC_BUILTIN
  #define DEF_GCC_BUILTIN(ENUM, NAME, TYPE, ATTRS)		\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, BT_LAST,	\
!                false, false, false, ATTRS)
  
  
  /* A fallback builtin is a builtin (like __builtin_puts) that falls
--- 67,73 ----
  #undef DEF_GCC_BUILTIN
  #define DEF_GCC_BUILTIN(ENUM, NAME, TYPE, ATTRS)		\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, BT_LAST,	\
!                false, false, false, ATTRS, true)
  
  
  /* A fallback builtin is a builtin (like __builtin_puts) that falls
*************** Software Foundation, 59 Temple Place - S
*** 71,77 ****
  #undef DEF_FALLBACK_BUILTIN				
  #define DEF_FALLBACK_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
! 	       false, true, false, ATTRS)
  
  /* Like DEF_FALLBACK_BUILTIN, except that the function is not one that
     is specified by ANSI/ISO C.  So, when we're being fully conformant
--- 77,83 ----
  #undef DEF_FALLBACK_BUILTIN				
  #define DEF_FALLBACK_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
! 	       false, true, false, ATTRS, true)
  
  /* Like DEF_FALLBACK_BUILTIN, except that the function is not one that
     is specified by ANSI/ISO C.  So, when we're being fully conformant
*************** Software Foundation, 59 Temple Place - S
*** 80,86 ****
  #undef DEF_EXT_FALLBACK_BUILTIN
  #define DEF_EXT_FALLBACK_BUILTIN(ENUM, NAME, TYPE)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
! 	       false, true, true, ATTR_NOTHROW_LIST)
  
  /* A library builtin (like __builtin_strchr) is a builtin equivalent
     of an ANSI/ISO standard library function.  In addition to the
--- 86,92 ----
  #undef DEF_EXT_FALLBACK_BUILTIN
  #define DEF_EXT_FALLBACK_BUILTIN(ENUM, NAME, TYPE)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
! 	       false, true, true, ATTR_NOTHROW_LIST, true)
  
  /* A library builtin (like __builtin_strchr) is a builtin equivalent
     of an ANSI/ISO standard library function.  In addition to the
*************** Software Foundation, 59 Temple Place - S
*** 91,104 ****
  #undef DEF_LIB_BUILTIN					
  #define DEF_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
! 	       true, true, false, ATTRS)
  
  /* Like DEF_LIB_BUILTIN, except that a call to the builtin should
     never fall back to the library version.  */
  #undef DEF_LIB_ALWAYS_BUILTIN				
  #define DEF_LIB_ALWAYS_BUILTIN(ENUM, NAME, TYPE)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
!     	       true, false, true, ATTR_CONST_NOTHROW_LIST)
  
  /* Like DEF_LIB_BUILTIN, except that the function is not one that is
     specified by ANSI/ISO C.  So, when we're being fully conformant we
--- 97,110 ----
  #undef DEF_LIB_BUILTIN					
  #define DEF_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
! 	       true, true, false, ATTRS, true)
  
  /* Like DEF_LIB_BUILTIN, except that a call to the builtin should
     never fall back to the library version.  */
  #undef DEF_LIB_ALWAYS_BUILTIN				
  #define DEF_LIB_ALWAYS_BUILTIN(ENUM, NAME, TYPE)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
!     	       true, false, true, ATTR_CONST_NOTHROW_LIST, true)
  
  /* Like DEF_LIB_BUILTIN, except that the function is not one that is
     specified by ANSI/ISO C.  So, when we're being fully conformant we
*************** Software Foundation, 59 Temple Place - S
*** 107,127 ****
  #undef DEF_EXT_LIB_BUILTIN				
  #define DEF_EXT_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
!    	       true, true, true, ATTRS)
  
  /* Like DEF_LIB_BUILTIN, except that the function is only a part of
     the standard in C99 or above.  */
  #undef DEF_C99_BUILTIN					
  #define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
!    	       true, true, !flag_isoc99, ATTRS)
  
  /* Like DEF_LIB_BUILTIN, except that the function is expanded in the
     front-end.  */
  #undef DEF_FRONT_END_LIB_BUILTIN			
  #define DEF_FRONT_END_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE,	\
! 	       true, true, false, ATTRS)
  
  /* Like DEF_FRONT_END_LIB_BUILTIN, except that the function is not one
     that is specified by ANSI/ISO C.  So, when we're being fully
--- 113,141 ----
  #undef DEF_EXT_LIB_BUILTIN				
  #define DEF_EXT_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
!    	       true, true, true, ATTRS, false)
  
  /* Like DEF_LIB_BUILTIN, except that the function is only a part of
     the standard in C99 or above.  */
  #undef DEF_C99_BUILTIN					
  #define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
!    	       true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS)
! 
! /* Builtin that is specified by C99 and C90 reserve the name for future use.
!    We can still recognize the builtin in C90 mode but we can't produce it
!    implicitly.  */
! #undef DEF_C99_C90RES_BUILTIN					
! #define DEF_C99_C90RES_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
!   DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
!    	       true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS)
  
  /* Like DEF_LIB_BUILTIN, except that the function is expanded in the
     front-end.  */
  #undef DEF_FRONT_END_LIB_BUILTIN			
  #define DEF_FRONT_END_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE,	\
! 	       true, true, false, ATTRS, true)
  
  /* Like DEF_FRONT_END_LIB_BUILTIN, except that the function is not one
     that is specified by ANSI/ISO C.  So, when we're being fully
*************** Software Foundation, 59 Temple Place - S
*** 130,142 ****
  #undef DEF_EXT_FRONT_END_LIB_BUILTIN			
  #define DEF_EXT_FRONT_END_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE,	\
! 	       true, true, true, ATTRS)
  
  /* A built-in that is not currently used.  */
  #undef DEF_UNUSED_BUILTIN					
  #define DEF_UNUSED_BUILTIN(X)					\
    DEF_BUILTIN (X, (const char *) NULL, NOT_BUILT_IN, BT_LAST,	\
! 	       BT_LAST, false, false, false, ATTR_NOTHROW_LIST)
  
  /* If SMALL_STACK is defined, then `alloca' is only defined in its
     `__builtin' form.  */
--- 144,156 ----
  #undef DEF_EXT_FRONT_END_LIB_BUILTIN			
  #define DEF_EXT_FRONT_END_LIB_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
    DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE,	\
! 	       true, true, true, ATTRS, true)
  
  /* A built-in that is not currently used.  */
  #undef DEF_UNUSED_BUILTIN					
  #define DEF_UNUSED_BUILTIN(X)					\
    DEF_BUILTIN (X, (const char *) NULL, NOT_BUILT_IN, BT_LAST,	\
! 	       BT_LAST, false, false, false, ATTR_NOTHROW_LIST, false)
  
  /* If SMALL_STACK is defined, then `alloca' is only defined in its
     `__builtin' form.  */
*************** DEF_LIB_BUILTIN(BUILT_IN_FLOOR,
*** 173,199 ****
                  "__builtin_floor",
                  BT_FN_DOUBLE_DOUBLE,
  		ATTR_CONST_NOTHROW_LIST)
! DEF_LIB_BUILTIN(BUILT_IN_FLOORF,
!                 "__builtin_floorf",
!                 BT_FN_FLOAT_FLOAT,
! 		ATTR_CONST_NOTHROW_LIST)
! DEF_LIB_BUILTIN(BUILT_IN_FLOORL,
!                 "__builtin_floorl",
!                 BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		ATTR_CONST_NOTHROW_LIST)
  
  DEF_LIB_BUILTIN(BUILT_IN_CEIL,
                  "__builtin_ceil",
                  BT_FN_DOUBLE_DOUBLE,
  		ATTR_CONST_NOTHROW_LIST)
! DEF_LIB_BUILTIN(BUILT_IN_CEILF,
!                 "__builtin_ceilf",
!                 BT_FN_FLOAT_FLOAT,
! 		ATTR_CONST_NOTHROW_LIST)
! DEF_LIB_BUILTIN(BUILT_IN_CEILL,
! 		"__builtin_ceill",
! 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		ATTR_CONST_NOTHROW_LIST)
  
  DEF_C99_BUILTIN(BUILT_IN_ROUND,
  		"__builtin_round",
--- 187,213 ----
                  "__builtin_floor",
                  BT_FN_DOUBLE_DOUBLE,
  		ATTR_CONST_NOTHROW_LIST)
! DEF_C99_C90RES_BUILTIN(BUILT_IN_FLOORF,
! 		       "__builtin_floorf",
! 		       BT_FN_FLOAT_FLOAT,
! 		       ATTR_CONST_NOTHROW_LIST)
! DEF_C99_C90RES_BUILTIN(BUILT_IN_FLOORL,
! 		       "__builtin_floorl",
! 		       BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		       ATTR_CONST_NOTHROW_LIST)
  
  DEF_LIB_BUILTIN(BUILT_IN_CEIL,
                  "__builtin_ceil",
                  BT_FN_DOUBLE_DOUBLE,
  		ATTR_CONST_NOTHROW_LIST)
! DEF_C99_C90RES_BUILTIN(BUILT_IN_CEILF,
! 		       "__builtin_ceilf",
! 		       BT_FN_FLOAT_FLOAT,
! 		       ATTR_CONST_NOTHROW_LIST)
! DEF_C99_C90RES_BUILTIN(BUILT_IN_CEILL,
! 		       "__builtin_ceill",
! 		       BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		       ATTR_CONST_NOTHROW_LIST)
  
  DEF_C99_BUILTIN(BUILT_IN_ROUND,
  		"__builtin_round",
*************** DEF_BUILTIN (BUILT_IN_BZERO,
*** 295,308 ****
  	     BT_FN_VOID_PTR_SIZE, 
  	     BT_FN_VOID_VAR,
  	     true, true, true,
! 	     ATTR_NOTHROW_LIST)
  DEF_BUILTIN (BUILT_IN_BCMP,
  	     "__builtin_bcmp",
  	     BUILT_IN_NORMAL,
  	     BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
  	     BT_FN_INT_VAR,
  	     true, true, true,
! 	     ATTR_PURE_NOTHROW_LIST)
  
  DEF_EXT_LIB_BUILTIN(BUILT_IN_FFS,
  		    "__builtin_ffs",
--- 309,322 ----
  	     BT_FN_VOID_PTR_SIZE, 
  	     BT_FN_VOID_VAR,
  	     true, true, true,
! 	     ATTR_NOTHROW_LIST, false)
  DEF_BUILTIN (BUILT_IN_BCMP,
  	     "__builtin_bcmp",
  	     BUILT_IN_NORMAL,
  	     BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
  	     BT_FN_INT_VAR,
  	     true, true, true,
! 	     ATTR_PURE_NOTHROW_LIST, false)
  
  DEF_EXT_LIB_BUILTIN(BUILT_IN_FFS,
  		    "__builtin_ffs",
*************** DEF_LIB_BUILTIN(BUILT_IN_LOG,
*** 414,481 ****
  				: (flag_unsafe_math_optimizations
  				   ? ATTR_CONST_NOTHROW_LIST
  				   : ATTR_PURE_NOTHROW_LIST))
! DEF_LIB_BUILTIN(BUILT_IN_SQRTF,
! 		"__builtin_sqrtf",
! 		BT_FN_FLOAT_FLOAT,
! 		flag_errno_math ? ATTR_NOTHROW_LIST
! 				: (flag_unsafe_math_optimizations
! 				   ? ATTR_CONST_NOTHROW_LIST
! 				   : ATTR_PURE_NOTHROW_LIST))
! DEF_LIB_BUILTIN(BUILT_IN_SINF,
! 		"__builtin_sinf",
! 		BT_FN_FLOAT_FLOAT,
! 		flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
! 					       : ATTR_PURE_NOTHROW_LIST)
! DEF_LIB_BUILTIN(BUILT_IN_COSF,
! 		"__builtin_cosf",
! 		BT_FN_FLOAT_FLOAT,
! 		flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
! 					       : ATTR_PURE_NOTHROW_LIST)
! DEF_LIB_BUILTIN(BUILT_IN_EXPF,
! 		"__builtin_expf",
! 		BT_FN_FLOAT_FLOAT,
! 		flag_errno_math ? ATTR_NOTHROW_LIST
! 				: (flag_unsafe_math_optimizations
! 				   ? ATTR_CONST_NOTHROW_LIST
! 				   : ATTR_PURE_NOTHROW_LIST))
! DEF_LIB_BUILTIN(BUILT_IN_LOGF,
! 		"__builtin_logf",
! 		BT_FN_FLOAT_FLOAT,
! 		flag_errno_math ? ATTR_NOTHROW_LIST
! 				: (flag_unsafe_math_optimizations
! 				   ? ATTR_CONST_NOTHROW_LIST
! 				   : ATTR_PURE_NOTHROW_LIST))
! DEF_LIB_BUILTIN(BUILT_IN_SQRTL,
! 		"__builtin_sqrtl",
! 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		flag_errno_math ? ATTR_NOTHROW_LIST
! 				: (flag_unsafe_math_optimizations
! 				   ? ATTR_CONST_NOTHROW_LIST
! 				   : ATTR_PURE_NOTHROW_LIST))
! DEF_LIB_BUILTIN(BUILT_IN_SINL,
! 		"__builtin_sinl",
! 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
! 					       : ATTR_PURE_NOTHROW_LIST)
! DEF_LIB_BUILTIN(BUILT_IN_COSL,
! 		"__builtin_cosl",
! 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
! 					       : ATTR_PURE_NOTHROW_LIST)
! DEF_LIB_BUILTIN(BUILT_IN_EXPL,
! 		"__builtin_expl",
! 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		flag_errno_math ? ATTR_NOTHROW_LIST
! 				: (flag_unsafe_math_optimizations
! 				   ? ATTR_CONST_NOTHROW_LIST
! 				   : ATTR_PURE_NOTHROW_LIST))
! DEF_LIB_BUILTIN(BUILT_IN_LOGL,
! 		"__builtin_logl",
! 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		flag_errno_math ? ATTR_NOTHROW_LIST
! 				: (flag_unsafe_math_optimizations
! 				   ? ATTR_CONST_NOTHROW_LIST
! 				   : ATTR_PURE_NOTHROW_LIST))
  
  DEF_GCC_BUILTIN(BUILT_IN_INF,
  		"__builtin_inf",
--- 428,495 ----
  				: (flag_unsafe_math_optimizations
  				   ? ATTR_CONST_NOTHROW_LIST
  				   : ATTR_PURE_NOTHROW_LIST))
! DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTF,
! 		       "__builtin_sqrtf",
! 		       BT_FN_FLOAT_FLOAT,
! 		       flag_errno_math ? ATTR_NOTHROW_LIST
! 				       : (flag_unsafe_math_optimizations
! 					  ? ATTR_CONST_NOTHROW_LIST
! 					  : ATTR_PURE_NOTHROW_LIST))
! DEF_C99_C90RES_BUILTIN(BUILT_IN_SINF,
! 		       "__builtin_sinf",
! 		       BT_FN_FLOAT_FLOAT,
! 		       flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
! 						      : ATTR_PURE_NOTHROW_LIST)
! DEF_C99_C90RES_BUILTIN(BUILT_IN_COSF,
! 		       "__builtin_cosf",
! 		       BT_FN_FLOAT_FLOAT,
! 		       flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
! 						      : ATTR_PURE_NOTHROW_LIST)
! DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPF,
! 		       "__builtin_expf",
! 		       BT_FN_FLOAT_FLOAT,
! 		       flag_errno_math ? ATTR_NOTHROW_LIST
! 				       : (flag_unsafe_math_optimizations
! 					  ? ATTR_CONST_NOTHROW_LIST
! 					  : ATTR_PURE_NOTHROW_LIST))
! DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGF,
! 		       "__builtin_logf",
! 		       BT_FN_FLOAT_FLOAT,
! 		       flag_errno_math ? ATTR_NOTHROW_LIST
! 				       : (flag_unsafe_math_optimizations
! 					  ? ATTR_CONST_NOTHROW_LIST
! 					  : ATTR_PURE_NOTHROW_LIST))
! DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTL,
! 		       "__builtin_sqrtl",
! 		       BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		       flag_errno_math ? ATTR_NOTHROW_LIST
! 				       : (flag_unsafe_math_optimizations
! 					  ? ATTR_CONST_NOTHROW_LIST
! 					  : ATTR_PURE_NOTHROW_LIST))
! DEF_C99_C90RES_BUILTIN(BUILT_IN_SINL,
! 		       "__builtin_sinl",
! 		       BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		       flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
! 						      : ATTR_PURE_NOTHROW_LIST)
! DEF_C99_C90RES_BUILTIN(BUILT_IN_COSL,
! 		       "__builtin_cosl",
! 		       BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		       flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
! 						      : ATTR_PURE_NOTHROW_LIST)
! DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPL,
! 		       "__builtin_expl",
! 		       BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		       flag_errno_math ? ATTR_NOTHROW_LIST
! 				       : (flag_unsafe_math_optimizations
! 					  ? ATTR_CONST_NOTHROW_LIST
! 					  : ATTR_PURE_NOTHROW_LIST))
! DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGL,
! 		       "__builtin_logl",
! 		       BT_FN_LONG_DOUBLE_LONG_DOUBLE,
! 		       flag_errno_math ? ATTR_NOTHROW_LIST
! 				       : (flag_unsafe_math_optimizations
! 					  ? ATTR_CONST_NOTHROW_LIST
! 					  : ATTR_PURE_NOTHROW_LIST))
  
  DEF_GCC_BUILTIN(BUILT_IN_INF,
  		"__builtin_inf",
*************** DEF_BUILTIN (BUILT_IN_FPUTS,
*** 616,622 ****
  	     BUILT_IN_NORMAL,
  	     BT_FN_INT_CONST_STRING_PTR,
  	     BT_FN_INT_VAR,
! 	     true, true, false, ATTR_NOTHROW_LIST)
  DEF_FALLBACK_BUILTIN(BUILT_IN_FWRITE,
  		     "__builtin_fwrite",
  		     BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
--- 630,636 ----
  	     BUILT_IN_NORMAL,
  	     BT_FN_INT_CONST_STRING_PTR,
  	     BT_FN_INT_VAR,
! 	     true, true, false, ATTR_NOTHROW_LIST, true)
  DEF_FALLBACK_BUILTIN(BUILT_IN_FWRITE,
  		     "__builtin_fwrite",
  		     BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
*************** DEF_BUILTIN (BUILT_IN_FPUTS_UNLOCKED,
*** 650,656 ****
  	     BUILT_IN_NORMAL,
  	     BT_FN_INT_CONST_STRING_PTR,
  	     BT_FN_INT_VAR,
! 	     true, true, true, ATTR_NOTHROW_LIST)
  DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
  			 "__builtin_fwrite_unlocked",
  			 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR)
--- 664,670 ----
  	     BUILT_IN_NORMAL,
  	     BT_FN_INT_CONST_STRING_PTR,
  	     BT_FN_INT_VAR,
! 	     true, true, true, ATTR_NOTHROW_LIST, true)
  DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
  			 "__builtin_fwrite_unlocked",
  			 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR)
*************** DEF_BUILTIN (BUILT_IN_ABORT,
*** 755,761 ****
  	     BT_FN_VOID,
  	     BT_FN_VOID,
  	     1, 0, 0,
! 	     ATTR_NORETURN_NOTHROW_LIST)
  
  DEF_BUILTIN (BUILT_IN_EXIT,
  	     "__builtin_exit",
--- 769,775 ----
  	     BT_FN_VOID,
  	     BT_FN_VOID,
  	     1, 0, 0,
! 	     ATTR_NORETURN_NOTHROW_LIST, true)
  
  DEF_BUILTIN (BUILT_IN_EXIT,
  	     "__builtin_exit",
*************** DEF_BUILTIN (BUILT_IN_EXIT,
*** 763,769 ****
  	     BT_FN_VOID_INT,
  	     BT_FN_VOID_INT,
  	     1, 0, 0,
! 	     ATTR_NORETURN_NOTHROW_LIST)
  
  DEF_BUILTIN (BUILT_IN__EXIT,
  	     "__builtin__exit",
--- 777,783 ----
  	     BT_FN_VOID_INT,
  	     BT_FN_VOID_INT,
  	     1, 0, 0,
! 	     ATTR_NORETURN_NOTHROW_LIST, true)
  
  DEF_BUILTIN (BUILT_IN__EXIT,
  	     "__builtin__exit",
*************** DEF_BUILTIN (BUILT_IN__EXIT,
*** 771,777 ****
  	     BT_FN_VOID_INT,
  	     BT_FN_VOID_INT,
  	     1, 0, 1,
! 	     ATTR_NORETURN_NOTHROW_LIST)
  
  DEF_BUILTIN (BUILT_IN__EXIT2,
  	     "__builtin__Exit",
--- 785,791 ----
  	     BT_FN_VOID_INT,
  	     BT_FN_VOID_INT,
  	     1, 0, 1,
! 	     ATTR_NORETURN_NOTHROW_LIST, false)
  
  DEF_BUILTIN (BUILT_IN__EXIT2,
  	     "__builtin__Exit",
*************** DEF_BUILTIN (BUILT_IN__EXIT2,
*** 779,783 ****
  	     BT_FN_VOID_INT,
  	     BT_FN_VOID_INT,
  	     1, 0, !flag_isoc99,
! 	     ATTR_NORETURN_NOTHROW_LIST)
  
--- 793,797 ----
  	     BT_FN_VOID_INT,
  	     BT_FN_VOID_INT,
  	     1, 0, !flag_isoc99,
! 	     ATTR_NORETURN_NOTHROW_LIST, false)
  
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.394
diff -c -3 -p -r1.394 c-common.c
*** c-common.c	16 Dec 2002 18:19:00 -0000	1.394
--- c-common.c	17 Dec 2002 22:02:49 -0000
*************** c_common_nodes_and_builtins ()
*** 3534,3540 ****
      c_init_attributes ();
  
  #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE,			\
! 		    BOTH_P, FALLBACK_P, NONANSI_P, ATTRS)		\
    if (NAME)								\
      {									\
        tree decl;							\
--- 3534,3540 ----
      c_init_attributes ();
  
  #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE,			\
! 		    BOTH_P, FALLBACK_P, NONANSI_P, ATTRS, IMPLICIT)	\
    if (NAME)								\
      {									\
        tree decl;							\
*************** c_common_nodes_and_builtins ()
*** 3561,3566 ****
--- 3561,3568 ----
  				   built_in_attributes[(int) ATTRS]);	\
  									\
        built_in_decls[(int) ENUM] = decl;				\
+       if (IMPLICIT)							\
+         implicit_built_in_decls[(int) ENUM] = decl;			\
      }									
  #include "builtins.def"
  #undef DEF_BUILTIN
*************** c_expand_builtin_printf (arglist, target
*** 4492,4500 ****
       int unlocked;
  {
    tree fn_putchar = unlocked ?
!     built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED] : built_in_decls[BUILT_IN_PUTCHAR];
    tree fn_puts = unlocked ?
!     built_in_decls[BUILT_IN_PUTS_UNLOCKED] : built_in_decls[BUILT_IN_PUTS];
    tree fn, format_arg, stripped_string;
  
    /* If the return value is used, or the replacement _DECL isn't
--- 4494,4502 ----
       int unlocked;
  {
    tree fn_putchar = unlocked ?
!     implicit_built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED] : implicit_built_in_decls[BUILT_IN_PUTCHAR];
    tree fn_puts = unlocked ?
!     implicit_built_in_decls[BUILT_IN_PUTS_UNLOCKED] : implicit_built_in_decls[BUILT_IN_PUTS];
    tree fn, format_arg, stripped_string;
  
    /* If the return value is used, or the replacement _DECL isn't
*************** c_expand_builtin_fprintf (arglist, targe
*** 4596,4604 ****
       int unlocked;
  {
    tree fn_fputc = unlocked ?
!     built_in_decls[BUILT_IN_FPUTC_UNLOCKED] : built_in_decls[BUILT_IN_FPUTC];
    tree fn_fputs = unlocked ?
!     built_in_decls[BUILT_IN_FPUTS_UNLOCKED] : built_in_decls[BUILT_IN_FPUTS];
    tree fn, format_arg, stripped_string;
  
    /* If the return value is used, or the replacement _DECL isn't
--- 4598,4606 ----
       int unlocked;
  {
    tree fn_fputc = unlocked ?
!     implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED] : implicit_built_in_decls[BUILT_IN_FPUTC];
    tree fn_fputs = unlocked ?
!     implicit_built_in_decls[BUILT_IN_FPUTS_UNLOCKED] : implicit_built_in_decls[BUILT_IN_FPUTS];
    tree fn, format_arg, stripped_string;
  
    /* If the return value is used, or the replacement _DECL isn't
Index: defaults.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/defaults.h,v
retrieving revision 1.98
diff -c -3 -p -r1.98 defaults.h
*** defaults.h	16 Dec 2002 18:19:20 -0000	1.98
--- defaults.h	17 Dec 2002 22:02:49 -0000
*************** You Lose!  You must define PREFERRED_DEB
*** 613,616 ****
--- 613,622 ----
  #define EXTRA_ADDRESS_CONSTRAINT(C) 0
  #endif
  
+ /* Determine whether math functions specified by C99 standard, like
+    sinf/sinl are present in the runtime library.  */
+ #ifndef TARGET_C99_FUNCTIONS
+ #define TARGET_C99_FUNCTIONS 1
+ #endif
+ 
  #endif  /* ! GCC_DEFAULTS_H */
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.368
diff -c -3 -p -r1.368 tree.h
*** tree.h	16 Dec 2002 18:20:01 -0000	1.368
--- tree.h	17 Dec 2002 22:02:52 -0000
*************** extern const char *const built_in_class_
*** 84,90 ****
  /* Codes that identify the various built in functions
     so that expand_call can identify them quickly.  */
  
! #define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT) ENUM,
  enum built_in_function
  {
  #include "builtins.def"
--- 84,90 ----
  /* Codes that identify the various built in functions
     so that expand_call can identify them quickly.  */
  
! #define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM) ENUM,
  enum built_in_function
  {
  #include "builtins.def"
*************** extern const char *const built_in_names[
*** 99,104 ****
--- 99,105 ----
  
  /* An array of _DECL trees for the above.  */
  extern tree built_in_decls[(int) END_BUILTINS];
+ extern tree implicit_built_in_decls[(int) END_BUILTINS];
  
  /* The definition of tree nodes fills the next several pages.  */
  
*************** extern tree invert_truthvalue	PARAMS ((t
*** 2928,2933 ****
--- 2929,2936 ----
  extern tree fold_builtin				PARAMS ((tree));
  extern enum built_in_function builtin_mathfn_code	PARAMS ((tree));
  extern tree build_function_call_expr			PARAMS ((tree, tree));
+ extern tree mathfn_built_in				PARAMS ((tree, enum built_in_function fn));
+ extern tree strip_float_extensions			PARAMS ((tree));
  
  /* In alias.c */
  extern void record_component_aliases		PARAMS ((tree));
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.183
diff -c -3 -p -r1.183 tm.texi
*** doc/tm.texi	16 Dec 2002 18:22:25 -0000	1.183
--- doc/tm.texi	17 Dec 2002 22:03:06 -0000
*************** Define this macro if GCC should generate
*** 4732,4737 ****
--- 4732,4746 ----
  (and System V) library functions @code{memcpy}, @code{memmove} and
  @code{memset} rather than the BSD functions @code{bcopy} and @code{bzero}.
  
+ @findex TARGET_C99_FUNCTIONS
+ @cindex C99 math functions, implicit usage
+ @item TARGET_C99_FUNCTIONS
+ When this macro is nonzero, GCC will implicitly optimize @code{sin} calls into
+ @code{sinf} and similary for other functions defined by C99 standard.  The
+ default is nonzero that should be proper value for most modern systems, however
+ number of existing systems lacks support for these functions in the runtime so
+ they needs this macro to be redefined to @code{0}.
+ 
  @findex LIBGCC_NEEDS_DOUBLE
  @item LIBGCC_NEEDS_DOUBLE
  Define this macro if @code{float} arguments cannot be passed to library
Index: java/builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/builtins.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 builtins.c
*** java/builtins.c	16 Dec 2002 18:22:31 -0000	1.11
--- java/builtins.c	17 Dec 2002 22:03:06 -0000
*************** static tree build_function_call_expr PAR
*** 72,78 ****
  static void define_builtin PARAMS ((enum built_in_function,
  				    const char *,
  				    enum built_in_class,
! 				    tree, int));
  static tree define_builtin_type PARAMS ((int, int, int, int, int));
  
  
--- 72,78 ----
  static void define_builtin PARAMS ((enum built_in_function,
  				    const char *,
  				    enum built_in_class,
! 				    tree, int, int));
  static tree define_builtin_type PARAMS ((int, int, int, int, int));
  
  
*************** sqrt_builtin (method_return_type, method
*** 193,204 ****
  
  /* Define a single builtin.  */
  static void
! define_builtin (val, name, class, type, fallback_p)
       enum built_in_function val;
       const char *name;
       enum built_in_class class;
       tree type;
       int fallback_p;
  {
    tree decl;
  
--- 193,205 ----
  
  /* Define a single builtin.  */
  static void
! define_builtin (val, name, class, type, fallback_p, implicit)
       enum built_in_function val;
       const char *name;
       enum built_in_class class;
       tree type;
       int fallback_p;
+      int implicit;
  {
    tree decl;
  
*************** define_builtin (val, name, class, type, 
*** 218,223 ****
--- 219,226 ----
    DECL_BUILT_IN_CLASS (decl) = class;
    DECL_FUNCTION_CODE (decl) = val;
    built_in_decls[val] = decl;
+   if (implicit)
+     implicit_built_in_decls[val] = decl;
  }
  
  /* Compute the type for a builtin.  */
*************** initialize_builtins ()
*** 316,323 ****
  #include "builtin-types.def"
  
  #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, \
!                     FALLBACK_P, NONANSI_P, ATTRS) \
!   define_builtin (ENUM, NAME, CLASS, builtin_types[TYPE], FALLBACK_P);
  #include "builtins.def"
  }
  
--- 319,326 ----
  #include "builtin-types.def"
  
  #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, \
!                     FALLBACK_P, NONANSI_P, ATTRS, IMPLICIT) \
!   define_builtin (ENUM, NAME, CLASS, builtin_types[TYPE], FALLBACK_P, IMPLICIT);
  #include "builtins.def"
  }
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]