Deleted Added
sdiff udiff text old ( 146906 ) new ( 161660 )
full compact
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 /* 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]
4335 : implicit_built_in_decls[BUILT_IN_FPUTC];
4336 tree const fn_fwrite = unlocked ? built_in_decls[BUILT_IN_FWRITE_UNLOCKED]
4337 : implicit_built_in_decls[BUILT_IN_FWRITE];
4338
4339 /* If the return value is used, don't do the transformation. */
4340 if (target != const0_rtx)
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
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{
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];
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{
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];
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 ---