Commit Graph

218 Commits

Author SHA1 Message Date
Kaveh R. Ghazi 18f988a06b builtins.def (BUILT_IN_FPRINTF): New entry.
* builtins.def (BUILT_IN_FPRINTF): New entry.

	* c-common.c (c_expand_builtin_fprintf): New function.
	(init_function_format_info): Handle __builtin_fprintf.
	(c_common_nodes_and_builtins): Declare fprintf/__builtin_fprintf.
	(c_expand_builtin): Handle BUILT_IN_FPRINTF.

	* c-decl.c (duplicate_decls): Adjust comment.

	* extend.texi (fprintf): Document new builtin.

testsuite:
	* gcc.c-torture/execute/stdio-opt-3.c: New test.

From-SVN: r38788
2001-01-07 23:15:47 +00:00
Joseph Myers 341e3d1169 builtins.def (BUILT_IN_CONJ, [...]): Define.
* builtins.def (BUILT_IN_CONJ, BUILT_IN_CREAL, BUILT_IN_CIMAG):
	Define.
	* builtins.c (expand_builtin): Abort on BUILT_IN_CONJ,
	BUILT_IN_CREAL and BUILT_IN_CIMAG.
	* c-common.c (c_common_nodes_and_builtins): Create builtin conjf,
	conj, conjl, crealf, creal, creall, cimagf, cimag and cimagl.
	(expand_tree_builtin): Handle BUILT_IN_CONJ, BUILT_IN_CREAL and
	BUILT_IN_CIMAG.
	* extend.texi: Document these builtins.

testsuite:
	* gcc.c-torture/execute/builtin-complex-1.c: New test.

From-SVN: r38716
2001-01-05 18:24:08 +00:00
Joseph Myers 29b5ca410a builtins.def (BUILT_IN_LABS, [...]): Don't define.
* builtins.def (BUILT_IN_LABS, BUILT_IN_LLABS, BUILT_IN_IMAXABS):
	Don't define.
	* builtins.c (expand_builtin): Don't handle BUILT_IN_LABS,
	BUILT_IN_LLABS and BUILT_IN_IMAXABS.
	* c-common.c (c_common_nodes_and_builtins): Use BUILT_IN_ABS for
	builtin labs, llabs and imaxabs.
	(expand_tree_builtin): Don't handle BUILT_IN_LABS, BUILT_IN_LLABS
	and BUILT_IN_IMAXABS.

From-SVN: r38475
2000-12-23 00:51:20 +00:00
Kaveh R. Ghazi d118937d79 builtins.c (expand_builtin_strcat, [...]): New functions.
* builtins.c (expand_builtin_strcat, expand_builtin_strncat,
	expand_builtin_strspn, expand_builtin_strcspn): New functions.
	(expand_builtin): Handle BUILT_IN_STRCAT, BUILT_IN_STRNCAT,
	BUILT_IN_STRSPN and BUILT_IN_STRCSPN.

	* builtins.def (BUILT_IN_STRCAT, BUILT_IN_STRNCAT,
	BUILT_IN_STRSPN, BUILT_IN_STRCSPN): New entries.

	* c-common.c (c_common_nodes_and_builtins): Declare builtin
	strcat, strncat, strspn and strcspn.
	(string_ftype_string_cstring): Renamed from `string_ftype_ptr_ptr'.

	* extend.texi (strcat, strcspn, strncat, strspn): Document new
	builtins.

testsuite:
	* gcc.c-torture/execute/string-opt-9.c: New test.
	* gcc.c-torture/execute/string-opt-10.c: Likewise.
	* gcc.c-torture/execute/string-opt-11.c: Likewise.
	* gcc.c-torture/execute/string-opt-12.c: Likewise.

From-SVN: r37964
2000-12-03 03:46:03 +00:00
Joseph Myers e78f4a977a builtins.def (BUILT_IN_IMAXABS): Add.
* builtins.def (BUILT_IN_IMAXABS): Add.
	* builtins.c (expand_builtin): Also abort on BUILT_IN_IMAXABS.
	* c-common.c (c_common_nodes_and_builtins): Create builtin
	functions __builtin_imaxabs, and plain imaxabs unless
	flag_no_nonansi_builtin outside C99 mode.
	(expand_tree_builtin): Handle BUILT_IN_IMAXABS.
	* extend.texi: Document builtin imaxabs.

From-SVN: r37932
2000-12-01 22:35:50 +00:00
Kaveh R. Ghazi da9e9f0862 builtins.c (expand_builtin_strncmp, [...]): New functions.
* builtins.c (expand_builtin_strncmp, expand_builtin_strncpy): New
	functions.
	(expand_builtin): Handle BUILT_IN_STRNCPY and BUILT_IN_STRNCMP.

	* builtins.def (BUILT_IN_STRNCPY, BUILT_IN_STRNCMP): New entries.

	* c-common.c (c_common_nodes_and_builtins): Declare builtin
	strncpy and strncmp.

	* extend.texi (strncmp, strncpy): Document new builtins.

testsuite:
	* gcc.c-torture/execute/string-opt-7.c: New test.
	* gcc.c-torture/execute/string-opt-8.c: Likewise.

From-SVN: r37777
2000-11-27 05:00:06 +00:00
Kaveh R. Ghazi c7b6c6cd47 builtins.c (expand_builtin): Handle BUILT_IN_INDEX and BUILT_IN_RINDEX.
* builtins.c (expand_builtin): Handle BUILT_IN_INDEX and
	BUILT_IN_RINDEX.  Add missing checks for BUILT_IN_STRCHR and
	BUILT_IN_STRRCHR.

	* builtins.def (BUILT_IN_INDEX, BUILT_IN_RINDEX): New entries.

	* c-common.c (c_common_nodes_and_builtins): Declare index and
	rindex when nonansi builtins are allowed.

	* extend.texi (index, rindex): Document new builtins.

testsuite:
	* gcc.c-torture/execute/string-opt-3.c: Also test builtin rindex.
	* gcc.c-torture/execute/string-opt-4.c: Also test builtin index.

From-SVN: r37416
2000-11-13 02:14:05 +00:00
Jakub Jelinek 2dee4af12b builtins.c (c_strlen): Use TREE_STRING_LENGTH - 1 for max.
* builtins.c (c_strlen): Use TREE_STRING_LENGTH - 1 for max.
	(c_getstr): New function.
	(expand_builtin_strstr): Do nothing if -fcheck-memory-usage.
	If both arguments are constant string, optimize out.
	(expand_builtin_strchr, expand_builtin_strrchr): New functions.
	(expand_builtin_strpbrk): Use c_getstr, do nothing if
	-fcheck-memory-usage.
	(expand_builtin_fputs): Likewise.
	(expand_builtin_strcmp): Add MODE argument.
	Use even if !HAVE_cmpstrsi.
	Optimize the case when both arguments are constant strings.
	(expand_builtin): Adjust expand_builtin_strcmp caller.
	Call expand_builtin_strchr and expand_builtin_strrchr.
	* c-common.c (c_common_nodes_and_builtins): Add strchr and strrchr
	builtins.
	* builtins.def (BUILT_IN_STRRCHR): Add.

	* gcc.c-torture/execute/string-opt-1.c: Add test for strstr
	with both arguments constant strings.
	* gcc.c-torture/execute/string-opt-3.c: New test.
	* gcc.c-torture/execute/string-opt-4.c: New test.
	* gcc.c-torture/execute/string-opt-5.c: New test.

From-SVN: r37338
2000-11-09 10:07:44 +01:00
Kaveh R. Ghazi 26a87cabc6 builtins.c (expand_builtin_strpbrk): New function.
* builtins.c (expand_builtin_strpbrk): New function.
	(expand_builtin): Handle BUILT_IN_STRPBRK.

	* builtins.def (BUILT_IN_STRPBRK): New entry.

	* c-common.c (c_common_nodes_and_builtins): Declare builtin
	strpbrk.

testsuite:
	* gcc.c-torture/execute/string-opt-2.c: New test.

From-SVN: r37291
2000-11-07 16:08:57 +00:00
Kaveh R. Ghazi 78e7629e9f builtins.c (expand_builtin_strstr): New function.
* builtins.c (expand_builtin_strstr): New function.
	(expand_builtin): Handle BUILT_IN_STRSTR and BUILT_IN_STRCHR.

	* builtins.def (BUILT_IN_STRSTR, BUILT_IN_STRCHR): New entries.

	* c-common.c (c_common_nodes_and_builtins): Declare builtin strstr
	and builtin strchr.

From-SVN: r37181
2000-11-01 03:22:21 +00:00
Joseph Myers 1c44c45dbf builtins.def (BUILT_IN_LLABS): Add.
* builtins.def (BUILT_IN_LLABS): Add.
	* builtins.c (expand_builtin): Also abort on BUILT_IN_LLABS.
	* c-common.c (c_common_nodes_builtins): Create builtin functions
	__builtin_llabs, and plain llabs unless no_nonansi_builtins
	outside of C99 mode.
	(expand_tree_builtin): Handle BUILT_IN_LLABS.

From-SVN: r36585
2000-09-24 10:50:30 +01:00
Kaveh R. Ghazi 0732816781 builtins.c (expand_builtin_fputs): Also expand when length!=1.
* builtins.c (expand_builtin_fputs): Also expand when length!=1.
	(expand_builtin): Handle BUILT_IN_FWRITE.

	* builtins.def (BUILT_IN_FWRITE): New entry.

	* c-common.c (c_common_nodes_and_builtins): Declare __builtin_fwrite.

From-SVN: r36556
2000-09-21 01:59:07 +00:00
Kaveh R. Ghazi ad3fd36f73 builtins.c (is_valid_printf_arglist, [...]): New functions.
* builtins.c (is_valid_printf_arglist, expand_builtin_printf): New
	functions.
	(expand_builtin_fputs): Set `target' parameter for `expand_expr'.
	(expand_builtin): Handle BUILT_IN_PUTCHAR, BUILT_IN_PUTS and
	BUILT_IN_PRINTF.

	* builtins.def (BUILT_IN_PUTCHAR, BUILT_IN_PUTS, BUILT_IN_PRINTF):
	New entries.

	* c-common.c (init_function_format_info): Handle __builtin_printf.
	Set `check_function_format_ptr'.
	(c_common_nodes_and_builtins): Set `puts_ftype' and
	`printf_ftype'.  Declare __builtin_putchar, __builtin_puts,
	__builtin_printf and printf.

	* tree.c, tree.h (check_function_format_ptr): Declare.

testsuite:
	* g++.old-deja/g++.other/virtual8.C: Declare printf correctly.

From-SVN: r36540
2000-09-19 18:19:44 +00:00
Kaveh R. Ghazi 3ff5f682dc builtins.c (built_in_decls): New array.
* builtins.c (built_in_decls): New array.
	(expand_builtin_fputs): New function.
	(expand_builtin): Handle BUILT_IN_FPUTC and BUILT_IN_FPUTS.

	* builtins.def (BUILT_IN_FPUTC, BUILT_IN_FPUTS): New members.

	* c-common.c (c_common_nodes_and_builtins): Handle fputc/fputs.

	* tree.h (built_in_decls): New array.

From-SVN: r36363
2000-09-12 15:10:50 +00:00
Richard Henderson 994a57cd28 builtins.c (expand_builtin_expect): New.
* builtins.c (expand_builtin_expect): New.
        (expand_builtin): Call it.
        * builtins.def (BUILT_IN_EXPECT): New.
        * c-common.c (c_common_nodes_and_builtins): Declare __builtin_expect.
        * extend.texi: Document it.

        * predict.c (expected_value_to_br_prob): New.
        (find_expected_value): New.
        * basic-block.h (expected_value_to_br_prob): Declare.
        * toplev.c (rest_of_compilation): Invoke it.

        * rtl.h (NOTE_EXPECTED_VALUE): New.
        (NOTE_INSN_EXPECTED_VALUE): New.
        * rtl.c (note_insn_name): Update.
        * print-rtl.c (print_rtx): Reorg NOTE_LINE_NUMBER special
        cases; handle NOTE_INSN_EXPECTED_VALUE.

From-SVN: r33211
2000-04-17 09:49:00 -07:00
Kaveh R. Ghazi e3a709be4d builtins.c (expand_builtin_bzero): New function.
* builtins.c (expand_builtin_bzero): New function.
	(expand_builtin): Handle bzero.

	* builtins.def: Add BUILT_IN_BZERO.

	* c-common.c (c_common_nodes_and_builtins): Provide builtin
	prototype & function for bzero.

From-SVN: r32727
2000-03-24 20:20:56 +00:00
Kaveh R. Ghazi 4b2a62db33 builtins.c (expand_builtin): Handle bcmp.
* builtins.c (expand_builtin): Handle bcmp.

	* builtins.def: Add BUILT_IN_BCMP.

	* c-common.c (c_common_nodes_and_builtins): Provide builtin
	prototype & function for bcmp.

From-SVN: r32715
2000-03-23 21:32:10 +00:00
Kaveh R. Ghazi cb1072f450 builtins.def: New file.
* builtins.def: New file.

	* Makefile.in (TREE_H): Depend on builtins.def.

	* builtins.c (built_in_names): Use builtins.def.

	* tree.h (built_in_function): Likewise.

From-SVN: r32695
2000-03-23 00:20:37 +00:00