Commit Graph

32 Commits

Author SHA1 Message Date
Zack Weinberg 6c535c69ee varargs.h: Replace with stub which issues #error.
* ginclude/varargs.h: Replace with stub which issues #error.
	* ginclude/stdarg.h: __builtin_stdarg_start is renamed
	__builtin_va_start.

	* builtins.def (BUILT_IN_VARARGS_START): Delete.
	(BUILT_IN_VA_START): New.
	* builtins.c (expand_builtin_va_start): Eliminate first
	argument and code to implement pre-ISO varargs.
	(std_expand_builtin_va_start): Ignore first argument; it is
	always 1.
	(expand_builtin): Handle BUILT_IN_VA_START and
	BUILT_IN_STDARG_START identically.  Delete
	BUILT_IN_VARARGS_START case.

	* function.c (assign_parms): Delete hide_last_arg and all
	its uses.
	(mark_varargs): Delete function.
	* function.h (struct function): Delete 'varargs' bit.
	(current_function_varargs): Delete macro.
	* tree.h: Don't declare mark_varargs.

	* c-decl.c (c_function_varargs, c_mark_varargs): Delete.
	(c_expand_body): Don't call mark_varargs.
	* c-objc-common.c: Handle BUILT_IN_VA_START and
	BUILT_IN_STDARG_START identically.  Delete
	BUILT_IN_VARARGS_START case.
	* c-tree.h: Don't declare c_mark_varargs.
	* c-parse.in: Remove grammar rules for '&...' (which has been
	commented out since before 2.7.2) and for '...' in K+R
	argument declarations.

	* builtins.c, function.c, integrate.c, sibcall.c,
	config/alpha/unicosmk.h, config/arc/arc.c, config/arc/arc.h,
	config/avr/avr.c, config/cris/cris.c, config/fr30/fr30.c,
	config/i960/i960.c, config/i960/i960.md, config/m32r/m32r.c,
	config/m32r/m32r.h, config/m88k/m88k.c, config/m88k/m88k.h,
	config/mips/mips.c, config/mmix/mmix.c, config/mmix/mmix.h,
	config/mn10300/mn10300.c, config/pa/som.h, config/s390/s390.c,
	config/sh/sh.c, config/sh/sh.h, config/sparc/sparc.h,
	config/stormy16/stormy16.c: Delete all references to
	current_function_varargs, and code predicated on that flag.

	* config/alpha/alpha.c (alpha_va_start),
	config/arc/arc.c (arc_va_start),
	config/i386/i386.c (ix86_va_start),
	config/mips/mips.c (mips_va_start),
	config/mn10300/mn10300.c (mn10300_va_start),
	config/rs6000/rs6000.c (rs6000_va_start),
	config/s390/s390.c (s390_va_start),
	config/sh/sh.c (sh_va_start),
	Ignore first argument; it is always 1.

	* config/c4x/c4x-protos.h, config/c4x/c4x.c: Delete c4x_va_start.
	* config/ia64/ia64-protos.h, config/ia64/ia64.c: Delete ia64_va_start.
	* config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c:
	Delete m68hc11_va_start.
	* config/c4x/c4x.h, config/ia64/ia64.h, config/m68hc11/m68hc11.h:
	No need to define EXPAND_BUILTIN_VA_START.

	* doc/invoke.texi, doc/sourcebuild.texi, doc/tm.texi,
	doc/trouble.texi: Remove references to GCC-provided <varargs.h>.

testsuite:
	* c-torture/execute/991216-3.c, c-torture/execute/strct-varg-1.c,
	c-torture/execute/va-arg-7.c, c-torture/execute/va-arg-8.c,
	c-torture/execute/va-arg-15.c, c-torture/execute/va-arg-16.c,
	c-torture/execute/va-arg-17.c, c-torture/execute/va-arg-19.c:
	Convert to use <stdarg.h>.
	* c-torture/execute/va-arg-3.c, c-torture/execute/va-arg-3.x:
	Delete.
	* gcc.dg/va-arg-2.c: New.
	* lib/gcc.exp, lib/objc.exp: Remove code to set -DNO_VARARGS.

From-SVN: r55472
2002-07-16 02:16:47 +00:00
Roger Sayle c5358a5d46 builtins.def: Make the argument types of abort and exit independent of the front-end.
2002-07-10  Roger Sayle  <roger@eyesopen.com>
	    Zack Weinberg <zack@codesourcery.com>

	* builtins.def: Make the argument types of abort and exit
	independent of the front-end.

	* java/builtins.c (initialize_builtins): Remove defines that
	handled C/C++ specific junk hereby removed from builtins.def.

	* gcc.c-torture/execute/20000217-1.c: Fix usage of "abort".

Co-Authored-By: Zack Weinberg <zack@codesourcery.com>

From-SVN: r55385
2002-07-11 01:20:23 +00:00
Roger Sayle df061a43b6 re PR c++/7099 (G++ doesn't set the noreturn attribute on std::exit and std::abort)
PR c++/7099
	* builtin-attrs.def: Define new attribute lists for use in
	builtins.def.
	* builtins.def [DEF_BUILTIN]: Modify to take an additional
	ATTRS argument, an enumerated value defined in builtin-attrs.def
	that represents the attribute list for the builtins.  Modify
	all builtin functions to pass an appropriate attribute list.
	Specify "abort", "exit", "_exit" and "_Exit" builtins here with
	their required noreturn attributes.
	* tree.h (enum_builtin_function): Ignore the additional parameter
	to DEF_BUILTIN.
	* builtins.c (built_in_names): Likewise.
	* c-common.c: (builtin_function_2): Replace the "int noreturn_p"
	argument with a tree representing the functions attribute list.
	Pass this "attrs" argument to builtin_function.  No longer handle
	the noreturn_p processing manually.
	(built_in_attributes): Move the definitions from builtin-attrs.def
	before c_common_nodes_and_builtins.
	(c_common_nodes_and_builtins): Handle the new ATTRS parameter in
	DEF_BUILTIN, passing it to both builtin_function and the changed
	builtin_function_2.

	* doc/extend.texi: Document __builtin_abort, __builtin_exit,
	__builtin__exit and __builtin__Exit.

	* java/builtins.c (initialize_builtins): Ignore the additional
	parameter to DEF_BUILTIN.  Handle more C/C++ specific junk in
	the builtins.def file.

From-SVN: r55276
2002-07-06 00:16:44 +00:00
Zack Weinberg f458d1d5d7 c-common.c, [...]: Delete code implementing -traditional mode.
* c-common.c, c-common.h, c-decl.c, c-lex.c, c-parse.in,
	c-tree.h, c-typeck.c, cppexp.c, cpplex.c, cpplib.c, cpplib.h,
	cppmacro.c, objc/lang-specs.h, objc/objc-act.c,
	builtin-types.def, builtins.def, dwarf2out.c, dwarfout.c,
	gcc.c, toplev.c: Delete code implementing -traditional mode.

	* ada/misc.c, ch/ch-tree.h, ch/decl.c, cp/decl2.c, f/com.c,
	f/lex.c, f/top.c, java/builtins.c, java/decl.c: Delete
	traditional-mode-related code copied from the C front end
	but not used, or used only to permit the compiler to link.

	* doc/bugreport.texi, doc/cpp.texi, doc/extend.texi,
	doc/invoke.texi, doc/standards.texi, doc/trouble.texi:
	Document removal of -traditional mode for compilation, and
	remove documentation only relevant to that mode.

	* config/nextstep.h, config/ptx4.h, config/svr4.h,
	config/convex/convex.h, config/d30v/d30v.h,
	config/i386/dgux.h, config/i386/osf1elf.h,
	config/i386/osfelf.h, config/i386/osfrose.h,
	config/i386/sco5.h, config/i386/sol2.h, config/m68k/a-ux.h,
	config/m68k/hp310.h, config/m88k/dgux.h,
	config/m88k/dguxbcs.h, config/m88k/luna.h, config/m88k/m88k.c,
	config/m88k/m88k.h, config/m88k/openbsd.h,
	config/mips/abi64.h, config/mips/osfrose.h,
	config/mips/svr4-5.h, config/mips/svr4-t.h,
	config/sparc/sol2-sld-64.h, config/sparc/sol2.h,
	config/stormy16/stormy16.h: Remove all references to
	-traditional from target specs.  Delete all mention of the
	no-longer-necessary TRADITIONAL_RETURN_FLOAT macro.  Also
	delete a couple of commented-out definitions of
	DOLLARS_IN_IDENTIFIERS, with (incorrect) commentary referring
	to -traditional.

	* system.h: Poison TRADITIONAL_RETURN_FLOAT.
	* doc/tm.texi: Remove mention of TRADITIONAL_RETURN_FLOAT macro.

	* testsuite/gcc.c-torture/execute/920730-1t.c,
	testsuite/gcc.c-torture/execute/920730-1t.x,
	testsuite/gcc.dg/ext-glob.c: Delete test cases, only relevant
	to -traditional.

From-SVN: r50110
2002-02-27 18:48:07 +00:00
Paul Koning 3bca17dda3 builtin-types.def (BT_FN_VOID_CONST_PTR_VAR): Replace BT_FN_VOID_PTR_VAR.
* builtin-types.def (BT_FN_VOID_CONST_PTR_VAR): Replace
        BT_FN_VOID_PTR_VAR.
        * builtins.def (BUILT_IN_PREFETCH): Change first argument to be const.
        * doc/extend.texi (__builtin_prefetch): Update documentation:
        first argument is now const void ptr.

        * gcc.c-torture/execute/builtin-prefetch-1.c: Changed first
        argument to __builtin_prefetch to be const ptr.

From-SVN: r49296
2002-01-28 12:07:01 -08:00
Kaveh R. Ghazi b4c984fbec builtin-attrs.def (__builtin_printf_unlocked, [...]): Mark with the __printf__ attribute.
* builtin-attrs.def (__builtin_printf_unlocked,
	__builtin_fprintf_unlocked, printf_unlocked, fprintf_unlocked):
	Mark with the __printf__ attribute.

	* builtins.c (expand_builtin_fputs): Add an `unlocked' parameter
	and set the replacement function depending on it.
	(expand_builtin): Skip BUILT_IN_*_UNLOCKED when not optimizing.
	Handle BUILT_IN_*_UNLOCKED when optimizing.

	* builtins.def (DEF_EXT_FALLBACK_BUILTIN,
	DEF_EXT_FRONT_END_LIB_BUILTIN): New macros.
	Declare the "unlocked" stdio functions.

	* c-common.c (c_expand_builtin_printf, c_expand_builtin_fprintf):
	Add an `unlocked' parameter and set the replacement function
	depending on it.
	(c_expand_builtin): Handle BUILT_IN_PRINTF_UNLOCKED and
	BUILT_IN_FPRINTF_UNLOCKED.

	* doc/extend.texi (printf_unlocked, fprintf_unlocked,
	fputs_unlocked): Document.

testsuite:
	* gcc.dg/format/builtin-1.c: Test unlocked stdio.
	* gcc.dg/format/c90-printf-3.c: Likewise.
	* gcc.dg/format/c99-printf-3.c: Likewise.
	* gcc.dg/format/ext-1.c: Likewise.
	* gcc.dg/format/ext-6.c: Likewise.
	* gcc.dg/format/format.h: Prototype unlocked stdio.

From-SVN: r48229
2001-12-21 02:36:37 +00:00
Andreas Jaeger dc6f415864 builtins.def: Rename BUILT_IN_FSQRT to BUILT_IN_SQRT and __builtin_fsqrt to __builtin_sqrt.
2001-12-14  Roger Sayle <roger@eyesopen.com>

	* builtins.def: Rename BUILT_IN_FSQRT to BUILT_IN_SQRT and
	__builtin_fsqrt to __builtin_sqrt.
	* builtins.c (expand_builtin_mathfn,expand_builtin): Same.
	* doc/extend.texi: Simplify documentation to match patch.
f:
	* com-rt.def: Use __builtin_sqrt instead of __builtin_fsqrt.
	* com.c (ffecom_init_0): Same, and fixed enumeration usage.
libstdc++-v3:
	* acconfig.h: Test for __builtin_sqrt instead of
	__builtin_fsqrt.
	* acinclude.m4: Same.
	* include/c_shadow/bits/std_cmath.h: Same.
	* aclocal.m4: Regenerated.
	* config.h.in: Regenerated.
	* configure: Regenerated.

From-SVN: r48008
2001-12-14 22:06:35 +01:00
Janis Johnson e83d297b10 builtin-types.def (BT_FN_VOID_PTR_VAR): New.
* builtin-types.def (BT_FN_VOID_PTR_VAR): New.
	* builtins.def (BUILT_IN_PREFETCH): Change arguments.
	* builtins.c (expand_builtin_prefetch): Two arguments are now optional,
	with defaults for read prefetch with high degree of locality.
	* doc/extend.texi (__builtin_prefetch): Update documentation.
	* doc/md.texi (prefetch): Add documentation.

From-SVN: r47741
2001-12-07 01:42:35 +00:00
Janis Johnson a9ccbb60d4 builtin-types.def (BT_FN_VOID_PTR_INT_INT): New.
* builtin-types.def (BT_FN_VOID_PTR_INT_INT): New.
	* builtins.def (BUILT_IN_PREFETCH): New.
	* builtins.c (expand_builtin_expect): New.
	  (expand_builtin): Call it.
	* doc/extend.texi: Document __builtin_expect.

From-SVN: r47582
2001-12-04 00:50:35 +00:00
Kazu Hirata 5519a4f9b0 builtins.def: Fix comment typos.
2001-10-31  Kazu Hirata  <kazu@hxi.com>

	* builtins.def: Fix comment typos.
	* config/alpha.c: Likewise.
	* config/arm/arm.c: Likewise.
	* config/avr/avr.h: Likewise.
	* config/d30v/d30v.c: Likewise.
	* config/d30v/d30v.h: Likewise.
	* config/d30v/d30v.md: Likewise.
	* config/dsp16xx/dsp16xx.c: Likewise.
	* config/fr30/fr30.c: Likewise.
	* config/fr30/fr30.md: Likewise.
	* config/i386/i386.c: Likewise.
	* config/i860/i860.c: Likewise.
	* config/i960/i960.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/mips/mips.c: Likewise.
	* config/pa/pa.c: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/sparc/sparc.c: Likewise.

From-SVN: r46676
2001-10-31 14:08:11 +00:00
Lars Brinkhoff 1322177dbd Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
	bitmap.h, builtin-types.def, builtins.c, builtins.def,
	c-aux-info.c, c-common.c, c-common.def, c-common.h,
	c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
	c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
	c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
	caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
	conditions.h, config.gcc, configure.frag, configure.in,
	conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
	cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
	dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
	doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
	dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
	emit-rtl.c, errors.c, errors.h, except.c, except.h,
	exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
	fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
	function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
	gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
	gencheck.c, gencodes.c, genconfig.c, genemit.c,
	genextract.c, genflags.c, gengenrtl.c, genmultilib,
	genopinit.c, genoutput.c, genpeep.c, genrecog.c,
	gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
	ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
	graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
	gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
	gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
	hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
	integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
	libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
	machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
	mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
	mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
	params.h, predict.c, predict.def, predict.h, prefix.c,
	prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
	read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
	regclass.c, regmove.c, regrename.c, regs.h, reload.c,
	reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
	rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
	sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
	sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
	ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
	stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
	tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
	tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
	unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
	unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
	xcoffout.h: replace "GNU CC" with "GCC".

From-SVN: r45105
2001-08-22 14:35:51 +00:00
Andreas Jaeger 2d94a1fa11 builtins.def: Fix definition of __builtin_cosf, it uses float as parameter and return value.
* builtins.def: Fix definition of __builtin_cosf, it uses float as
	parameter and return value.

From-SVN: r42911
2001-06-05 18:02:56 +02:00
Mark Mitchell 1084128584 builtins.def: Encode additional information, such as names and types, here.
* builtins.def: Encode additional information, such as names and
	types, here.
	* builtin-types.def: New file.
	* builtins.c (built_in_names): Adjust use of DEF_BUILTIN.
	(built_in_decls): Likewise.  Don't explicitly initialize global
	data to NULL.
	(expand_builtin_mathfn): Handle float and long double variants of
	math builtins.
	(expand_builtin): Likewise.
	* c-common.c (c_common_nodes_and_builtins): Make it table-driven.
	(expand_tree_builtin): Handle long, long long, float, and long
	double variants of math functions.
	* c-common.h (c_tree_index): Remove some unused nodes.
	(void_ftype): Remove.
	(void_type_ptr): Likewise.
	(int_ftype_int): Likewise.
	(ptr_ftype_sizetype): Likewise.
	* c-decl.c (init_decl_processing): Remove creation of DWARF
	builtins.
	* defaults.h (MD_INIT_BUILTINS): Provide default definition.
	* tree.h (built_in_function): Adjust definition of DEF_BUILTIN.
	* Makefile.in (c-common.o): Depend on builtin-types.def.

	* decl.c (init_decl_processing): Tweak.

From-SVN: r42583
2001-05-25 20:00:59 +00:00
Richard Henderson 52a11cbfcf IA-64 ABI Exception Handling.
From-SVN: r40924
2001-03-28 03:04:51 -08:00
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