Deleted Added
full compact
builtins.c (146906) builtins.c (161660)
1/* Expand builtin functions.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 4315 unchanged lines hidden (view full) ---

4324
4325/* If the string passed to fputs is a constant and is one character
4326 long, we attempt to transform this call into __builtin_fputc(). */
4327
4328static rtx
4329expand_builtin_fputs (tree arglist, rtx target, bool unlocked)
4330{
4331 tree len, fn;
1/* Expand builtin functions.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 4315 unchanged lines hidden (view full) ---

4324
4325/* If the string passed to fputs is a constant and is one character
4326 long, we attempt to transform this call into __builtin_fputc(). */
4327
4328static rtx
4329expand_builtin_fputs (tree arglist, rtx target, bool unlocked)
4330{
4331 tree len, fn;
4332 tree fn_fputc = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
4332 /* If we're using an unlocked function, assume the other unlocked
4333 functions exist explicitly. */
4334 tree const fn_fputc = unlocked ? built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
4333 : implicit_built_in_decls[BUILT_IN_FPUTC];
4335 : implicit_built_in_decls[BUILT_IN_FPUTC];
4334 tree fn_fwrite = unlocked ? implicit_built_in_decls[BUILT_IN_FWRITE_UNLOCKED]
4336 tree const fn_fwrite = unlocked ? built_in_decls[BUILT_IN_FWRITE_UNLOCKED]
4335 : implicit_built_in_decls[BUILT_IN_FWRITE];
4336
4337 : implicit_built_in_decls[BUILT_IN_FWRITE];
4338
4337 /* If the return value is used, or the replacement _DECL isn't
4338 initialized, don't do the transformation. */
4339 if (target != const0_rtx || !fn_fputc || !fn_fwrite)
4339 /* If the return value is used, don't do the transformation. */
4340 if (target != const0_rtx)
4340 return 0;
4341
4342 /* Verify the arguments in the original call. */
4343 if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
4344 return 0;
4345
4346 /* Get the length of the string passed to fputs. If the length
4347 can't be determined, punt. */

--- 44 unchanged lines hidden (view full) ---

4392 arglist = tree_cons (NULL_TREE, string_arg, arglist);
4393 fn = fn_fwrite;
4394 break;
4395 }
4396 default:
4397 abort ();
4398 }
4399
4341 return 0;
4342
4343 /* Verify the arguments in the original call. */
4344 if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
4345 return 0;
4346
4347 /* Get the length of the string passed to fputs. If the length
4348 can't be determined, punt. */

--- 44 unchanged lines hidden (view full) ---

4393 arglist = tree_cons (NULL_TREE, string_arg, arglist);
4394 fn = fn_fwrite;
4395 break;
4396 }
4397 default:
4398 abort ();
4399 }
4400
4401 /* If the replacement _DECL isn't initialized, don't do the
4402 transformation. */
4403 if (!fn)
4404 return 0;
4405
4400 return expand_expr (build_function_call_expr (fn, arglist),
4401 const0_rtx, VOIDmode, EXPAND_NORMAL);
4402}
4403
4404/* Expand a call to __builtin_expect. We return our argument and emit a
4405 NOTE_INSN_EXPECTED_VALUE note. This is the expansion of __builtin_expect in
4406 a non-jump context. */
4407

--- 238 unchanged lines hidden (view full) ---

4646 Return 0 if a normal call should be emitted rather than transforming
4647 the function inline. If convenient, the result should be placed in
4648 TARGET with mode MODE. UNLOCKED indicates this is a printf_unlocked
4649 call. */
4650static rtx
4651expand_builtin_printf (tree arglist, rtx target, enum machine_mode mode,
4652 bool unlocked)
4653{
4406 return expand_expr (build_function_call_expr (fn, arglist),
4407 const0_rtx, VOIDmode, EXPAND_NORMAL);
4408}
4409
4410/* Expand a call to __builtin_expect. We return our argument and emit a
4411 NOTE_INSN_EXPECTED_VALUE note. This is the expansion of __builtin_expect in
4412 a non-jump context. */
4413

--- 238 unchanged lines hidden (view full) ---

4652 Return 0 if a normal call should be emitted rather than transforming
4653 the function inline. If convenient, the result should be placed in
4654 TARGET with mode MODE. UNLOCKED indicates this is a printf_unlocked
4655 call. */
4656static rtx
4657expand_builtin_printf (tree arglist, rtx target, enum machine_mode mode,
4658 bool unlocked)
4659{
4654 tree fn_putchar = unlocked
4655 ? implicit_built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED]
4656 : implicit_built_in_decls[BUILT_IN_PUTCHAR];
4657 tree fn_puts = unlocked ? implicit_built_in_decls[BUILT_IN_PUTS_UNLOCKED]
4658 : implicit_built_in_decls[BUILT_IN_PUTS];
4660 /* If we're using an unlocked function, assume the other unlocked
4661 functions exist explicitly. */
4662 tree const fn_putchar = unlocked ? built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED]
4663 : implicit_built_in_decls[BUILT_IN_PUTCHAR];
4664 tree const fn_puts = unlocked ? built_in_decls[BUILT_IN_PUTS_UNLOCKED]
4665 : implicit_built_in_decls[BUILT_IN_PUTS];
4659 const char *fmt_str;
4660 tree fn, fmt, arg;
4661
4662 /* If the return value is used, don't do the transformation. */
4663 if (target != const0_rtx)
4664 return 0;
4665
4666 /* Verify the required arguments in the original call. */

--- 82 unchanged lines hidden (view full) ---

4749 Return 0 if a normal call should be emitted rather than transforming
4750 the function inline. If convenient, the result should be placed in
4751 TARGET with mode MODE. UNLOCKED indicates this is a fprintf_unlocked
4752 call. */
4753static rtx
4754expand_builtin_fprintf (tree arglist, rtx target, enum machine_mode mode,
4755 bool unlocked)
4756{
4666 const char *fmt_str;
4667 tree fn, fmt, arg;
4668
4669 /* If the return value is used, don't do the transformation. */
4670 if (target != const0_rtx)
4671 return 0;
4672
4673 /* Verify the required arguments in the original call. */

--- 82 unchanged lines hidden (view full) ---

4756 Return 0 if a normal call should be emitted rather than transforming
4757 the function inline. If convenient, the result should be placed in
4758 TARGET with mode MODE. UNLOCKED indicates this is a fprintf_unlocked
4759 call. */
4760static rtx
4761expand_builtin_fprintf (tree arglist, rtx target, enum machine_mode mode,
4762 bool unlocked)
4763{
4757 tree fn_fputc = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
4758 : implicit_built_in_decls[BUILT_IN_FPUTC];
4759 tree fn_fputs = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTS_UNLOCKED]
4760 : implicit_built_in_decls[BUILT_IN_FPUTS];
4764 /* If we're using an unlocked function, assume the other unlocked
4765 functions exist explicitly. */
4766 tree const fn_fputc = unlocked ? built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
4767 : implicit_built_in_decls[BUILT_IN_FPUTC];
4768 tree const fn_fputs = unlocked ? built_in_decls[BUILT_IN_FPUTS_UNLOCKED]
4769 : implicit_built_in_decls[BUILT_IN_FPUTS];
4761 const char *fmt_str;
4762 tree fn, fmt, fp, arg;
4763
4764 /* If the return value is used, don't do the transformation. */
4765 if (target != const0_rtx)
4766 return 0;
4767
4768 /* Verify the required arguments in the original call. */

--- 2277 unchanged lines hidden ---
4770 const char *fmt_str;
4771 tree fn, fmt, fp, arg;
4772
4773 /* If the return value is used, don't do the transformation. */
4774 if (target != const0_rtx)
4775 return 0;
4776
4777 /* Verify the required arguments in the original call. */

--- 2277 unchanged lines hidden ---