Commit Graph

218 Commits

Author SHA1 Message Date
Olga Golovanevsky db9d500a22 Add BUILT_IN_FREE
From-SVN: r120732
2007-01-12 21:01:46 +00:00
Richard Guenther 75c7c595ac re PR tree-optimization/17687 (sincos tree representation causes extra addressable vars)
2006-12-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/17687
	* builtins.def (BUILT_IN_CEXPI, BUILT_IN_CEXPIF, BUILT_IN_CEXPIL):
	New builtins for imaginary argument cexp.
	* builtin-types.def (BT_FN_COMPLEX_FLOAT_FLOAT,
	BT_FN_COMPLEX_DOUBLE_DOUBLE, BT_FN_COMPLEX_LONGDOUBLE_LONGDOUBLE):
	New required builtin types.
	* builtins.c (expand_builtin_cexpi): Declare.
	(mathfn_built_in): Handle BUILT_IN_CEXPI.
	(expand_builtin_cexpi): New static helper.
	(expand_builtin): Call it.
	(do_mpfr_sincos): Adjust for CEXPI evaluation.
	(fold_builtin_sincos): New function to fold sincos to cepxi.

	* gcc.dg/builtins-59.c: New testcase.

From-SVN: r119824
2006-12-13 10:17:36 +00:00
Kaveh R. Ghazi e35ae5fe4e builtins.def (gamma, lgamma): Use ATTR_MATHFN_FPROUNDING_STORE.
* builtins.def (gamma, lgamma): Use ATTR_MATHFN_FPROUNDING_STORE.
	
testsuite:
	* gcc.dg/torture/builtin-attr-1.c: Don't test gamma/lgamma.
	* gcc.dg/torture/builtin-convert-1.c: Don't test lgamma.

From-SVN: r118366
2006-11-01 05:38:21 +00:00
Eric Christopher 167fa32c09 extend.texi (__builtin_bswap32): Document.
2006-09-07  Eric Christopher  <echristo@apple.com>
	    Falk Hueffner  <falk@debian.org>

	* doc/extend.texi (__builtin_bswap32): Document.
	(__builtin_bswap64): Ditto.
	* doc/libgcc.texi (bswapsi2): Document.
	(bswapdi2): Ditto.
	* doc/rtl.texi (bswap): Document.
	* optabs.c (expand_unop): Don't widen a bswap.
	(init_optabs): Init bswap. Set libfuncs explicitly
	for bswapsi2 and bswapdi2.
	* optabs.h (OTI_bswap): New.
	(bswap_optab): Ditto.
	* genopinit.c (optabs): Handle bswap_optab.
	* tree.h (tree_index): Add TI_UINT32_TYPE and
	TI_UINT64_TYPE.
	(uint32_type_node): New.
	(uint64_type_node): Ditto.
	* tree.c (build_common_tree_nodes_2): Initialize
	uint32_type_node and uint64_type_node.
	* builtins.c (expand_builtin_bswap): New.
	(expand_builtin): Call.
	(fold_builtin_bswap): New.
	(fold_builtin_1): Call.
	* fold-const.c (tree_expr_nonnegative_p): Return true
	for bswap.
	* builtin-types.def (BT_UINT32): New.
	(BT_UINT64): Ditto.
	(BT_FN_UINT32_UINT32): Ditto.
	(BT_FN_UINT64_UINT64): Ditto.
	* builtins.def (BUILT_IN_BSWAP32): New.
	(BUILT_IN_BSWAP64): Ditto.
	* rtl.def (BSWAP): New.
	* genattrtab.c (check_attr_value): New.
	* libgcc2.c (__bswapSI2): New.
	(__bswapDI2): Ditto.
	* libgcc2.h (__bswapSI2): Declare.
	(__bswapDI2): Ditto.
	* mklibgcc.in (lib2funcs): Add _bswapsi2 and _bswapdi2.
	* simplify-rtx.c (simplify_const_unary_operation): Return
	0 for BSWAP.
	* libgcc-std.ver (__bwapsi2): Add.
	(__bswapdi2): Ditto.
	* reload1.c (eliminate_regs_1): Add bswap.
	(elimination_effects): Ditto.
	* config/i386/i386.h (x86_bswap): New.
	(TARGET_BSWAP): Use.
	* config/i386/i386.c (x86_bswap): Set.

Co-Authored-By: Falk Hueffner <falk@debian.org>

From-SVN: r118361
2006-11-01 05:14:40 +00:00
Richard Henderson a98d4769d5 Revert emutls patch.
From-SVN: r117578
2006-10-09 09:27:14 -07:00
Richard Henderson e701a32a98 Makefile.in (libgcc.mk, [...]): Add emutls.c.
gcc/
        * Makefile.in (libgcc.mk, LIBGCC_DEPS): Add emutls.c.
        * builtin-types.def (BT_WORD): Make unsigned.
        (BT_FN_VOID_PTR_WORD_WORD_PTR): New.
        * builtins.def (BUILT_IN_EMUTLS_GET_ADDRESS): New.
        (BUILT_IN_EMUTLS_REGISTER_COMMON): New.
        * c-decl.c (grokdeclarator): Don't error if !have_tls.
        * c-parser.c (c_parser_omp_threadprivate): Likewise.
        * cgraph.c (decide_is_variable_needed): Look at force_output.
        Recurse for emulated tls.
        * cgraphunit.c (cgraph_varpool_remove_unreferenced_decls): Remove
        checks redundant with decide_is_variable_needed.
        (cgraph_build_static_cdtor): Do cgraph_varpool_assemble_pending_decls.
        * dwarf2out.c (loc_descriptor_from_tree_1): Don't do anything for
        emulated tls.
        * expr.c (emutls_var_address): New.
        (expand_expr_real_1): Expand emulated tls.
        (expand_expr_addr_expr_1): Likewise.
        * libgcc-std.ver: Add __emutls_get_address, __emutls_register_common.
        * output.h (emutls_finish): Declare.
        * toplev.c (compile_file): Call it.
        * tree-ssa-address.c (gen_addr_rtx): Check for const-ness of the
        address before wrapping in CONST.
        * varasm.c (emutls_htab, emutls_object_type): New.
        (EMUTLS_VAR_PREFIX, EMUTLS_TMPL_PREFIX): New.
        (get_emutls_object_name, get_emutls_object_type): New.
        (get_emutls_init_templ_addr, emutls_decl): New.
        (emutls_common_1, emutls_finish): New.
        (assemble_variable): When emulating tls, swap decls; generate
        constructor for the emutls objects.
        (do_assemble_alias): When emulating tls, swap decl and target name.
        (default_encode_section_info): Don't add SYMBOL_FLAG_TLS_SHIFT
        for emulated tls.
        * emutls.c: New file.
        * config/sparc/sol2.h (ASM_DECLARE_OBJECT_NAME): Only emit
        tls_object for real tls.

gcc/cp/
        * decl.c (grokvardecl): Don't error if !have_tls.
        (grokdeclarator): Likewise.
        * parser.c (cp_parser_omp_threadprivate): Likewise.

gcc/fortran/
        * f95-lang.c (gfc_init_builtin_functions): Add __emutls_get_address
        and __emutls_register_common.
        * openmp.c (gfc_match_omp_threadprivate): Don't error if !have_tls.
        * trans-common.c (build_common_decl): Don't check have_tls.
        * trans-decl.c (gfc_finish_var_decl): Likewise.
        * types.def (BT_WORD, BT_FN_PTR_PTR): New.
        (BT_FN_VOID_PTR_WORD_WORD_PTR): New.

gcc/testsuite/
        * lib/target-supports.exp (check_effective_target_tls): Redefine
        to mean non-emulated tls.
        * gcc.dg/tls/alias-1.c: Remove tls requirement.
        * gcc.dg/tls/asm-1.c, gcc.dg/tls/debug-1.c, gcc.dg/tls/diag-1.c,
        gcc.dg/tls/diag-2.c, gcc.dg/tls/diag-3.c, gcc.dg/tls/diag-4.c,
        gcc.dg/tls/diag-5.c, gcc.dg/tls/init-1.c, gcc.dg/tls/nonpic-1.c,
        gcc.dg/tls/opt-10.c, gcc.dg/tls/opt-5.c, gcc.dg/tls/opt-6.c,
        gcc.dg/tls/opt-8.c, gcc.dg/tls/opt-9.c, gcc.dg/tls/pic-1.c,
        gcc.dg/tls/struct-1.c, gcc.dg/tls/trivial.c: Likewise.

From-SVN: r117440
2006-10-04 14:09:20 -07:00
Eric Botcazou 4f6c213142 builtins.c (expand_builtin_setjmp): Delete.
* builtins.c (expand_builtin_setjmp): Delete.
	(expand_builtin) <BUILT_IN_SETJMP>: Mark as unreachable.
	<BUILT_IN_SETJMP_SETUP>: New case.
	<BUILT_IN_SETJMP_DISPATCHER>: Likewise.
	<BUILT_IN_SETJMP_RECEIVER>: Likewise.
	* builtins.def (BUILT_IN_SETJMP_SETUP): New built-in stub.
	(BUILT_IN_SETJMP_DISPATCHER): Likewise.
	(BUILT_IN_SETJMP_RECEIVER): Likewise.
	* gimple-low.c (struct lower_data): New field calls_builtin_setjmp.
	(lower_function_body): Initialize it to false.  If it is set to true
	at the end of the processing, emit the setjmp dispatcher.
	(lower_stmt) <CALL_EXPR>: Invoke lower_builtin_setjmp if the callee
	is __builtin_setjmp and set calls_builtin_setjmp to true as well.
	<MODIFY_EXPR>: Fall through to above case if there is a CALL_EXPR
	on the rhs of the assignment.
	(lower_builtin_setjmp): New function.
	* tree.c (build_common_builtin_nodes): Build BUILT_IN_SETJMP_SETUP,
	BUILT_IN_SETJMP_DISPATCHER and BUILT_IN_SETJMP_RECEIVER nodes.
	* tree-cfg.c (make_exit_edges) <CALL_EXPR>: Use specific predicate
	to detect calls that can go to non-local labels.  Use specific
	helper to create the abnormal edges associated with them.
	<MODIFY_EXPR>: Likewise.
	(make_abnormal_goto_edges): New function extracted from...
	(make_goto_expr_edges): ...here.  Call it for computed gotos.
	(simple_goto_p): Minor tweak.
	(tree_can_make_abnormal_goto): New predicate.
	(tree_redirect_edge_and_branch): Return zero on all abnormal edges.
	(tree_purge_dead_abnormal_call_edges): New function.
	* tree-flow.h (tree_can_make_abnormal_goto): Declare.
	(tree_purge_dead_abnormal_call_edges): Likewise.
	(make_abnormal_goto_edges): Likewise.
	* tree-inline.c (expand_call_inline): Simplify statement frobbing.
	Purge all dead abnormal edges if the call was in the last statement.
	* tree-optimize.c (has_abnormal_outgoing_edge_p): New predicate.
	(execute_fixup_cfg): If there are non-local labels in the function,
	scan the basic blocks and split them at calls that can go to non-local
	labels or add missing abnormal call edges.  Write down the CFG in the
	dump file.
	(pass_fixup_cfg): Remove TODO_dump_func flag.
	* unwind-sjlj.c: Poison setjmp.
	* doc/install.texi (enable-sjlj-exceptions): Use more general wording.
	* doc/tm.texi (DWARF2_UNWIND_INFO): Likewise.
	(TARGET_UNWIND_TABLES_DEFAULT): Fix typo.
	(DONT_USE_BUILTIN_SETJMP): Document it.

From-SVN: r117298
2006-09-29 06:32:58 +00:00
Mike Stump c22cacf346 Whitespace fixups
From-SVN: r113893
2006-05-18 22:16:23 +00:00
Diego Novillo 953ff28998 [multiple changes]
2006-01-18  Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* libgomp: New directory.
	* Makefile.def: Add target_module libgomp.
	* Makefile.in: Regenerate.
	* configure.in (target_libraries): Add target-libgomp.
	* configure: Regenerate.


contrib/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* gcc_update (files_and_dependencies): Add libgomp files.


gcc/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* omp-low.c: New file.
	* c-omp.c: New file.

2006-01-18  Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* doc/invoke.texi: Document -fopenmp.
	* tree-dump.h (debug_function): Declare.

	* hooks.c (hook_bool_tree_bool_false): New function.
	(hook_tree_tree_null): Remove.
	(hook_tree_tree_tree_null): New.
	* hooks.h: Update to match.

	* tree-pretty-print.c (debug_tree_chain): New.
	(print_generic_expr): Handle TDF_CHAIN.
	(dump_generic_node): Handle BLOCK.
	Do not abort with incomplete SWITCH_EXPRs.
	Do not dump body of an OpenMP directive if TDF_SLIM is given.
	<case OMP_PARALLEL, OMP_FOR, OMP_SECTIONS>: Don't
	print space after directive name.
	<OMP_FOR>: Handle printing OMP_FOR_PRE_BODY.
	Handle OMP_MASTER and OMP_ORDERED.
	Handle printing of OMP_BODY just in one place, goto
	dump_omp_body in the rest of OMP_* nodes that have
	OMP_BODY.
	Don't handle clause nodes here.  Update omp statements to
	use dump_omp_clauses.
	Handle OMP_SINGLE, OMP_SECTIONS, OMP_SECTION,
	OMP_CLAUSE_ORDERED, OMP_CLAUSE_SCHEDULE, OMP_ATOMIC,
	OMP_CRITICAL, OMP_CLAUSE_NOWAIT, GOMP_CLAUSE_IF,
	GOMP_CLAUSE_NUM_THREADS, GOMP_FOR, GOMP_CLAUSE_SHARED,
	GOMP_CLAUSE_FIRSTPRIVATE, GOMP_CLAUSE_LASTPRIVATE,
	GOMP_CLAUSE_COPYIN and GOMP_CLAUSE_COPYPRIVATE.
	Adjust output for GOMP_PARALLEL.
	(dump_omp_clauses): New.
	(print_declaration): Dump DECL_VALUE_EXPR.
	(op_symbol_1): Split out of op_symbol.
	(dumping_stmts): Remove.  Update all users.

	* cgraph.c (cgraph_analyze_queue): New.
	(cgraph_add_new_function): New.
	* cgraph.h (cgraph_analyze_queue): Declare.
	(cgraph_add_new_function): Declare.
	(cgraph_lower_function): Remove.

	* tree.c (walk_tree): Walk OMP_CLAUSE_CHAIN of OMP_CLAUSE_*
	nodes.  Use switch for all nodes, handle most of IS_EXPR_CODE_CLASS
	and TYPE_P nodes in its default clause.
	(empty_body_p): New.
	(tree_range_check_failed): New.
	(build5_stat): New.

	* tree.h (OMP_CLAUSE_REDUCTION_INIT,
	OMP_CLAUSE_REDUCTION_MERGE,
	OMP_CLAUSE_REDUCTION_PLACEHOLDER,
	OMP_CLAUSE_PRIVATE_DEBUG,
	OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE, OMP_FOR_PRE_BODY,
	OMP_MASTER_BODY, OMP_ORDERED_BODY OMP_BODY,
	OMP_CLAUSES, OMP_CLAUSE_DECL, OMP_CLAUSE_DEFAULT_KIND,
	OMP_CLAUSE_CHAIN, OMP_CLAUSE_OUTER_DECL,
	OMP_CLAUSE_INNER_DECL, OMP_CLAUSE_NUM_THREADS_EXPR,
	OMP_CLAUSE_IF_EXPR, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR,
	OMP_CLAUSE_SCHEDULE_CHUNK_SIZE. OMP_PARALLEL_VAR_INIT,
	OMP_PARALLEL_VAR_REDUC, OMP_FOR_VAR_INIT,
	OMP_FOR_VAR_LAST, OMP_FOR_VAR_REDUC,
	OMP_SECTIONS_VAR_INIT, OMP_SECTIONS_VAR_LAST,
	OMP_SECTIONS_VAR_REDUC, OMP_CLAUSE_REDUCTION_CODE
	OMP_SINGLE_CLAUSES, OMP_SINGLE_BODY,
	OMP_CLAUSE_SCHEDULE_CHUNK_SIZE, OMP_SECTION_BODY,
	OMP_CRITICAL_NAME, OMP_CRITICAL_BODY): New.
	(TREE_RANGE_CHECK): New.
	(empty_body_p): Declare.
	(enum omp_clause_default_kind): New.
	(build_string_literal): Declare.
	(enum omp_clause_schedule_kind, OMP_CLAUSE_SCHEDULE_KIND): New.
	(build5_stat, build5): Declare.

	* tree-pass.h (TDF_CHAIN): Define.
	* tree-pass.h (PROP_gimple_lomp): Define.
	(pass_lower_omp): Declare.

	* diagnostic.h (debug_tree_chain): Declare.

	* builtins.c (get_builtin_sync_mode): Use 0 as last argument to
	mode_for_size.
	(expand_builtin): Handle sync BUILT_IN_*_16 builtins.
	* builtins.c (build_string_literal): Make extern.

	* gcc.c (include_spec_function): New.
	(static_spec_functions): Add it.
	(main): Move load of libgomp.spec ...
	(LINK_COMMAND_SPEC): ... here.
	(link_gomp_spec): New.
	(static_specs): Include it.
	(LINK_COMMAND_SPEC): Add link_gomp.
	(GOMP_SELF_SPECS): New.
	(driver_self_specs): Include it.
	(switch_matches): Don't mark inline.
	(main): Load libgomp.spec.

	* tree-gimple.c (is_gimple_stmt): True for OMP_MASTER,
	OMP_ORDERED, OMP_CRITICAL, OMP_SECTIONS, OMP_SECTION,
	and OMP_SINGLE, OMP_FOR and OMP_PARALLEL.

	* tree-gimple.h (enum omp_parallel): Declare.
	(determine_parallel_type): Declare.
	(omp_firstprivatize_variable): Declare.
	(omp_reduction_init): Declare.
	(diagnose_omp_structured_block_errors): Declare.
	(struct walk_stmt_info): Add want_return_expr.
	(struct walk_stmt_info): Add want_bind_expr, want_locations.
	(find_omp_clause): Declare.
	(insert_field_into_struct): Declare.
	(struct walk_stmt_info): Move from tree-nested.c
	(walk_stmts): Declare.

	* c-cppbuiltin.c (c_cpp_builtins): If -fopenmp, #define _OPENMP
	to 200505.

	* cgraphunit.c (cgraph_lower_function): Make static.
	(cgraph_finalize_pending_functions): New.
	(cgraph_finalize_function): Call it.
	(cgraph_finalize_compilation_unit): Likewise.

	* builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16,
	BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
	(BT_FN_UINT_UINT): New.
	(DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_7,
	DEF_FUNCTION_TYPE_VAR_4): Document.
	(BT_PTR_LONG, BT_PTR_PTR, BT_FN_BOOL, BT_FN_INT,
	BT_FN_VOID_PTRPTR, BT_PTR_FN_VOID_PTR,
	BT_FN_BOOL_LONGPTR_LONGPTR, BT_FN_VOID_OMPFN_PTR_UINT,
	BT_FN_VOID_OMPFN_PTR_UINT_UINT,
	BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
	BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG): New.

	* builtins.def: Update DEF_BUILTIN comment to include COND argument.
	Move all DEF_SYNC_BUILTIN () and DEF_GOMP_BUILTIN () builtins
	into separate files.
	(DEF_GOMP_BUILTIN): New.
	(BUILT_IN_OMP_GET_THREAD_NUM, BUILT_IN_GOMP_BARRIER,
	BUILT_IN_GOMP_CRITICAL_START, BUILT_IN_GOMP_CRITICAL_END,
	BUILT_IN_GOMP_CRITICAL_NAME_START, BUILT_IN_GOMP_CRITICAL_NAME_END,
	BUILT_IN_GOMP_LOOP_STATIC_START, BUILT_IN_GOMP_LOOP_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_GUIDED_START, BUILT_IN_GOMP_LOOP_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
	BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_START,
	BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_STATIC_NEXT, BUILT_IN_GOMP_LOOP_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_RUNTIME_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_NEXT,
	BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_END, BUILT_IN_GOMP_LOOP_END_NOWAIT,
	BUILT_IN_GOMP_ORDERED_START, BUILT_IN_GOMP_ORDERED_END,
	BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END,
	BUILT_IN_GOMP_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_NEXT,
	BUILT_IN_GOMP_PARALLEL_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_END,
	BUILT_IN_GOMP_SECTIONS_END_NOWAIT, BUILT_IN_GOMP_SINGLE_START,
	BUILT_IN_GOMP_SINGLE_COPY_START, BUILT_IN_GOMP_SINGLE_COPY_END): New.
	* sync-builtins.def: New file, moved from builtins.def.
	* omp-builtins.def: New file, moved from builtins.def.

	* c-objc-common.h (LANG_HOOKS_OMP_PREDETERMINED_SHARING): Redefine.

	* gimple-low.c (lower_function_body): Clear data.
	(lower_stmt): Do not handle COMPOUND_EXPR.
	Remove call to print_node_brief.

	* c-tree.h (c_finish_omp_clauses): New prototype.
	(C_DECL_THREADPRIVATE_P): Define.
	(lookup_name_no_remap, c_omp_remap_private): Remove
	(c_begin_omp_parallel, c_finish_omp_parallel): Update.
	(check_for_loop_decls): Update decl.
	(lookup_name_no_remap, c_omp_remap_private): Declare.
	(build_indirect_ref, build_modify_expr, pushdecl,
	pushdecl_top_level): Move to c-common.h.

	* dwarf2out.c (loc_descriptor_from_tree_1): Don't set unsignedp
	before the switch, but just in the 2 places that need it.

	* c-decl.c (diagnose_mismatched_decls): Do not check for
	mismatched thread-local attributes when OLDDECL is marked
	threadprivate and NEWDECL has no thread-local attributes.
	(merge_decls): Merge C_DECL_THREADPRIVATE_P.
	(c_gimple_diagnostics_recursively): Rename from
	c_warn_unused_result_recursively.  Invoke
	diagnose_omp_structured_block_errors.
	(check_for_loop_decls): Return a singular decl found.

	* langhooks.c (lhd_omp_predetermined_sharing): Return
	OMP_CLAUSE_DEFAULT_SHARED for DECL_ARTIFICIAL decls.
	(lhd_omp_firstprivatize_type_sizes): New.
	(lhd_omp_assignment): New.
	(lhd_omp_predetermined_sharing): New.

	* langhooks.h (struct gimplify_omp_ctx): Forward declare.
	(struct lang_hooks_for_types): Add
	omp_firstprivatize_type_sizes, omp_privatize_by_reference,
	omp_predetermined_sharing, omp_disregard_value_expr,
	omp_private_debug_clause, omp_clause_default_ctor,
	omp_clause_copy_ctor, omp_clause_assign_op, omp_clause_dtor.

	(c_finish_omp_clauses): New.
	(c_finish_bc_stmt): Diagnose break within omp for.
	(c_begin_omp_parallel, c_finish_omp_parallel): New.
	(build_unary_op): Return error_mark after reporting
	a readonly_error.
	(build_modify_expr): Likewise.

	* gimplify.c: Include optabs.h and pointer-set.h.
	(enum gimplify_omp_var_data): Declare.
	(struct gimplify_omp_ctx): Declare.
	(struct gimplify_ctx): Add fields prev_context, combined_pre_p
	and combined_ctxp.
	(gimplify_ctxp, gimplify_omp_ctxp): New local variables.
	(push_gimplify_context, pop_gimplify_context): Allow nesting.
	(splay_tree_compare_decl_uid): New.
	(new_omp_context): New.
	(delete_omp_context): New.
	(gimple_add_tmp_var): Call omp_add_variable.
	(gimplify_bind_expr): Likewise.
	(gimplify_var_or_parm_decl): If omp_notice_variable returned
	true, disregard DECL_VALUE_EXPR on the decl if any.
	(gimplify_expr_in_ctx): New.
	(omp_firstprivatize_variable, omp_firstprivatize_type_sizes
	omp_add_variable, omp_notice_variable, omp_is_private
	gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1
	gimplify_adjust_omp_clauses, gimplify_omp_parallel
	gimplify_omp_for, gimplify_omp_workshare, goa_lhs_expr_p
	gimplify_omp_atomic_fetch_op, goa_stabilize_expr
	gimplify_omp_atomic_pipeline, gimplify_omp_atomic_mutex
	gimplify_omp_atomic): New.
	(gimplify_expr): Handle OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
	OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
	OMP_CRITICAL and OMP_ATOMIC.
	(gimplify_body): Verify gimplify_ctxp is empty after gimplification.

	* c-pragma.h (enum pragma_kind): Add
	PRAGMA_OMP_ATOMIC, PRAGMA_OMP_BARRIER,
	PRAGMA_OMP_CRITICAL, PRAGMA_OMP_FLUSH, PRAGMA_OMP_FOR,
	PRAGMA_OMP_MASTER, PRAGMA_OMP_ORDERED,
	PRAGMA_OMP_PARALLEL, PRAGMA_OMP_PARALLEL_FOR,
	PRAGMA_OMP_PARALLEL_SECTIONS, PRAGMA_OMP_SECTION,
	PRAGMA_OMP_SECTIONS, PRAGMA_OMP_SINGLE,
	PRAGMA_OMP_THREADPRIVATE.

	* tree.def (OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
	OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
	OMP_CRITICAL, OMP_ATOMIC, OMP_CLAUSE_PRIVATE,
	OMP_CLAUSE_SHARED, OMP_CLAUSE_FIRSTPRIVATE,
	OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_REDUCTION,
	OMP_CLAUSE_COPYIN, OMP_CLAUSE_COPYPRIVATE,
	OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS,
	OMP_CLAUSE_SCHEDULE, OMP_CLAUSE_NOWAIT,
	OMP_CLAUSE_ORDERED, OMP_CLAUSE_DEFAULT): Define.

	* print-tree.c (print_node): Dump DECL_VALUE_EXPR.

	* tree-ssa-dce.c (find_control_dependence): Do not assume that
	ENTRY_BLOCK_PTR->next_bb == single_succ (ENTRY_BLOCK_PTR).

	* tree-nested.c (convert_call_expr): Call walk_body on OMP_BODY for
	OpenMP directives.
	(struct nesting_info): Add field_map,
	suppress_expansion, debug_var_chain.
	(create_nesting_tree): Initialize them.
	(lookup_field_for_decl): Use field_map.
	(get_nonlocal_debug_decl, get_local_debug_decl): New.
	(convert_local_omp_clauses): New.
	(finalize_nesting_tree_1): Add debug_var_chain to toplevel block.
	(walk_body): Split out of walk_function.
	(convert_nonlocal_omp_clauses, convert_local_omp_clauses): New.
	(convert_nonlocal_reference): Handle omp statements.
	(convert_local_reference): Likewise.
	(unnest_nesting_tree_1): Split out of finalize_nesting_tree_1.
	(unnest_nesting_tree): New.
	(lower_nested_functions): Call it.
	(insert_field_into_struct): Make extern.
	(struct walk_stmt_info): Move to tree-gimple.h.
	(walk_stmts): Make extern.

	* omp-builtins.def: New file.

	* tree-iterator.c (expr_only): Clarify comment.

	* c-common.h (pushdecl_top_level, pushdecl,
	build_modify_expr, build_indirect_ref,
	c_finish_omp_master, c_finish_omp_critical,
	c_finish_omp_ordered, c_finish_omp_barrier,
	c_finish_omp_atomic, c_finish_omp_flush,
	c_finish_omp_for, c_split_parallel_clauses,
	omp_clause_default_kind, c_omp_sharing_predetermined,
	c_omp_remap_decl): Declare.

	* Makefile.in (BUILTINS_DEF): Add omp-builtins.def.
	(OBJS-common): Add omp-low.o.
	(c-omp.o, omp-low.o): Add.
	(gimplify.o): Add dependency on $(OPTABS_H).
	(GTFILES): Add omp-low.c.
	(gt-stringpool.h): Add.

	* tree-cfg.c (set_bb_for_stmt): Do not update the
	block-to-labels map if we are currently expanding to RTL.
	(tree_node_can_be_shared): Remove unnecessary CONSTANT_CLASS_P
	checks.
	Handle IDENTIFIER_NODE.
	(tree_verify_flow_info): Do not ICE when emitting error
	messages about invalid labels.
	(dump_function_to_file): Reset CFUN before emitting the body
	of the function.
	(debug_function): New.

	* passes.c (init_optimization_passes): Schedule
	pass_lower_omp.

	* langhooks-def.h (lhd_omp_predetermined_sharing,
	lhd_omp_assignment, lhd_omp_firstprivatize_type_sizes):
	Declare.
	(LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Use it.
	(LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE,
	LANG_HOOKS_OMP_PREDETERMINED_SHARING,
	LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
	LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE,
	LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR,
	LANG_HOOKS_OMP_CLAUSE_COPY_CTOR,
	LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP,
	LANG_HOOKS_OMP_CLAUSE_DTOR): Define.
	(LANG_HOOK_DECLS): Use them.


2006-01-18  Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
	    Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* c-parser.c (pragma_omp_clause): Define.
	(c_parser_declaration_or_fndef): Document OpenMP syntax.
	(c_parser_compound_statement): Likewise.
	(c_parser_statement): Likewise.
	(c_parser_pragma): Handle omp pragmas.
	(OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
	OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Define.
	(c_parser_omp_clause_name, check_no_duplicate_clause,
	c_parser_omp_variable_list,
	c_parser_omp_var_list_parens, c_parser_omp_clause_copyin,
	c_parser_omp_clause_copyprivate,
	c_parser_omp_clause_default,
	c_parser_omp_clause_firstprivate, c_parser_omp_clause_if,
	c_parser_omp_clause_lastprivate,
	c_parser_omp_clause_nowait,
	c_parser_omp_clause_num_threads,
	c_parser_omp_clause_ordered, c_parser_omp_clause_private,
	c_parser_omp_clause_reduction,
	c_parser_omp_clause_schedule, c_parser_omp_clause_shared,
	c_parser_omp_all_clauses, c_parser_omp_structured_block,
	c_parser_omp_atomic, c_parser_omp_barrier,
	c_parser_omp_critical, c_parser_omp_flush,
	c_parser_omp_for_loop, c_parser_omp_for,
	c_parser_omp_master, c_parser_omp_ordered,
	c_parser_omp_sections_scope, c_parser_omp_sections,
	c_parser_omp_parallel, c_parser_omp_single,
	c_parser_omp_construct, c_parser_omp_threadprivate): New.
	* c-pragma.c (init_pragma): Do omp pragma registration here.
	* c.opt (fopenmp): New flag.


2006-01-18  Eric Christopher  <echristo@apple.com>

	* gcc.c (GOMP_SELF_SPECS): Bracket in #ifndef/#endif.
	* config/darwin.h (GOMP_SELF_SPECS): Define.


testsuite/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>
            Uros Bizjak  <uros@kss-loka.si>

	* testsuite/gcc.dg/gomp: New directory.

From-SVN: r109902
2006-01-18 14:21:25 -05:00
Jakub Jelinek a0274e3e23 backport: builtins.def: Move all DEF_SYNC_BUILTIN to ...
Merge from gomp-branch.
        * builtins.def: Move all DEF_SYNC_BUILTIN to ...
        * sync-builtins.def: ... new file.
        (BUILT_IN_FETCH_AND_ADD_16,
        BUILT_IN_FETCH_AND_SUB_16, BUILT_IN_FETCH_AND_OR_16,
        BUILT_IN_FETCH_AND_AND_16, BUILT_IN_FETCH_AND_XOR_16,
        BUILT_IN_FETCH_AND_NAND_16, BUILT_IN_ADD_AND_FETCH_16,
        BUILT_IN_SUB_AND_FETCH_16, BUILT_IN_OR_AND_FETCH_16,
        BUILT_IN_AND_AND_FETCH_16, BUILT_IN_XOR_AND_FETCH_16,
        BUILT_IN_NAND_AND_FETCH_16, BUILT_IN_BOOL_COMPARE_AND_SWAP_16,
        BUILT_IN_VAL_COMPARE_AND_SWAP_16, BUILT_IN_LOCK_TEST_AND_SET_16,
        BUILT_IN_LOCK_RELEASE_16): New builtins.
        * builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16,
        BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
        * builtins.c (expand_builtin): Handle sync BUILT_IN_*_16 builtins.
        * c-common.c (enum c_builtin_type): Move to top-level from
        c_common_nodes_and_builtins enum builtin_type.
        (builtin_types): Move from c_common_nodes_and_builtins.
        (def_fn_type): New.
        (c_common_nodes_and_builtins): Use it.
        (def_builtin_1): Check for error_mark_node.
        (sync_resolve_size): Handle also 128 bit sync builtins.
        * Makefile.in (BUILTINS_DEF): New.  Use it instead of builtins.def.

        * config/i386/i386.h (x86_cmpxchg8b, x86_cmpxchg16b): New decls.
        (TARGET_CMPXCHG8B, TARGET_CMPXCHG16B): Define.
        * config/i386/i386.c (x86_cmpxchg8b, x86_cmpxchg16b): New variables.
        * config/i386/sync.md (CASMODE, DCASMODE): New mode macros.
        (doublemodesuffix, DCASHMODE): New mode attrs.
        (sync_compare_and_swap<mode>): Change into expand, use CASMODE
        instead of IMODE, if mode is wider than a word, expand into
        sync_double_compare_and_swap*.
        (*sync_compare_and_swap<mode>): New insn.
        (sync_double_compare_and_swap<mode>): Likewise.
        (*sync_double_compare_and_swapdi_pic): Likewise.
        (sync_compare_and_swap_cc<mode>): Use CASMODE instead of IMODE, if
        mode is wider than a word, expand into
        sync_double_compare_and_swap_cc*.
        (sync_double_compare_and_swap_cc<mode>): New insn.
        (*sync_double_compare_and_swap_ccdi_pic): Likewise.

From-SVN: r108997
2005-12-22 16:43:34 -08:00
Jon Grimm 9a8ce21f3b target-def.h (TARGET_DECIMAL_FLOAT_SUPPORTED_P): New.
2005-12-16  Jon Grimm  <jgrimm2@us.ibm.com>
	    Janis Johnson  <janis187@us.ibm.com>
	    Ben Elliston  <bje@au.ibm.com>

	* target-def.h (TARGET_DECIMAL_FLOAT_SUPPORTED_P): New.
	(TARGET_INITIALIZER): Add TARGET_DECIMAL_FLOAT_P.
	* target.h (struct gcc_target): Add decimal_float_supported_p.
	* targhooks.c (default_scalar_mode_supported_p): Handle
	MODE_DECIMAL_FLOAT.
	* builtins.def: Add new builtins for 32, 64 and 128 bit variants
	of inf, nan, finite, isinf and isnan.
	* builtin-types.def (BT_DFLOAT32, BT_DFLOAT64, BT_DFLOAT128,
	BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR,
	BT_FN_DFLOAT32, BT_FN_DFLOAT64, BT_FN_DFLOAT128,
	BT_FN_INT_DFLOAT32, BT_FN_INT_DFLOAT64, BT_FN_INT_DFLOAT128,
	BT_FN_DFLOAT32_CONST_STRING, BT_FN_DFLOAT64_CONST_STRING,
	BT_FN_DFLOAT32_CONST_STRING, BT_FN_DFLOAT32_DFLOAT32,
	BT_FN_DFLOAT64_DFLOAT64, BT_FN_DFLOAT128_DFLOAT128): New.
	* c-decl.c (declspecs_add_type): Verify combos on type qualifiers.
	Pedwarn if decimal floating point types are used.  Error if
	decimal floating point is not supported by the target.
	(finish_declspecs): Return type from DFP typespec_word.
	* c-typeck.c (c_common_type): Choose the decimal floating point
	type with the greater precision when determining a common type.
	(convert_arguments): Warn if there is a mismatch between argument
	and prototype for decimal float types.  Warn of conversions with
	binary float types and of precision narrowing due to prototype.
	* c-parser.c (reswords): Add _Decimal32, _Decimal64, _Decimal128.
	(c_token_starts_typename): Handle RID_DFLOAT32/64/128.
	(c_token_starts_declspecs): Likewise.
	(c_parser_attributes): Likewise.
	* c-common.h (enum rid): Add new enumeration values RID_DFLOAT32,
	RID_DFLOAT64, RID_DFLOAT128.
	(T_D32, TEX_D32, T_D64, TEX_D64, T_D128, TEX_D128): New macros.
	* c-common.c (c_common_type_for_mode): Handle decimal float modes.
	(shorten_compare): Convert DFP/BFP operands to a common type.
	(c_common_modes_and_builtins): Register built-in decimal float
	types if the target supports them.
	(handle_mode_addtribute): Handle MODE_DECIMAL_FLOAT.
	* builtins.c (fold_builtin_1): Handle 32, 64 and 128 bit cases of
	inf, nan, finite, isinf and isnan builtins.
	* c-cppbuiltin.c (builtin_define_decimal_float_constants): New.
	(builtin_define_float_constants): Assert non-decimal radix.
	(c_cpp_builtins): Register built-in __DEC_EVAL_METHOD__ define.
	Call builtin_define_decimal_float_constants for each type.
	* c-lex.c (interpret_float): Decode decimal float types from CPP_N
	flags.  Use real_from_string3, which can handle binary or decimal
	floats.
	* c-tree.h (enum c_typespec_keyword): Add cts_dfloat32,
	cts_dfloat64, cts_dfloat128.
	* tree.c (build_common_tree_nodes_2): Add decimal float types.
	* tree.h (enum tree_index): Add new enumeration values
	TI_DFLOAT32_TYPE, TI_DFLOAT64_TYPE, TI_DFLOAT128_TYPE,
	TI_DFLOAT32_PTR_TYPE, TI_DFLOAT64_PTR_TYPE, TI_DFLOAT128_PTR_TYPE.
	(dfloat32_type_node): New macro.
	(dfloat64_type_node, dfloat128_type_node): Likewise.
	(dfloat32_ptr_type_node, dfloat64_ptr_type_node): Likewise.
	(dfloat128_ptr_type_node): Likewise.
	* c-pretty-print.c (pp_c_floating_constant): Append 32, 64 and 128
	bit decimal floating point types with "df", "dd" and "dl".
	* c-format.h (enum format_lengths): Add new enumeration values
	FMT_LEN_H, FMT_LEN_D and FMT_LEN_DD.
	* c-format.c (printf_length_specs, scanf_length_specs): Add
	entries for H, D, DD.
	(print_char_table, scan_char_table): Use new entries.
	(asm_fprintf_char_table, gcc_diag_char_table,
	gcc_cdiag_char_table, gcc_cxxdiag_char_table): Adjust for longer
	length arrays.
	* defaults.h (DECIMAL32_TYPE_SIZE): Define.
	(DECIMAL64_TYPE_SIZE): Likewise.
	(DECIMAL128_TYPE_SIZE): Likewise.
	(TARGET_DEC_EVAL_METHOD): Likewise.
	* doc/extend.texi (Decimal Float): New node.
	(Constructing Calls): Document decimal float built-ins.
	* doc/tm.texi: Document TARGET_DECIMAL_FLOAT_SUPPORTED_P hook.
	* Makefile.in (USER_H): Add $(srcdir)/ginclude/decfloat.h.
	* ginclude/decfloat.h: New file.

Co-Authored-By: Ben Elliston <bje@au.ibm.com>
Co-Authored-By: Janis Johnson <janis187@us.ibm.com>

From-SVN: r108629
2005-12-16 17:38:26 +11:00
Kaveh R. Ghazi b53b5aa509 builtins.def (BUILT_IN_PUTC, [...]): New.
* builtins.def (BUILT_IN_PUTC, BUILT_IN_PUTC_UNLOCKED): New.

	* config/pa/pa.c (pa_init_builtins): If we detect
	DONT_HAVE_FPUTC_UNLOCKED, set builtin fputc_unlocked to
	putc_unlocked.

From-SVN: r107833
2005-12-01 22:46:14 +00:00
Francois-Xavier Coudert 1b135aa53e builtins.def: Add DEF_EXT_C99RES_BUILTIN to define builtins that C99 reserve for future use.
* builtins.def: Add DEF_EXT_C99RES_BUILTIN to define builtins
	that C99 reserve for future use. Use it to define clog10,
	clog10f and clog10l.

From-SVN: r102331
2005-07-24 08:36:33 +00:00
Jakub Jelinek 10a0d49571 builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6.
* builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6.
	(DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6.
	(ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define.
	(ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5,
	ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define.
	* builtins.c: Include tree-flow.h.
	(expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes.
	(expand_builtin_object_size, expand_builtin_memory_chk,
	maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning,
	compute_object_offset, compute_builtin_object_size,
	fold_builtin_object_size): New functions.
	(expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK.
	(fold_builtin_1): Likewise.  Handle BUILT_IN_{,V}{,F}PRINTF
	and BUILT_IN_{,F}PRINTF_UNLOCKED.
	(fold_builtin_memory_chk, fold_builtin_stxcpy_chk,
	fold_builtin_strncpy_chk, fold_builtin_strcat_chk,
	fold_builtin_strncat_chk, fold_builtin_sprintf_chk,
	fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf):
	New functions.
	* builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK,
	BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK,
	BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK,
	BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK,
	BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK,
	BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK,
	BUILT_IN_VPRINTF_CHK): New builtins.
	* builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4):
	Document.
	(BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG,
	BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE,
	BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE,
	BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG,
	BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR,
	BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR,
	BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types.
	* c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6,
	DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define.
	* Makefile.in (OBJS-common): Add tree-object-size.o.
	(tree-object-size.o): Add dependencies.
	* tree-pass.h (pass_object_sizes): Add.
	* tree-optimize.c (init_tree_optimization_passes): Add
	pass_object_sizes.
	* tree-object-size.c: New file.
	* tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk,
	fold_builtin_strncpy_chk, fold_builtin_snprintf_chk,
	compute_builtin_object_size, init_object_sizes, fini_object_sizes):
	New prototypes.
	* tree-ssa-ccp.c (get_strlen): Rename to ...
	(get_maxval_strlen): ...this function.  Handle also computing of maximum
	string length and maximum integral value.
	(ccp_fold_builtin): Handle BUILT_IN_*_CHK.  Use get_maxval_strlen
	instead of get_strlen.  Pass CALLEE and ARGLIST variables to the
	folding functions instead of computing them again.
	(execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed
	into some other builtin.
	* doc/extend.texi (Object Size Checking): Document.

	* gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype.
	* gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid
	testing uninitialized var.

	* gcc.c-torture/execute/builtins/chk.h: New.
	* gcc.c-torture/execute/builtins/lib/chk.c: New.
	* gcc.c-torture/execute/builtins/memcpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/memmove-chk.c: New test.
	* gcc.c-torture/execute/builtins/memmove-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/mempcpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/memset-chk.c: New test.
	* gcc.c-torture/execute/builtins/memset-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/snprintf-chk.c: New test.
	* gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/sprintf-chk.c: New test.
	* gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/stpcpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/strcat-chk.c: New test.
	* gcc.c-torture/execute/builtins/strcat-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/strcpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/strncat-chk.c: New test.
	* gcc.c-torture/execute/builtins/strncat-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/strncpy-chk.c: New test.
	* gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test.
	* gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New.
	* gcc.c-torture/execute/builtins/vsprintf-chk.c: New test.
	* gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New.
	* gcc.dg/builtin-object-size-1.c: New test.
	* gcc.dg/builtin-object-size-2.c: New test.
	* gcc.dg/builtin-object-size-3.c: New test.
	* gcc.dg/builtin-object-size-4.c: New test.
	* gcc.dg/builtin-object-size-5.c: New test.
	* gcc.dg/builtin-stringop-chk-1.c: New test.
	* gcc.dg/builtin-stringop-chk-2.c: New test.
	* gcc.dg/tree-ssa/builtin-fprintf-1.c: New test.
	* gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test.
	* gcc.dg/tree-ssa/builtin-printf-1.c: New test.
	* gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test.
	* gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test.
	* gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test.
	* gcc.dg/tree-ssa/builtin-vprintf-1.c: New test.
	* gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test.
	* gcc.c-torture/execute/printf-1.c: New test.
	* gcc.c-torture/execute/fprintf-1.c: New test.
	* gcc.c-torture/execute/vprintf-1.c: New test.
	* gcc.c-torture/execute/vfprintf-1.c: New test.
	* gcc.c-torture/execute/printf-chk-1.c: New test.
	* gcc.c-torture/execute/fprintf-chk-1.c: New test.
	* gcc.c-torture/execute/vprintf-chk-1.c: New test.
	* gcc.c-torture/execute/vfprintf-chk-1.c: New test.

From-SVN: r101352
2005-06-27 14:17:39 +02:00
Kelley Cook 366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
Paolo Carlini c3887ef239 re PR middle-end/21743 (Enable __builtin_clog)
2005-05-30  Paolo Carlini  <pcarlini@suse.de>

	PR middle-end/21743
	* builtins.def (BUILT_IN_CLOG, BUILT_IN_CLOGF, BUILT_IN_CLOGL):
	Enable.
	* doc/extend.texi: Add clog, clogf, clogl.

From-SVN: r100374
2005-05-30 20:15:46 +00:00
Richard Henderson 48ae6c138c re PR middle-end/14311 (builtins for atomic operations needed)
PR middle-end/14311
	* builtin-types.def (BT_BOOL, BT_VOLATILE_PTR, BT_I1, BT_I2,
	BT_I4, BT_I8, BT_FN_VOID_VPTR, BT_FN_I1_VPTR_I1, BT_FN_I2_VPTR_I2,
	BT_FN_I4_VPTR_I4, BT_FN_I8_VPTR_I8, BT_FN_BOOL_VPTR_I1_I1,
	BT_FN_BOOL_VPTR_I2_I2, BT_FN_BOOL_VPTR_I4_I4, BT_FN_BOOL_VPTR_I8_I8,
	BT_FN_I1_VPTR_I1_I1, BT_FN_I2_VPTR_I2_I2, BT_FN_I4_VPTR_I4_I4,
	BT_FN_I8_VPTR_I8_I8): New.
	* builtins.def (DEF_SYNC_BUILTIN): New.
	(BUILT_IN_FETCH_AND_ADD_N, BUILT_IN_FETCH_AND_ADD_1,
	BUILT_IN_FETCH_AND_ADD_2, BUILT_IN_FETCH_AND_ADD_4,
	BUILT_IN_FETCH_AND_ADD_8, BUILT_IN_FETCH_AND_SUB_N,
	BUILT_IN_FETCH_AND_SUB_1, BUILT_IN_FETCH_AND_SUB_2,
	BUILT_IN_FETCH_AND_SUB_4, BUILT_IN_FETCH_AND_SUB_8,
	BUILT_IN_FETCH_AND_OR_N, BUILT_IN_FETCH_AND_OR_1,
	BUILT_IN_FETCH_AND_OR_2, BUILT_IN_FETCH_AND_OR_4,
	BUILT_IN_FETCH_AND_OR_8, BUILT_IN_FETCH_AND_AND_N,
	BUILT_IN_FETCH_AND_AND_1, BUILT_IN_FETCH_AND_AND_2,
	BUILT_IN_FETCH_AND_AND_4, BUILT_IN_FETCH_AND_AND_8,
	BUILT_IN_FETCH_AND_XOR_N, BUILT_IN_FETCH_AND_XOR_1,
	BUILT_IN_FETCH_AND_XOR_2, BUILT_IN_FETCH_AND_XOR_4,
	BUILT_IN_FETCH_AND_XOR_8, BUILT_IN_FETCH_AND_NAND_N,
	BUILT_IN_FETCH_AND_NAND_1, BUILT_IN_FETCH_AND_NAND_2,
	BUILT_IN_FETCH_AND_NAND_4, BUILT_IN_FETCH_AND_NAND_8,
	BUILT_IN_ADD_AND_FETCH_N, BUILT_IN_ADD_AND_FETCH_1,
	BUILT_IN_ADD_AND_FETCH_2, BUILT_IN_ADD_AND_FETCH_4,
	BUILT_IN_ADD_AND_FETCH_8, BUILT_IN_SUB_AND_FETCH_N,
	BUILT_IN_SUB_AND_FETCH_1, BUILT_IN_SUB_AND_FETCH_2,
	BUILT_IN_SUB_AND_FETCH_4, BUILT_IN_SUB_AND_FETCH_8,
	BUILT_IN_OR_AND_FETCH_N, BUILT_IN_OR_AND_FETCH_1,
	BUILT_IN_OR_AND_FETCH_2, BUILT_IN_OR_AND_FETCH_4,
	BUILT_IN_OR_AND_FETCH_8, BUILT_IN_AND_AND_FETCH_N,
	BUILT_IN_AND_AND_FETCH_1, BUILT_IN_AND_AND_FETCH_2,
	BUILT_IN_AND_AND_FETCH_4, BUILT_IN_AND_AND_FETCH_8,
	BUILT_IN_XOR_AND_FETCH_N, BUILT_IN_XOR_AND_FETCH_1,
	BUILT_IN_XOR_AND_FETCH_2, BUILT_IN_XOR_AND_FETCH_4,
	BUILT_IN_XOR_AND_FETCH_8, BUILT_IN_NAND_AND_FETCH_N,
	BUILT_IN_NAND_AND_FETCH_1, BUILT_IN_NAND_AND_FETCH_2,
	BUILT_IN_NAND_AND_FETCH_4, BUILT_IN_NAND_AND_FETCH_8,
	BUILT_IN_BOOL_COMPARE_AND_SWAP_N, BUILT_IN_BOOL_COMPARE_AND_SWAP_1,
	BUILT_IN_BOOL_COMPARE_AND_SWAP_2, BUILT_IN_BOOL_COMPARE_AND_SWAP_4,
	BUILT_IN_BOOL_COMPARE_AND_SWAP_8, BUILT_IN_VAL_COMPARE_AND_SWAP_N,
	BUILT_IN_VAL_COMPARE_AND_SWAP_1, BUILT_IN_VAL_COMPARE_AND_SWAP_2,
	BUILT_IN_VAL_COMPARE_AND_SWAP_4, BUILT_IN_VAL_COMPARE_AND_SWAP_8,
	BUILT_IN_LOCK_TEST_AND_SET_N, BUILT_IN_LOCK_TEST_AND_SET_1,
	BUILT_IN_LOCK_TEST_AND_SET_2, BUILT_IN_LOCK_TEST_AND_SET_4,
	BUILT_IN_LOCK_TEST_AND_SET_8, BUILT_IN_LOCK_RELEASE_N,
	BUILT_IN_LOCK_RELEASE_1, BUILT_IN_LOCK_RELEASE_2,
	BUILT_IN_LOCK_RELEASE_4, BUILT_IN_LOCK_RELEASE_8,
	BUILT_IN_SYNCHRONIZE: New.
	* builtins.c (called_as_built_in): Rewrite from CALLED_AS_BUILT_IN
	as a function.  Accept __sync_ as a prefix as well.
	(expand_builtin_sync_operation, expand_builtin_compare_and_swap,
	expand_builtin_lock_test_and_set, expand_builtin_synchronize,
	expand_builtin_lock_release): New.
	(expand_builtin): Call them.
	* c-common.c (DEF_BUILTIN): Don't require __builtin_ prefix if
	neither BOTH_P nor FALLBACK_P are defined.
	(builtin_type_for_size): New.
	(sync_resolve_size, sync_resolve_params, sync_resolve_return): New.
	(resolve_overloaded_builtin): New.
	* c-common.h (resolve_overloaded_builtin): Declare.
	(builtin_type_for_size): Declare.
	* c-typeck.c (build_function_call): Invoke resolve_overloaded_builtin.
	* expr.c (sync_add_optab, sync_sub_optab, sync_ior_optab,
	sync_and_optab, sync_xor_optab, sync_nand_optab, sync_old_add_optab,
	sync_old_sub_optab, sync_old_ior_optab, sync_old_and_optab,
	sync_old_xor_optab, sync_old_nand_optab, sync_new_add_optab,
	sync_new_sub_optab, sync_new_ior_optab, sync_new_and_optab,
	sync_new_xor_optab, sync_new_nand_optab, sync_compare_and_swap,
	sync_compare_and_swap_cc, sync_lock_test_and_set,
	sync_lock_release): New.
	* optabs.h: Declare them.
	* expr.h (expand_val_compare_and_swap, expand_bool_compare_and_swap,
	expand_sync_operation, expand_sync_fetch_operation,
	expand_sync_lock_test_and_set): Declare.
	* genopinit.c (optabs): Add sync optabs.
	* optabs.c (init_optabs): Initialize sync optabs.
	(expand_val_compare_and_swap_1, expand_val_compare_and_swap,
	expand_bool_compare_and_swap, expand_compare_and_swap_loop,
	expand_sync_operation, expand_sync_fetch_operation,
	expand_sync_lock_test_and_set): New.
	* doc/extend.texi (Atomic Builtins): New section
	* doc/md.texi (Standard Names): Add sync patterns.

From-SVN: r98154
2005-04-14 16:37:47 -07:00
Uros Bizjak f94b16611c * builtins.def (BUILT_IN_LCEIL, BUILT_IN_LCEILF, BUILT_IN_LCEILL)
(BUILT_IN_LLCEIL, BUILT_IN_LLCEILF, BUILT_IN_LLCEILL): New.
	* optabs.h (enum optab_index): Add new OTI_lceil.
	(lceil_optab): Define corresponding macro.
	* optabs.c (init_optabs): Initialize lceil_optab.
	* genopinit.c (optabs): Implement lceil_optab using lceilsi2
	and lceildi2 patterns.

	* builtins.c (expand_builtin_int_roundingfn): Handle
	BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L}.
	(fold_builtin_int_roundingfn): Handle BUILT_IN_LCEIL{,F,L} and
	BUILT_IN_LLCEIL{,F,L}.
	(fold_builtin_1): Fold BUILT_IN_LCEIL{,F,L} and
	BUILT_IN_LLCEIL{,F,L} using fold_builtin_int_roundingfn.
	(mathfn_built_in): Handle BUILT_IN LCEIL and BUILT_IN_LLCEIL.
	(expand_builtin): Expand BUILT_IN_LCEIL{,F,L} and
	BUILT_IN_LLCEIL{,F,L} using expand_builtin_int_roundingfn.

	* convert.c (convert_to_integer): Convert (long int)ceil{,f,l},
	into lceil built-in function and (long long int)ceil{,f,l} into
	llceil built-in function.
	* fold-const.c (tree_expr_nonnegative_p): Add BUILT_IN_LCEIL and
	BUILT_IN_LLCEIL.
testsuite:

	* gcc.dg/builtins-53.c: Also check (int)ceil* and
	(long long int)ceil*.

From-SVN: r97964
2005-04-11 08:16:39 +02:00
Uros Bizjak d8b42d069e * builtins.def (BUILT_IN_LFLOOR, BUILT_IN_LFLOORF, BUILT_IN_LFLOORL)
(BUILT_IN_LLFLOOR, BUILT_IN_LLFLOORF, BUILT_IN_LLFLOORL): New.
	* optabs.h (enum optab_index): Add new OTI_lfloor.
	(lfloor_optab): Define corresponding macro.
	* optabs.c (init_optabs): Initialize lfloor_optab.
	* genopinit.c (optabs): Implement lfloor_optab using lfloorsi2
	and lfloordi2 patterns.

	* builtins.c (expand_builtin_int_roundingfn): New prototype.
	(expand_builtin_int_roundingfn): New function.
	(fold_builtin_int_roundingfn): New prototype.
	(fold_builtin_int_roundingfn): New function, renamed from
	fold_builtin_lround.
	Handle BUILT_IN_LROUND{,F,L}, BUILT_IN_LLROUND{,F,L} and
	BUILT_IN_LFLOOR{,F,L}, BUILT_IN_LLFLOOR{,F,L}.
	(fold_builtin_1): Fold BUILT_IN_LFLOOR{,F,L} and
	BUILT_IN_LLFLOOR{,F,L} using fold_builtin_int_roundingfn.
	(mathfn_built_in): Handle BUILT_IN LFLOOR and BUILT_IN_LLFLOOR.
	(expand_builtin): Expand BUILT_IN_LFLOOR{,F,L} and
	BUILT_IN_LLFLOOR{,F,L} using expand_builtin_int_roundingfn.

	* convert.c (convert_to_integer): Convert (long int)floor{,f,l},
	into lfloor built-in function and (long long int)floor{,f,l} into
	llfloor built-in function.
	* fold-const.c (tree_expr_nonnegative_p): Add BUILT_IN_LFLOOR and
	BUILT_IN_LLFLOOR.

testsuite:

	* gcc.dg/builtins-53.c: New test.

From-SVN: r97886
2005-04-09 07:31:46 +02:00
Kaveh R. Ghazi e905ac64c0 builtins.def (BUILT_IN_STPNCPY, [...]): New.
* builtins.def (BUILT_IN_STPNCPY, BUILT_IN_STRCASECMP,
	BUILT_IN_STRNCASECMP): New.
	* doc/extend.texi: Document stpncpy, strcasecmp, strncasecmp
	and strndup.

testsuite:
	* gcc.dg/nonnull-3.c: Also test __builtin_stpncpy,
	__builtin_strcasecmp and __builtin_strncasecmp.

From-SVN: r97498
2005-04-03 22:08:12 +00:00
Kaveh R. Ghazi 1ad81c8e57 builtin-types.def (BT_FN_STRING_CONST_STRING_SIZE): New.
* builtin-types.def (BT_FN_STRING_CONST_STRING_SIZE): New.
	* builtins.def (BUILT_IN_STRNDUP): New.

testsuite:
	* gcc.dg/nonnull-3.c: Also test __builtin_strndup.

From-SVN: r97077
2005-03-26 02:25:30 +00:00
Zdenek Dvorak dcd6de6d69 builtin-attrs.def (ATTR_NOVOPS, [...]): New.
* builtin-attrs.def (ATTR_NOVOPS, ATTR_NOVOPS_LIST,
	ATTR_PURE_NOTHROW_NOVOPS_LIST): New.
	* builtins.def (ATTR_MATHFN_FPROUNDING): Use NOVOPS.
	(BUILT_IN_PREFETCH): Set the NOVOPS attribute.
	* c-common.c (handle_novops_attribute): New function.
	(c_common_attribute_table): Add "no vops" entry.
	* c-decl.c (merge_decls): Copy DECL_IS_NOVOPS.
	* calls.c (flags_from_decl_or_type): Set ECF_NOVOPS.
	* tree-ssa-operands.c (get_call_expr_operands): Do not
	create virtual operands for calls with ECF_NOVOPS flag.
	* tree.h (DECL_IS_NOVOPS): New macro.
	(struct tree_decl): Add novops_flag.
	(ECF_NOVOPS): New constant.

From-SVN: r96438
2005-03-14 16:21:16 +00:00
Kaveh R. Ghazi 74124c73c1 builtin-attrs.def (ATTR_NONNULL_LIST, [...]): New "nonnull" attribute lists which are non-specific regarding the nonnull...
* builtin-attrs.def (ATTR_NONNULL_LIST, ATTR_NOTHROW_NONNULL,
	ATTR_CONST_NOTHROW_NONNULL, ATTR_PURE_NOTHROW_NONNULL,
	ATTR_MALLOC_NOTHROW_NONNULL): New "nonnull" attribute lists which
	are non-specific regarding the nonnull parameter positions.
	(ATTR_NONNULL_1_2, ATTR_NONNULL_1_4, ATTR_NOTHROW_NONNULL_1_2,
	ATTR_NOTHROW_NONNULL_1_4, ATTR_CONST_NOTHROW_NONNULL_1,
	ATTR_PURE_NOTHROW_NONNULL_1, ATTR_PURE_NOTHROW_NONNULL_1_2,
	ATTR_MALLOC_NOTHROW_NONNULL_1): Delete.

	* builtins.def: Use the non-specific "nonnull" attibute lists.

From-SVN: r96298
2005-03-11 13:33:21 +00:00
Kazu Hirata c486021de8 builtins.def, [...]: Update copyright.
* builtins.def, haifa-sched.c, libgcc2.c, libgcc2.h,
	tree-ssa-loop-ivcanon.c, tree-ssa-loop-niter.c,
	config/cris/cris-protos.h, config/cris/cris.c: Update
	copyright.

From-SVN: r94840
2005-02-10 18:59:07 +00:00
Richard Henderson c6a912da40 builtins.c (DEF_BUILTIN): Add COND argument.
* builtins.c (DEF_BUILTIN): Add COND argument.
        * tree.h (DEF_BUILTIN): Likewise.
        * builtins.def (DEF_GCC_BUILTIN, DEF_LIB_BUILTIN, DEF_EXT_LIB_BUILTIN,
        DEF_C94_BUILTIN, DEF_C99_BUILTIN, DEF_C99_C90RES_BUILTIN): Update to
        match.
        (DEF_BUILTIN_STUB): New.
        (BUILT_IN_STACK_SAVE, BUILT_IN_STACK_RESTORE, BUILT_IN_INIT_TRAMPOLINE,
        BUILT_IN_ADJUST_TRAMPOLINE, BUILT_IN_NONLOCAL_GOTO,
        BUILT_IN_PROFILE_FUNC_ENTER, BUILT_IN_PROFILE_FUNC_EXIT): Use it.
        * c-common.c (DEF_BUILTIN): Add COND argument.
        * tree.c (local_define_builtin): New.
        (build_common_builtin_nodes): New.
ada/
        * utils.c (gnat_define_builtin): Remove.
        (gnat_install_builtins): Use build_common_builtin_nodes.
fortran/
        * f95-lang.c (gfc_init_builtin_functions): Call
        build_common_builtin_nodes; do not define any functions handled
        by it.
java/
        * builtins.c (initialize_builtins): Call build_common_builtin_nodes.
        * decl.c (java_init_decl_processing): Initialize const_ptr_type_node.
treelang/
        * treetree.c (treelang_init_decl_processing): Call
        build_common_builtin_nodes.

From-SVN: r94785
2005-02-09 16:22:25 -08:00
Richard Guenther 17684d4629 re PR middle-end/19402 (__builtin_powi? still missing)
2005-02-09  Richard Guenther  <rguenth@gcc.gnu.org>

	PR middle-end/19402

	* builtins.def: New __builtin_powi[lf].
	* builtins.c (mathfn_built_in): Handle BUILT_IN_POWI.
	(expand_builtin_powi): New function.
	(expand_builtin): Dispatch to expand_builtin_powi.
	* libgcc2.h: Add prototypes for __builtin_powi[lf].
	* libgcc2.c: Add __builtin_powi[lf] implementation.
	* mklibgcc.in: Add __builtin_powi[lf] to lib2funcs.
	* optabs.h: Add powi_optab.
	* optabs.c (init_optabs): Initialize powi_optab.
	* doc/extend.texi: Document __builtin_powi[lf].

	* gcc.dg/pr19402-1.c: New testcase.
	* gcc.dg/pr19402-2.c: likewise.

From-SVN: r94774
2005-02-09 20:58:13 +00:00
Jakub Jelinek 0d5b215ca1 builtins.def (BUILT_IN_FPUTC, [...]): Remove nothrow attribute.
* builtins.def (BUILT_IN_FPUTC, BUILT_IN_FPUTC_UNLOCKED,
	BUILT_IN_FPUTS, BUILT_IN_FPUTS_UNLOCKED, BUILT_IN_FWRITE,
	BUILT_IN_FWRITE_UNLOCKED, BUILT_IN_PUTCHAR, BUILT_IN_PUTCHAR_UNLOCKED,
	BUILT_IN_PUTS, BUILT_IN_PUTS_UNLOCKED): Remove nothrow attribute.
	* builtin-attrs.def (ATTR_NONNULL_1, ATTR_NONNULL_2, ATTR_NONNULL_1_2,
	ATTR_NONNULL_1_4): New.

From-SVN: r88278
2004-09-29 11:06:49 +02:00
Kaveh R. Ghazi 254986c7ff builtin-attrs.def (ATTR_NOTHROW_SENTINEL_1): New.
* builtin-attrs.def (ATTR_NOTHROW_SENTINEL_1): New.
	* builtins.def (BUILT_IN_EXECLE): Set ATTR_NOTHROW_SENTINEL_1.
	* c-common.c (c_common_attribute_table): Accept parameters to
	sentinel attribute.
	(check_function_sentinel, handle_sentinel_attribute): Likewise.
	* doc/extend.texi: Update accordingly.

testsuite:
	* gcc.dg/format/sentinel-1.c: Update for parameter option.

From-SVN: r87098
2004-09-05 02:55:28 +00:00
Kaveh Ghazi 3d091dac56 builtin-attrs.def (ATTR_SENTINEL, [...]): New.
gcc:
	* builtin-attrs.def (ATTR_SENTINEL, ATTR_SENTINEL_NOTHROW_LIST):
	New.
	* builtins.def (BUILT_IN_EXECL, BUILT_IN_EXECLP): Add `sentinel'
	attribute.
	* c-common.c (handle_sentinel_attribute, check_function_sentinel):
	New functions.
	(c_common_attribute_table): Add `sentinel' attribute.
	(check_function_arguments): Handle `sentinel' attribute.
	* doc/extend.texi: Document `sentinel' attribute.

gcc/testsuite:
	* gcc.dg/format/sentinel-1.c: New test.

include:
	* ansidecl.h (ATTRIBUTE_SENTINEL): Define.
	* libiberty.h (concat, reconcat, concat_length, concat_copy,
	concat_copy2): Use ATTRIBUTE_SENTINEL.

From-SVN: r87096
2004-09-05 02:50:09 +00:00
Richard Henderson 1a186ec558 builtins.def (BUILT_IN_STACK_ALLOC): Remove.
* builtins.def (BUILT_IN_STACK_ALLOC): Remove.
        * builtins.c (expand_builtin) <BUILT_IN_STACK_ALLOC>: Remove.
        * dwarf2out.c (loc_descriptor): Handle PARALLEL here ...
        (add_location_or_const_value_attribute): ... not here.  Use
        loc_descriptor_from_tree if possible.
        (loc_descriptor_from_tree_1): Rename from loc_descriptor_from_tree.
        Simplify address handling.  Handle DECL_VALUE_EXPR.  Handle register
        values specially.
        (loc_descriptor_from_tree): New.  Update callers.
        * expr.c (expand_var): Ignore DECL_VALUE_EXPR variables.
        * gimplify.c (gimplify_decl_expr): Lower variable sized types to
        pointer plus dereference.  Set DECL_VALUE_EXPR.  Set save_stack.
        (gimplify_call_expr): Do not recognize BUILT_IN_STACK_ALLOC
        and BUILT_IN_STACK_RESTORE.
        (gimplify_expr): Lower DECL_VALUE_EXPR decls.
        * stmt.c (expand_stack_alloc): Remove.
        * tree-mudflap.c (mx_register_decls): Don't look for
        BUILT_IN_STACK_ALLOC.
        * tree-nested.c (convert_local_reference): Likewise.
        * tree.h (DECL_VALUE_EXPR): New.
ada/
        * utils.c (gnat_install_builtins): Remove __builtin_stack_alloc,
        add __builtin_alloca.
fortran/
        * f95-lang.c (gfc_init_builtin_functions): Remove
         __builtin_stack_alloc, add __builtin_alloca.
        * trans-array.c (gfc_trans_auto_array_allocation): Use DECL_EXPR.
        * trans-decl.c (gfc_trans_auto_character_variable): Likewise.

From-SVN: r85794
2004-08-10 21:16:07 -07:00
Jan Beulich 2319a1d1f7 builtin-types.def (BT_UINT): Rename from BT_UNSIGNED.
* builtin-types.def (BT_UINT): Rename from BT_UNSIGNED.
        (BT_FN_UINT): Rename from BT_FN_UNSIGNED.
        (BT_FN_PTR_UINT): Rename from BT_FN_PTR_UNSIGNED.
        (BT_ULONG, BT_ULONGLONG, BT_UINTMAX, BT_FN_INT_UINT, BT_FN_INT_ULONG,
        BT_FN_INT_ULONGLONG, BT_FN_INT_INTMAX, BT_FN_INT_UINTMAX): New.
        * builtins.def (BUILTIN_CLZxxx, BUILTIN_CTXxxx, BUILTIN_PARITYxxx,
        BUILTIN_POPCOUNTxxx): Arguments are unsigned.
        (BUILTIN_xxxIMAX): New.
        * builtins.c (expand_builtin): Handle BUILT_IN_FFSIMAX,
        BUILT_IN_CLZIMAX, BUILT_IN_CTZIMAX, BUILT_IN_POPCOUNIMAX, and
        BUILT_IN_PARITYIMAX.

From-SVN: r84415
2004-07-09 16:04:33 -07:00
Paolo Bonzini 64a9295a72 builtins.c (fold_builtin_classify): New.
gcc/ChangeLog:
2004-07-01  Paolo Bonzini  <bonzini@gnu.org>

	* builtins.c (fold_builtin_classify): New.
	(fold_builtin_unordered_cmp): Fix commentary.
	(fold_builtin): Use it.
	* builtins.def: Define builtins for isnan,
	isnanf, isnanl, finite, finitef, finitel,
	isinf, isinff, isinfl.

gcc/testsuite/ChangeLog:
2004-07-01  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.dg/builtins-43.c: New.
	* gcc.dg/builtins-44.c: New.
	* gcc.dg/builtins-45.c: New.

From-SVN: r83960
2004-07-01 08:02:34 +00:00
Joseph Myers f51af25f33 builtins.def (execl, [...]): Change to DEF_EXT_LIB_BUILTIN.
* builtins.def (execl, execlp, execle, execv, execvp, execve,
	fork): Change to DEF_EXT_LIB_BUILTIN.

From-SVN: r83817
2004-06-28 22:50:51 +01:00
Jakub Jelinek 498c0f2757 re PR c++/14791 (13070 does not fix -Wformat with fprintf)
PR c++/14791
	* tree.h (enum tree_index): Add TI_FILEPTR_TYPE.
	(fileptr_type_node): Define.
	* tree.c (build_common_tree_nodes_2): Initialize
	fileptr_type_node to ptr_type_node.
	* c-common.c (c_common_nodes_and_builtins): For C++, make
	fileptr_type_node a distinct type copy.
	* builtin-types.def (BT_FILEPTR, BT_FN_INT_CONST_STRING_FILEPTR,
	BT_FN_INT_INT_FILEPTR, BT_FN_INT_FILEPTR_CONST_STRING_VALIST_ARG,
	BT_FN_SIZE_CONST_PTR_SIZE_SIZE_FILEPTR,
	BT_FN_INT_FILEPTR_CONST_STRING_VAR): Add.
	(BT_FN_INT_CONST_STRING_PTR, BT_FN_INT_INT_PTR,
	BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR, BT_FN_INT_PTR_CONST_STRING_VAR,
	BT_FN_INT_PTR_CONST_STRING_VALIST_ARG): Remove.
	* builtins.def (BUILT_IN_FPRINTF, BUILT_IN_FPRINTF_UNLOCKED,
	BUILT_IN_FPUTC, BUILT_IN_FPUTC_UNLOCKED, BUILT_IN_FPUTS,
	BUILT_IN_FPUTS_UNLOCKED, BUILT_IN_FSCANF, BUILT_IN_FWRITE,
	BUILT_IN_FWRITE_UNLOCKED, BUILT_IN_VFPRINTF, BUILT_IN_VFSCANF): Use
	the above *FILEPTR* types instead of *PTR*.

	* decl.c (duplicate_decls): Handle fileptr_type_node arguments
	specially.

	* g++.dg/opt/builtins1.C: New test.

From-SVN: r82902
2004-06-10 10:08:02 +02:00
Jan Hubicka d601c996f8 * builtins.def (__builtin_expect): Mark the function as const&nothrow.
From-SVN: r82243
2004-05-25 16:25:47 +00:00
Diego Novillo 6de9cd9a88 Merge tree-ssa-20020619-branch into mainline.
From-SVN: r81764
2004-05-13 02:41:07 -04:00
Richard Kenner 2b92e7f5cd builtins.c (expand_builtin_update_setjmp_buf): New function.
* builtins.c (expand_builtin_update_setjmp_buf): New function.
	(expand_builtin, case BUILT_IN_UPDATE_SETJMP_BUF): New case.
	* builtins.def (BUILT_IN_UPDATE_SETJMP_BUF): New code.

From-SVN: r81198
2004-04-26 14:11:32 -04:00
Zdenek Dvorak d1c3882392 Makefile.in (LIBGCOV): Add _gcov_fork...
* Makefile.in (LIBGCOV): Add _gcov_fork, _gcov_execl, _gcov_execlp,
	_gcov_execle, _gcov_execv, _gcov_execvp, _gcov_execve.
	* builtin-types.def (BT_PID, BT_PTR_CONST_STRING, BT_FN_PID,
	BT_FN_INT_CONST_STRING_PTR_CONST_STRING,
	BT_FN_INT_CONST_STRING_PTR_CONST_STRING_PTR_CONST_STRING): New.
	* builtins.c (expand_builtin_fork_or_exec): New.
	(expand_builtin): Call it.
	* builtins.def (BUILT_IN_EXECL, BUILT_IN_EXECLP,BUILT_IN_EXECLE,
	BUILT_IN_EXECV, BUILT_IN_EXECVP, BUILT_IN_EXECVE, BUILT_IN_FORK): New.
	* c-common.c (PID_TYPE): New macro.
	(c_common_nodes_and_builtins): Initialize pid_type_node.
	* calls.c (special_function_p): Do not handle fork and exec.
	(expand_call): Do not handle ECF_FORK_OR_EXEC.
	* gcov-io.h (__gcov_fork, __gcov_execl, __gcov_execlp, __gcov_execle,
	__gcov_execv, __gcov_execvp, __gcov_execve): Declare.
	* libgcov.c (__gcov_fork, __gcov_execl, __gcov_execlp, __gcov_execle,
	__gcov_execv, __gcov_execvp, __gcov_execve): New.
	* tree.h (enum tree_index): Add TI_PID_TYPE.
	(pid_type_node): New macro.
	(ECF_FORK_OR_EXEC): Removed.

From-SVN: r81118
2004-04-23 22:50:16 +00:00
Kaveh R. Ghazi b069dd3f1f builtins.def (BUILT_IN_ISDIGIT, [...]): Mark with ATTR_CONST_NOTHROW_LIST.
* builtins.def (BUILT_IN_ISDIGIT, BUILT_IN_ISXDIGIT): Mark with
	ATTR_CONST_NOTHROW_LIST.

From-SVN: r80740
2004-04-16 00:48:51 +00:00
Kaveh R. Ghazi ca4944e1fe builtin-types.def (BT_WINT, [...]): New.
* builtin-types.def (BT_WINT, BT_FN_INT_WINT, BT_FN_WINT_WINT): New.
	* builtins.def (DEF_C94_BUILTIN): New.  Add wctype builtins.
	* doc/extend.texi: Likewise.
testsuite:
	* gcc.dg/torture/builtin-wctype-1.c: New test.

From-SVN: r80011
2004-03-27 05:29:40 +00:00
Kaveh R. Ghazi 740e5b6f17 builtins.def: Add ctype builtins.
* builtins.def: Add ctype builtins.
	* doc/extend.texi: Likewise.
testsuite:
	* gcc.dg/torture/builtin-ctype-1.c: New test.

From-SVN: r79960
2004-03-25 17:55:13 +00:00
Joseph Myers b1c2d04a28 re PR c/14635 (nan functions should not be C90 built-ins)
PR c/14635
	* builtins.def (nan, nanf, nanl, nans, nansf, nansl): Change to
	DEF_GCC_BUILTIN.

testsuite:
	* builtins-1.c (nan, nans): Don't test.
	* builtins-30.c: Don't use nan, nanf, nanl.
	* builtins-35.c: New test.

From-SVN: r79736
2004-03-20 10:19:11 +00:00
James E Wilson c76362b488 re PR libstdc++/5625 ([mips] exception unwinding creates invalid pointer on mips)
PR libstdc++/5625
* builtin-types.def (BT_WORD, BT_FN_WORD_PTR): New.
* builtins.c (expand_builtin): Handle BUILT_IN_EXTEND_POINTER.
* builtins.def (BUILT_IN_EXTEND_POINTER): New.
* except.c (expand_builtin_extend_pointer): New.
* except.h (expand_builtin_extend_pointer): Declare.

From-SVN: r77554
2004-02-09 13:18:45 -08:00
Roger Sayle ef79730c93 builtins.def (BUILT_IN_SIGNBIT, [...]): New GCC builtins.
* builtins.def (BUILT_IN_SIGNBIT, BUILT_IN_SIGNBITF,
	BUILT_IN_SIGNBITL): New GCC builtins.
	* builtins.c (expand_builtin_signbit): New function to RTL expand
	calls to signbit, signbitf and signbitl as inline intrinsics.
	(expand_builtin): Call expand_builtin_signbit for BUILT_IN_SIGNBIT*.
	(fold_builtin_signbit): New function to perform constant folding
	of signbit, signbitf and signbitl.
	(fold_builtin): Call fold_builtin_signbit for BUILT_IN_SIGNBIT*.

	* doc/extend.texi: Document new signbit{,f,l} builtins.

	* gcc.dg/builtins-1.c: Also test for __builtin_signbit{,f,l}.
	* gcc.dg/builtins-31.c: New testcase.
	* gcc.dg/builtins-32.c: New testcase.

From-SVN: r77070
2004-02-01 14:59:15 +00:00
Kazu Hirata a457ee07af alloc-pool.c: Fix comment typos.
* alloc-pool.c: Fix comment typos.
	* builtin-types.def: Likewise.
	* builtins.def: Likewise.
	* c-pretty-print.c: Likewise.
	* df.h: Likewise.
	* reload1.c: Likewise.

From-SVN: r77043
2004-01-31 17:47:43 +00:00
Kaveh R. Ghazi 11bf0eb0c7 builtin-types.def (BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, [...]): New.
* builtin-types.def
	(BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE,
	BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE,
	BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT): New.
	* builtins.def (BUILT_IN_CACOS, BUILT_IN_CACOSF, BUILT_IN_CACOSH,
	BUILT_IN_CACOSHF, BUILT_IN_CACOSHL, BUILT_IN_CACOSL,
	BUILT_IN_CARG, BUILT_IN_CARGF, BUILT_IN_CARGL, BUILT_IN_CASIN,
	BUILT_IN_CASINF, BUILT_IN_CASINH, BUILT_IN_CASINHF,
	BUILT_IN_CASINHL, BUILT_IN_CASINL, BUILT_IN_CATAN,
	BUILT_IN_CATANF, BUILT_IN_CATANH, BUILT_IN_CATANHF,
	BUILT_IN_CATANHL, BUILT_IN_CATANL, BUILT_IN_CCOS, BUILT_IN_CCOSF,
	BUILT_IN_CCOSH, BUILT_IN_CCOSHF, BUILT_IN_CCOSHL, BUILT_IN_CCOSL,
	BUILT_IN_CEXP, BUILT_IN_CEXPF, BUILT_IN_CEXPL, BUILT_IN_CPOW,
	BUILT_IN_CPOWF, BUILT_IN_CPOWL, BUILT_IN_CPROJ, BUILT_IN_CPROJF,
	BUILT_IN_CPROJL, BUILT_IN_CSIN, BUILT_IN_CSINF, BUILT_IN_CSINH,
	BUILT_IN_CSINHF, BUILT_IN_CSINHL, BUILT_IN_CSINL, BUILT_IN_CSQRT,
	BUILT_IN_CSQRTF, BUILT_IN_CSQRTL, BUILT_IN_CTAN, BUILT_IN_CTANF,
	BUILT_IN_CTANH, BUILT_IN_CTANHF, BUILT_IN_CTANHL, BUILT_IN_CTANL):
	New.
	* doc/extend.texi: Document new builtins.

testsuite:
	* gcc.dg/builtins-1.c: Add more _Complex tests.
	* gcc.dg/torture/builtin-attr-1.c: Likewise.

From-SVN: r71226
2003-09-09 03:29:18 +00:00
Kaveh R. Ghazi 742c0a4ee1 builtins.def: Break out _Complex math functions into their own category.
* builtins.def: Break out _Complex math functions into their
	own category.

From-SVN: r71000
2003-09-02 18:45:45 +00:00
Kaveh R. Ghazi 05a5fba9c7 builtins.def: Fix typos.
* builtins.def: Fix typos.
	(ATTR_MATHFN_FPROUNDING_STORE): New macro.
	(BUILT_IN_FREXP, BUILT_IN_FREXPF, BUILT_IN_FREXPL, BUILT_IN_MODF,
	BUILT_IN_MODFF, BUILT_IN_MODFL, BUILT_IN_REMQUO, BUILT_IN_REMQUOF,
	BUILT_IN_REMQUOL, BUILT_IN_SINCOS, BUILT_IN_SINCOSF,
	BUILT_IN_SINCOSL): Use ATTR_MATHFN_FPROUNDING_STORE.

From-SVN: r70924
2003-08-29 21:53:59 +00:00
Kaveh R. Ghazi fe3d04dc26 builtins.def (BUILT_IN_ERFC, [...]): Use ATTR_MATHFN_FPROUNDING_ERRNO.
* builtins.def (BUILT_IN_ERFC, BUILT_IN_ERFCF, BUILT_IN_ERFCL):
	Use ATTR_MATHFN_FPROUNDING_ERRNO.

From-SVN: r70923
2003-08-29 21:51:35 +00:00
Kaveh R. Ghazi a2a919aa50 builtin-types.def (BT_INT_PTR, [...]): New.
* builtin-types.def (BT_INT_PTR, BT_FLOAT_PTR, BT_DOUBLE_PTR,
	BT_LONGDOUBLE_PTR, BT_FN_FLOAT_FLOAT_FLOATPTR,
	BT_FN_DOUBLE_DOUBLE_DOUBLEPTR,
	BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR,
	BT_FN_FLOAT_FLOAT_INTPTR, BT_FN_DOUBLE_DOUBLE_INTPTR,
	BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR,
	BT_FN_FLOAT_FLOAT_FLOAT_INTPTR, BT_FN_DOUBLE_DOUBLE_DOUBLE_INTPTR,
	BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_INTPTR,
	BT_FN_VOID_FLOAT_FLOATPTR_FLOATPTR,
	BT_FN_VOID_DOUBLE_DOUBLEPTR_DOUBLEPTR,
	BT_FN_VOID_LONGDOUBLE_LONGDOUBLEPTR_LONGDOUBLEPTR): New.
	* builtins.def (BUILT_IN_FREXP, BUILT_IN_FREXPF, BUILT_IN_FREXPL,
	BUILT_IN_MODF, BUILT_IN_MODFF, BUILT_IN_MODFL, BUILT_IN_REMQUO,
	BUILT_IN_REMQUOF, BUILT_IN_REMQUOL, BUILT_IN_SINCOS,
	BUILT_IN_SINCOSF, BUILT_IN_SINCOSL): New.
	* tree.c: Assign new type_nodes.
	* tree.h (tree_index): Add TI_FLOAT_PTR_TYPE, TI_DOUBLE_PTR_TYPE,
	TI_LONG_DOUBLE_PTR_TYPE, TI_INTEGER_PTR_TYPE.
	(float_ptr_type_node, double_ptr_type_node,
	long_double_ptr_type_node, integer_ptr_type_node): New type_nodes.

	* doc/extend.texi: Document new builtins.

testsuite:
	* gcc.dg/builtins-1.c: Add new builtin cases.

From-SVN: r70890
2003-08-28 22:00:45 +00:00
Kaveh R. Ghazi 488f17e1fc builtin-types.def (BT_FN_FLOAT_INT_FLOAT, [...]): New.
* builtin-types.def (BT_FN_FLOAT_INT_FLOAT,
	BT_FN_DOUBLE_INT_DOUBLE, BT_FN_LONGDOUBLE_INT_LONGDOUBLE): New.

	* builtins.def (BUILT_IN_ERF, BUILT_IN_ERFC, BUILT_IN_ERFCF,
	BUILT_IN_ERFCL, BUILT_IN_ERFF, BUILT_IN_ERFL, BUILT_IN_GAMMA,
	BUILT_IN_GAMMAF, BUILT_IN_GAMMAL, BUILT_IN_J0, BUILT_IN_J0F,
	BUILT_IN_J0L, BUILT_IN_J1, BUILT_IN_J1F, BUILT_IN_J1L,
	BUILT_IN_JN, BUILT_IN_JNF, BUILT_IN_JNL, BUILT_IN_LGAMMA,
	BUILT_IN_LGAMMAF, BUILT_IN_LGAMMAL, BUILT_IN_SIGNIFICAND,
	BUILT_IN_SIGNIFICANDF, BUILT_IN_SIGNIFICANDL, BUILT_IN_TGAMMA,
	BUILT_IN_TGAMMAF, BUILT_IN_TGAMMAL, BUILT_IN_Y0, BUILT_IN_Y0F,
	BUILT_IN_Y0L, BUILT_IN_Y1, BUILT_IN_Y1F, BUILT_IN_Y1L,
	BUILT_IN_YN, BUILT_IN_YNF, BUILT_IN_YNL): New.

	* doc/extend.texi: Document new builtins.

testsuite:
	* gcc.dg/builtins-1.c: Add new cases.
	* gcc.dg/torture/builtin-attr-1.c: Likewise.

From-SVN: r70889
2003-08-28 21:25:22 +00:00
Kaveh R. Ghazi 98ff7c4dc1 builtin-types.def (BT_FN_INT_FLOAT, [...]): New.
* builtin-types.def (BT_FN_INT_FLOAT, BT_FN_INT_DOUBLE,
	BT_FN_INT_LONGDOUBLE, BT_FN_LONG_FLOAT, BT_FN_LONG_DOUBLE,
	BT_FN_LONG_LONGDOUBLE, BT_FN_LONGLONG_FLOAT,
	BT_FN_LONGLONG_DOUBLE, BT_FN_LONGLONG_LONGDOUBLE,
	BT_FN_FLOAT_FLOAT_LONGDOUBLE, BT_FN_DOUBLE_DOUBLE_LONGDOUBLE,
	BT_FN_FLOAT_FLOAT_INT, BT_FN_DOUBLE_DOUBLE_INT,
	BT_FN_LONGDOUBLE_LONGDOUBLE_INT, BT_FN_FLOAT_FLOAT_LONG,
	BT_FN_DOUBLE_DOUBLE_LONG, BT_FN_LONGDOUBLE_LONGDOUBLE_LONG,
	BT_FN_FLOAT_FLOAT_FLOAT_FLOAT, BT_FN_DOUBLE_DOUBLE_DOUBLE_DOUBLE,
	BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE): New.

	* builtins.def (BUILT_IN_ACOS, BUILT_IN_ACOSF, BUILT_IN_ACOSH,
	BUILT_IN_ACOSHF, BUILT_IN_ACOSHL, BUILT_IN_ACOSL, BUILT_IN_ASIN,
	BUILT_IN_ASINF, BUILT_IN_ASINH, BUILT_IN_ASINHF, BUILT_IN_ASINHL,
	BUILT_IN_ASINL, BUILT_IN_ATANH, BUILT_IN_ATANHF, BUILT_IN_ATANHL,
	BUILT_IN_CBRT, BUILT_IN_CBRTF, BUILT_IN_CBRTL, BUILT_IN_COPYSIGN,
	BUILT_IN_COPYSIGNF, BUILT_IN_COPYSIGNL, BUILT_IN_COSH,
	BUILT_IN_COSHF, BUILT_IN_COSHL, BUILT_IN_DREM, BUILT_IN_DREMF,
	BUILT_IN_DREML, BUILT_IN_EXP10, BUILT_IN_EXP10F, BUILT_IN_EXP10L,
	BUILT_IN_EXP2, BUILT_IN_EXP2F, BUILT_IN_EXP2L, BUILT_IN_EXPM1,
	BUILT_IN_EXPM1F, BUILT_IN_EXPM1L, BUILT_IN_FDIM, BUILT_IN_FDIMF,
	BUILT_IN_FDIML, BUILT_IN_FMA, BUILT_IN_FMAF, BUILT_IN_FMAL,
	BUILT_IN_FMAX, BUILT_IN_FMAXF, BUILT_IN_FMAXL, BUILT_IN_FMIN,
	BUILT_IN_FMINF, BUILT_IN_FMINL, BUILT_IN_HYPOT, BUILT_IN_HYPOTF,
	BUILT_IN_HYPOTL, BUILT_IN_ILOGB, BUILT_IN_ILOGBF, BUILT_IN_ILOGBL,
	BUILT_IN_LDEXP, BUILT_IN_LDEXPF, BUILT_IN_LDEXPL, BUILT_IN_LLRINT,
	BUILT_IN_LLRINTF, BUILT_IN_LLRINTL, BUILT_IN_LLROUND,
	BUILT_IN_LLROUNDF, BUILT_IN_LLROUNDL, BUILT_IN_LOG10,
	BUILT_IN_LOG10F, BUILT_IN_LOG10L, BUILT_IN_LOG1P, BUILT_IN_LOG1PF,
	BUILT_IN_LOG1PL, BUILT_IN_LOG2, BUILT_IN_LOG2F, BUILT_IN_LOG2L,
	BUILT_IN_LOGB, BUILT_IN_LOGBF, BUILT_IN_LOGBL, BUILT_IN_LRINT,
	BUILT_IN_LRINTF, BUILT_IN_LRINTL, BUILT_IN_LROUND,
	BUILT_IN_LROUNDF, BUILT_IN_LROUNDL, BUILT_IN_NEXTAFTER,
	BUILT_IN_NEXTAFTERF, BUILT_IN_NEXTAFTERL, BUILT_IN_NEXTTOWARD,
	BUILT_IN_NEXTTOWARDF, BUILT_IN_NEXTTOWARDL, BUILT_IN_POW10,
	BUILT_IN_POW10F, BUILT_IN_POW10L, BUILT_IN_REMAINDER,
	BUILT_IN_REMAINDERF, BUILT_IN_REMAINDERL, BUILT_IN_RINT,
	BUILT_IN_RINTF, BUILT_IN_RINTL, BUILT_IN_SCALB, BUILT_IN_SCALBF,
	BUILT_IN_SCALBL, BUILT_IN_SCALBLN, BUILT_IN_SCALBLNF,
	BUILT_IN_SCALBLNL, BUILT_IN_SCALBN, BUILT_IN_SCALBNF,
	BUILT_IN_SCALBNL, BUILT_IN_SINH, BUILT_IN_SINHF, BUILT_IN_SINHL,
	BUILT_IN_TANH, BUILT_IN_TANHF, BUILT_IN_TANHL): New.

	* doc/extend.texi: Document new builtins.

testsuite:
	* gcc.dg/builtins-1.c: Add more math builtin tests.
	* gcc.dg/torture/builtin-attr-1.c: New test.

From-SVN: r70886
2003-08-28 19:41:16 +00:00
Kaveh R. Ghazi d82f81dde4 builtins.def (BUILT_IN_ABS, [...]): Move to miscellaneous section.
* builtins.def (BUILT_IN_ABS, BUILT_IN_IMAXABS, BUILT_IN_LABS,
	BUILT_IN_LLABS): Move to miscellaneous section.

From-SVN: r70120
2003-08-03 14:31:29 +00:00
Roger Sayle 178b2b9f0f builtin-types.def (BT_SSIZE): New primitive type.
* builtin-types.def (BT_SSIZE): New primitive type.
	(BT_FN_INT_PTR_CONST_STRING_VALIST_ARG,
	BT_FN_STRING_CONST_STRING_CONST_STRING_INT,
	BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR,
	BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR): New function types.
	* builtins.def (BUILT_IN_DCGETTEXT, BUILT_IN_DGETTEXT,
	BUILT_IN_FSCANF, BUILT_IN_GETTEXT, BUILT_IN_STRFMON,
	BUILT_IN_STRFTIME, BUILT_IN_VFPRINTF, BUILT_IN_VFSCANF): New builtins.
	* builtin-attrs.def: Remove DEF_FN_ATTR construct and the last
	few functions that define default attributes using it.
	* c-common.c (c_common_insert_default_attributes): Do nothing.

	* doc/extend.texi: Document these "new" builtins.

From-SVN: r70113
2003-08-03 03:23:18 +00:00
Kaveh R. Ghazi f53b62e15c * builtins.def: Categorize.
From-SVN: r70097
2003-08-02 06:21:43 +00:00
Kaveh R. Ghazi f6a4681886 builtins.def (BUILT_IN_CABS, [...]): Mind fp rounding.
* builtins.def (BUILT_IN_CABS, BUILT_IN_CABSF, BUILT_IN_CABSL):
	Mind fp rounding.
	(BUILT_IN_FFSL): Use DEF_EXT_LIB_BUILTIN.

From-SVN: r70096
2003-08-02 06:19:40 +00:00
Kaveh R. Ghazi a8eb1db550 * builtins.def: Resort builtins.
From-SVN: r70058
2003-08-01 17:51:56 +00:00
Kaveh R. Ghazi da7cfe1307 builtins.def (DEF_GCC_BUILTIN, [...]): Prepend "__builtin_" onto NAME with string concatenation.
* builtins.def (DEF_GCC_BUILTIN, DEF_LIB_BUILTIN,
	DEF_EXT_LIB_BUILTIN, DEF_C99_BUILTIN, DEF_C99_C90RES_BUILTIN):
	Prepend "__builtin_" onto NAME with string concatenation.  Remove
	explicit "__builtin_" from each macro call.

	Reformat entire file.

From-SVN: r70057
2003-08-01 17:50:38 +00:00
Kaveh R. Ghazi ea8eb0b920 builtins.def (ATTR_MATHFN_ERRNO, [...]): New macros.
* builtins.def (ATTR_MATHFN_ERRNO, ATTR_MATHFN_FPROUNDING,
	ATTR_MATHFN_FPROUNDING_ERRNO): New macros.  Use throughout.

From-SVN: r70055
2003-08-01 17:48:30 +00:00
Kaveh R. Ghazi 3c260e1d97 builtin-types.def: Use `LONGDOUBLE' instead of `LONG_DOUBLE' throughout.
* builtin-types.def: Use `LONGDOUBLE' instead of `LONG_DOUBLE'
	throughout.
	* builtins.def: Likewise.

From-SVN: r70034
2003-08-01 02:11:17 +00:00
Roger Sayle 1aa0a5f67e * builtins.def: Alphabetize.
From-SVN: r69989
2003-07-31 03:16:24 +00:00
Roger Sayle cc42f5f54c builtins.def (DEF_FALLBACK_BUILTIN): Delete.
* builtins.def (DEF_FALLBACK_BUILTIN): Delete.
	(DEF_EXT_FALLBACK_BUILTIN): Delete.
	(BUILT_IN_BZERO, BUILT_IN_BCOPY, BUILT_IN_BCMP): Declare using
	the regular DEF_EXT_LIB_BUILTIN macro.
	(BUILT_IN_FPUTC, BUILT_IN_FPUTS, BUILT_IN_FWRITE): Declare using
	the regular DEF_LIB_BUILTIN macro.
	(BUILT_IN_PUTCHAR_UNLOCKED, BUILT_IN_PUTS_UNLOCKED,
	BUILT_IN_FPUTC_UNLOCKED, BUILT_IN_FPUTS_UNLOCKED,
	BUILT_IN_FWRITE_UNLOCKED): Declare using the regular
	DEF_EXT_LIB_BUILTIN macro.

	* c-decl.c (duplicate_decls): Remove code to handle builtin
	functions prototyped without an argument list.

From-SVN: r69814
2003-07-26 13:27:20 +00:00
Roger Sayle 868b8cda7b builtins.def (BUILT_IN_PRINTF, [...]): Changed from front-end builtins to normal builtins, using DEF_LIB_BUILTIN.
* builtins.def (BUILT_IN_PRINTF, BUILT_IN_FPRINTF): Changed from
	front-end builtins to normal builtins, using DEF_LIB_BUILTIN.
	(BUILT_IN_PRINTF_UNLOCKED, BUILT_IN_FPRINTF_UNLOCKED): Changed
	from front-end to normal builtins, using DEF_EXT_LIB_BUILTIN.
	(DEF_FRONT_END_LIB_BUILTIN): Delete.
	(DEF_EXT_FRONT_END_LIB_BUILTIN): Delete.
	(BUILT_IN_FWRITE_UNLOCKED): Wrap long line.

	* builtins.c (build_string_literal): New function to construct
	a char* pointer to a string literal.
	(expand_builtin_fputs): Change 2nd argument from "int ignore" to
	"rtx target" to be consistent with other expand_builtin_* functions.
	Change 3rd argument from "int unlocked" to "bool unlocked".
	(expand_builtin_printf): Rewrite of c_expand_builtin_printf from
	c-common.c to avoid front-end dependencies.  Optimize printf("")
	as a no-op when the result isn't required.  Handle embedded NULs
	in format string.
	(expand_builtin_fprintf): A rewrite of c_expand_builtin_fprintf
	from c-common.c to avoid front-end dependencies.  Likewise, optimize
	fprintf(fp,"") as a no-op when the result isn't required, evaluating
	fp for side-effects.  Handle embedded NULs in format string.
	(expand_builtin_sprintf): Fix typo.
	(expand_builtin): Don't expand BUILT_IN_FPRINT{,_UNLOCKED} when not
	optimizing.  Adjust calls of expand_builtin_fputs to match the API
	change. Expand BUILT_IN_PRINTF and BUILT_IN_PRINTF_UNLOCKED using
	expand_builtin_printf.  Likewise, expand BUILT_IN_FPRINTF_UNLOCKED
	and BUILT_IN_FPRINTF using expand_builtin_fprintf.

	* c-common.c (is_valid_printf_arglist): Delete.
	(c_expand_builtin): Delete.
	(c_expand_builtin_printf): Moved to builtins.c. Delete.
	(c_expand_builtin_fprintf): Moved to builtins.c.  Delete.
	(c_expand_expr): No longer treat CALL_EXPRs specially.
	(CALLED_AS_BUILT_IN): Delete.

From-SVN: r69760
2003-07-24 21:04:12 +00:00
Roger Sayle 6a6c0154f8 builtins.def (BUILT_IN_ALLOCA): Remove "#if SMALL_STACK" form.
* builtins.def (BUILT_IN_ALLOCA): Remove "#if SMALL_STACK" form.
	* system.h (SMALL_STACK): Poison obsolete target macro.
	* doc/tm.texi (SMALL_STACK): Remove target macro documentation.

From-SVN: r69609
2003-07-20 16:29:57 +00:00
Roger Sayle 075ec276a0 builtins.def (BUILT_IN_CABS, [...]): New builtins representing ISO C99's cabs, cabsf and cabsl.
* builtins.def (BUILT_IN_CABS, BUILT_IN_CABSF, BUILT_IN_CABSL):
	New builtins representing ISO C99's cabs, cabsf and cabsl.
	* builtins.c (expand_builtin_fabs): New function.
	(expand_builtin_cabs): New function.
	(expand_builtin): Expand BUILT_IN_FABS{,F,L} and BUILT_IN_CABS{,F,L}
	using expand_builtin_fabs and expand_builtin_cabs respectively.

	* doc/extend.texi: Document new cabs, cabsf and cabsl builtins.

	* gcc.dg/builtins-16.c: New test case.

From-SVN: r67368
2003-06-03 11:27:23 +00:00
Roger Sayle 29f523bef0 builtins.def: Defome atan...
* builtins.def: Defome atan, atanf, atanl, tan, tanf and tanl
	builtin functions (and their __builtin_* variants).
	* builtins.c (mathfn_built_in): Handle tan{,f,l} and atan{,f,l}.
	(expand_builtin): Don't expand tan{,f,l} or atan{,f,l} when not
	optimizing.

	* doc/extend.texi: Document new tan and atan builtins, and
	their float and long double variants.

	* gcc.dg/builtins-1.c: Add tests for tan and atan.
	* gcc.dg/builtins-4.c: Add test for fmod.

From-SVN: r67137
2003-05-23 20:45:40 +00:00
Kaveh R. Ghazi 003620645c builtin-attrs.def (ATTR_NOTHROW_NONNULL_1, [...]): Renamed from ATTR_NONNULL_1, ATTR_NONNULL_2 and ATTR_NONNULL_3.
gcc:
	* builtin-attrs.def (ATTR_NOTHROW_NONNULL_1,
	ATTR_NOTHROW_NONNULL_2, ATTR_NOTHROW_NONNULL_3): Renamed from
	ATTR_NONNULL_1, ATTR_NONNULL_2 and ATTR_NONNULL_3.

	(ATTR_NOTHROW_NONNULL_1_2, ATTR_NOTHROW_NONNULL_1_4,
	ATTR_CONST_NOTHROW_NONNULL_1, ATTR_PURE_NOTHROW_NONNULL_1,
	ATTR_PURE_NOTHROW_NONNULL_1_2, ATTR_MALLOC_NOTHROW_NONNULL_1):
	New.

	* builtins.def (DEF_EXT_FALLBACK_BUILTIN): Accept ATTRS argument.
	(BUILT_IN_BZERO, BUILT_IN_BCOPY, BUILT_IN_BCMP): Update comment

	(BUILT_IN_INDEX, BUILT_IN_RINDEX, BUILT_IN_MEMCPY,
	BUILT_IN_MEMMOVE, BUILT_IN_MEMCMP, BUILT_IN_MEMSET,
	BUILT_IN_MEMPCPY, BUILT_IN_STRCAT, BUILT_IN_STRNCAT,
	BUILT_IN_STPCPY, BUILT_IN_STRCPY, BUILT_IN_STRNCPY,
	BUILT_IN_STRCMP, BUILT_IN_STRNCMP, BUILT_IN_STRLEN,
	BUILT_IN_STRSTR, BUILT_IN_STRPBRK, BUILT_IN_STRSPN,
	BUILT_IN_STRCSPN, BUILT_IN_STRCHR, BUILT_IN_STRRCHR, BUILT_IN_NAN,
	BUILT_IN_NANF, BUILT_IN_NANL, BUILT_IN_NANS, BUILT_IN_NANSF,
	BUILT_IN_NANSL, BUILT_IN_PUTS, BUILT_IN_FPUTC, BUILT_IN_FPUTS,
	BUILT_IN_FWRITE, BUILT_IN_PUTS_UNLOCKED, BUILT_IN_FPUTC_UNLOCKED,
	BUILT_IN_FPUTS_UNLOCKED, BUILT_IN_FWRITE_UNLOCKED,
	BUILT_IN_STRDUP): Add "nonnull" attribute.

testsuite:
	* gcc.dg/nonnull-3.c: New test.

From-SVN: r66468
2003-05-04 22:18:17 +00:00
Richard Henderson 9c80ff25b7 builtins.c (expand_builtin): Remove.
* builtins.c (expand_builtin) <BUILT_IN_DWARF_FP_REGNUM>: Remove.
        <BUILT_IN_DWARF_SP_COLUMN>: New.
        * builtins.def (BUILT_IN_DWARF_FP_REGNUM): Remove.
        (BUILT_IN_DWARF_SP_COLUMN): New.
        * dwarf2out.c (expand_builtin_dwarf_fp_regnum): Remove.
        (expand_builtin_dwarf_sp_column): New.
        * except.h: Update to match.
        * unwind-dw2.c (execute_stack_op): Correct stack push typo.
        (execute_cfa_program): Record location expression address
        before extracting length.
        (uw_update_context_1): Install old CFA into stack pointer column.
        (uw_init_context_1): Set cfa_reg to stack pointer column.

From-SVN: r66447
2003-05-03 22:22:51 -07:00
Diego Novillo 44c8a5f8d8 * builtins.def (BUILTIN_CONSTANT_P): Mark as constant.
From-SVN: r66316
2003-04-30 21:27:48 -04:00
Jakub Jelinek e31603c46c builtins.def (BUILT_IN_BCOPY, [...]): New.
* builtins.def (BUILT_IN_BCOPY, BUILT_IN_MEMMOVE): New.
	* builtin-types.def (BT_FN_VOID_CONST_PTR_PTR_SIZE): New.
	* builtins.c (expand_builtin_memmove, expand_builtin_bcopy): New
	functions.
	(expand_builtin): Handle BUILT_IN_BCOPY and BUILT_IN_MEMMOVE.

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

From-SVN: r66169
2003-04-28 14:10:35 +02:00
Roger Sayle 1331d16fd4 builtin-types.def (BT_FN_STRING_CONST_STRING): New builtin type.
* builtin-types.def (BT_FN_STRING_CONST_STRING): New builtin type.
	(BT_FN_PTR_SIZE_SIZE): Likewise.
	* builtins.def (BUILT_IN_MALLOC, BUILT_IN_CALLOC, BUILT_IN_STRDUP):
	New built-in functions for malloc, calloc and strdup respectively.
	* calls.c (special_function_p): No need to handle malloc-like
	functions any longer.  ECF_MALLOC is set via built-in attributes.

	* c-decl.c (duplicate_decls): Preserve pure and malloc attributes.
	* cp/decl.c (duplicate_decls): Preserve pure and malloc attributes.
	* f/com.c (duplicate_decls): Preserve pure and malloc attributes.

	* doc/extend.texi: Document these new built-in functions.

	* gcc.dg/builtins-13.c: New test case.
	* gcc.dg/builtins-14.c: New test case.

From-SVN: r65560
2003-04-14 02:55:31 +00:00
Kaveh R. Ghazi 9cb65f923c builtins.c (expand_builtin_memcpy): Add `endp' argument, use it.
gcc:
	* builtins.c (expand_builtin_memcpy): Add `endp' argument, use it.
	(expand_builtin_stpcpy): New.
	(expand_builtin): Add BUILT_IN_MEMPCPY & BUILT_IN_STPCPY.
	* builtins.def: Add mempcpy & stpcpy support.
	* doc/extend.texi (mempcpy, stpcpy): Document new builtins.

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

From-SVN: r65551
2003-04-13 23:46:11 +00:00
Roger Sayle f937d5e67e builtins.def: Fix typo and improve grammar.
* builtins.def: Fix typo and improve grammar.
	* loop-unroll.c (decide_peel_completely): Tidy log message.

From-SVN: r64030
2003-03-09 15:22:56 +00:00
Roger Sayle 0829165849 re PR c++/9367 (error: nonnull argument with extern "C" snprintf prototype)
PR c++/9367
	* builtin-types.def (DEF_FUNCTION_TYPE_VAR_3): New macro.
	(BT_FN_INT_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_CONST_STRING_VALIST_ARG,
	BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_CONST_STRING_VAR,
	BT_FN_INT_CONST_STRING_CONST_STRING_VAR,
	BT_FN_INT_STRING_SIZE_CONST_STRING_VAR): New built-in types.
	* builtin-attrs.def (ATTR_NONNULL_1, ATTR_NONNULL_2,
	ATTR_NONNULL_3): Also include the nothrow attribute.
	(sprintf, scanf, sscanf, vprintf, vsprintf, snprintf,
	vsnprintf, vscanf, vsscanf): Don't define attributes here.
	* builtins.def (putchar, puts): Make full C89 built-ins.
	(snprintf, sprintf, scanf, sscanf, vprintf, vscanf,
	vsscanf, vsnprintf, vsprintf): New built-ins.
	* c-common.c (c_common_nodes_and_builtins): Handle new macro
	DEF_FUNCTION_TYPE_VAR_3.

	* doc/extend.texi: Document these new built-in functions.

	* java/builtins.c (builtin_type): Handle DEF_FUNCTION_TYPE_VAR_3.
	(initialize_builtins): Handle DEF_FUNCTION_TYPE_VAR_3.

	* g++.old-deja/g++.other/builtins10.C: New test for PR 9367.
	* gcc.dg/format/attr-5.c: Handle new conflicting types warning.

From-SVN: r63650
2003-03-02 01:34:34 +00:00
Roger Sayle b052d8ee4d builtins.def (DEF_LIB_ALWAYS_BUILTIN, [...]): Delete.
* builtins.def (DEF_LIB_ALWAYS_BUILTIN, DEF_UNUSED_BUILTIN): Delete.
	(abs, labs, fabs, fabsf, fabsl, abort, exit, _exit, _Exit):  Use
	the appropriate macro to define built-in function.
	(fmod,fmodf,fmodl): New built-in functions.

	* java/decl.c (java_init_decl_processing): Get soft_fmod_node from
	built_in_decls[BUILT_IN_FMOD] rather than define it ourselves.

	* doc/extend.texi (fmod,fmodf,fmodl): Document new built-ins.

From-SVN: r63445
2003-02-26 03:02:14 +00:00
Roger Sayle 46847aa6e7 builtin-types.def (BT_FN_FLOAT_FLOAT_FLOAT): New built-in type.
* builtin-types.def (BT_FN_FLOAT_FLOAT_FLOAT): New built-in type.
	(BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE): Likewise.
	(BT_FN_DOUBLE_DOUBLE_DOUBLE): Likewise.
	* builtins.def: Define pow, powf, powl, atan2, atan2f and atan2l
	builtin functions (and their __builtin_* variants).
	* builtins.c (mathfn_built_in): Handle missing log{,f,l} cases.
	(expand_builtin): Don't expand log{,f,l}, pow{,f,l} or atan2{,f,l}
	when not optimizing.

	* doc/extend.texi: Document new pow and atan2 builtins, and
	their float and long double variants.  Realphabetize builtins.

	* testsuite/gcc.dg/builtins-4.c: New test case.

From-SVN: r62551
2003-02-07 22:37:57 +00:00
Richard Henderson 2928cd7aac [multiple changes]
2003-02-01  Richard Henderson  <rth@redhat.com>

	* optabs.c (expand_unop): Use word_mode for outmode of bit scaners.
	* libgcc2.c (__ffsdi2, __clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
	__popcountsi2, __popcountdi2, __paritysi2 __paritydi2): Change
	return type to Wtype.

	* libgcc-std.ver (GCC_3.4): Fix inheritance.

	* config/i386/i386.md (ffssi2): Use nonimmediate_operand for
	expander input constraint.

2003-02-01  Falk Hueffner  <falk.hueffner@student.uni-tuebingen.de>

        * optabs.h (optab_index): Add OTI_clz, OTI_ctz, OTI_popcount and
        OTI_parity.
        (clz_optab, ctz_optab, popcount_optab, parity_optab): New.
        * optabs.c (widen_clz, expand_parity): New.
        (expand_unop): Handle clz and parity.  Hardcode SImode as outmode
        for libcalls to clz, ctz, popcount, and parity.
        (init_optabs): Init clz_optab, ctz_optab, popcount_optab and
        parity_optab, and set up libfunc handlers.
        * libgcc2.c (__clzsi2, __clzdi2, __ctzsi2, __ctzdi2,
        __popcountsi2, __popcountdi2, __paritysi2 __paritydi2,
        __popcount_tab): New.
        * libgcc2.h: Declare them.
        * libgcc-std.ver (GCC_3.4): Add new functions from libgcc2.c.
        * genopinit.c (optabs): Add clz_optab, ctz_optab, popcount_optab
        and parity_optab.
        * builtin-types.def (BT_FN_INT_LONG, BT_FN_INT_LONGLONG): New.
        * builtins.def (BUILT_IN_CLZ, BUILT_IN_CTZ, BUILT_IN_POPCOUNT,
        BUILT_IN_PARITY, BUILT_IN_FFSL, BUILT_IN_CLZL, BUILT_IN_CTZL,
        BUILT_IN_POPCOUNTL, BUILT_IN_PARITYL, BUILT_IN_FFSLL,
        BUILT_IN_CLZLL, BUILT_IN_CTZLL, BUILT_IN_POPCOUNTLL,
        BUILT_IN_PARITYLL): New.
        * builtins.c (expand_builtin_unop): Rename from expand_builtin_ffs
        and add optab argument.
        (expand_builtin): Expand BUILT_IN_{FFS,CLZ,POPCOUNT,PARITY}*.
        * tree.def (CLZ_EXPR, CTZ_EXPR, POPCOUNT_EXPR, PARITY_EXPR): New.
        * expr.c (expand_expr): Handle them.
        * fold-const.c (tree_expr_nonnegative_p): Likewise.
        * rtl.def (CLZ, CTZ, POPCOUNT, PARITY): New.
        * reload1.c (eliminate_regs): Handle them.
        (elimination_effects): Likewise.
        * function.c (instantiate_virtual_regs_1): Likewise
        * genattrtab.c (check_attr_value): Likewise.
        * simplify-rtx.c (simplify_unary_operation): Likewise.
        * c-common.c (c_common_truthvalue_conversion): Handle POPCOUNT_EXPR.
        * combine.c (combine_simplify_rtx): Handle POPCOUNT and PARITY.
        (nonzero_bits): Handle CLZ, CTZ, POPCOUNT and PARITY.
        * config/alpha/alpha.md (clzdi2, ctzdi2, popcountdi2): New.
        * config/arm/arm.c (arm_init_builtins): Rename __builtin_clz to
        __builtin_arm_clz.
        * Makefile.in (LIB2FUNCS_1, LIB2FUNCS_2): Move...
        * mklibgcc.in (lib2funcs): ...here and merge.  Add new members.
        * doc/extend.texi (Other Builtins): Add new builtins.
        * doc/md.texi (Standard Names): Add new patterns.

From-SVN: r62252
2003-02-01 11:00:02 -08:00
Jan Hubicka 272f51a36f builtins.c (DEF_BUILTIN): Accept 10 arguments.
* 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.
	* config/linux.h (TARGET_C99_FUNCTIONS): Default to 1
	when using glibc2.

From-SVN: r61738
2003-01-24 22:07:01 +00:00
Zack Weinberg 4977bab6ed Merge basic-improvements-branch to trunk
From-SVN: r60174
2002-12-16 18:23:00 +00:00
Jan Hubicka 1dc46545cb * builtins.def (DEF_C99_BUILTIN): Fix.
From-SVN: r59571
2002-11-27 13:49:33 +00:00
Kazu Hirata 991b659243 builtins.def: Fix comment formatting.
* builtins.def: Fix comment formatting.
	* c-common.def: Likewise.
	* cfgcleanup.c: Likewise.
	* combine.c: Likewise.
	* gengtype.c: Likewise.
	* params.def: Likewise.
	* predict.def: Likewise.
	* rtl.def: Likewise.
	* stab.def: Likewise.
	* stor-layout.c: Likewise.
	* tree.def: Likewise.
	* config/darwin.c: Likewise.
	* config/darwin.h: Likewise.
	* config/dbxcoff.h: Likewise.
	* config/elfos.h: Likewise.
	* config/fp-bit.c: Likewise.
	* config/freebsd-spec.h: Likewise.
	* config/interix.h: Likewise.
	* config/libgloss.h: Likewise.
	* config/linux-aout.h: Likewise.
	* config/linux.h: Likewise.
	* config/lynx-ng.h: Likewise.
	* config/lynx.h: Likewise.
	* config/netbsd-aout.h: Likewise.
	* config/netbsd.h: Likewise.
	* config/netware.h: Likewise.
	* config/psos.h: Likewise.
	* config/ptx4.h: Likewise.

From-SVN: r57624
2002-09-29 13:16:44 +00:00
Richard Henderson 1472e41cb3 builtin-types.def (BT_FN_FLOAT_CONST_STRING): New.
gcc/
        * builtin-types.def (BT_FN_FLOAT_CONST_STRING): New.
        (BT_FN_DOUBLE_CONST_STRING, BT_FN_LONG_DOUBLE_CONST_STRING): New.
        * builtins.def (__builtin_nan, __builtin_nanf, __builtin_nanl): New.
        (__builtin_nans, __builtin_nansf, __builtin_nansl): New.
        * builtins.c (fold_builtin_nan): New.
        (fold_builtin): Call it.
        * real.c (real_nan): Parse a non-empty string.
        (round_for_format): Fix NaN significand truncation.
        * real.h (real_nan): Return bool.
        * doc/extend.texi: Document new builtins.

libstdc++/
        * include/std/std_limits.h (__glibcpp_f32_QNaN_bytes,
        __glibcpp_f32_has_QNaN, __glibcpp_f32_SNaN_bytes,
        __glibcpp_f32_has_SNaN, __glibcpp_f64_QNaN_bytes,
        __glibcpp_f64_has_QNaN, __glibcpp_f64_SNaN_bytes,
        __glibcpp_f64_has_SNaN, __glibcpp_f80_QNaN_bytes,
        __glibcpp_f80_has_QNaN, __glibcpp_f80_SNaN_bytes,
        __glibcpp_f80_has_SNaN, __glibcpp_f96_QNaN_bytes,
        __glibcpp_f96_has_QNaN, __glibcpp_f96_SNaN_bytes,
        __glibcpp_f96_has_SNaN, __glibcpp_f128_QNaN_bytes,
        __glibcpp_f128_has_QNaN, __glibcpp_f128_SNaN_bytes,
        __glibcpp_f128_has_SNaN, __glibcpp_float_QNaN_bytes,
        __glibcpp_float_has_QNaN, __glibcpp_float_SNaN_bytes,
        __glibcpp_float_has_SNaN, __glibcpp_double_QNaN_bytes,
        __glibcpp_double_has_QNaN, __glibcpp_double_SNaN_bytes,
        __glibcpp_double_has_SNaN, __glibcpp_long_double_QNaN_bytes,
        __glibcpp_long_double_has_QNaN, __glibcpp_long_double_SNaN_bytes,
        __glibcpp_long_double_has_SNaN): Remove.
        (__glibcpp_f128_is_iec559): True if IEEE.
        (__glibcpp_float_QNaN, __glibcpp_float_SNaN): Remove.
        (__glibcpp_double_QNaN, __glibcpp_double_SNaN): Remove.
        (__glibcpp_long_double_QNaN, __glibcpp_long_double_SNaN): Remove.
        (std::numeric_limits<float>::has_quiet_NaN): Use __builtin_nanf.
        (std::numeric_limits<float>::has_signaling_NaN): Mirror has_quiet_NaN.
        (std::numeric_limits<float>::quiet_NaN): Use __builtin_nanf.
        (std::numeric_limits<float>::signaling_NaN): Use __builtin_nansf.
        (std::numeric_limits<double>): Similarly.
        (std::numeric_limits<long double>): Similarly.
        * src/limits.cc (__glibcpp_float_QNaN, __glibcpp_float_SNaN): Remove.
        (__glibcpp_double_QNaN, __glibcpp_double_SNaN): Remove.
        (__glibcpp_long_double_QNaN, __glibcpp_long_double_SNaN): Remove.

        * testsuite/18_support/numeric_limits.cc (test_infinity): New.
        (test_denorm_min, test_qnan, test_is_iec559): New.

From-SVN: r57221
2002-09-16 18:28:50 -07:00
Richard Henderson 3aa4cad77f builtins.def (inf, inff, infl): Mark const.
* builtins.def (inf, inff, infl): Mark const.
        (huge_val, huge_valf, huge_vall): Likewise.
        (BUILT_IN_GETEXP, BUILT_IN_GETMAN): Remove.

From-SVN: r56926
2002-09-07 20:16:46 -07:00
Richard Henderson ab5e26156f builtin-types.def (BT_FN_FLOAT): New.
* builtin-types.def (BT_FN_FLOAT): New.
        (BT_FN_DOUBLE, BT_FN_LONG_DOUBLE): New.
        * builtins.def (BUILT_IN_INF, BUILT_IN_INFF, BUILT_IN_INFL,
        BUILT_IN_HUGE_VAL, BUILT_IN_HUGE_VALF, BUILT_IN_HUGE_VALL): New.
        * builtins.c (fold_builtin_inf): New.
        (fold_builtin): Call it.
        * real.c (ereal_inf): New.
        * real.h: Declare it.
        * doc/extend.texi: Document new builtins.

From-SVN: r56820
2002-09-04 16:21:28 -07:00
Roger Sayle e7b489c8c0 builtins.def: Define new builtin functions exp...
* builtins.def: Define new builtin functions exp, expf, expl,
	log, logf and logl (and their __builtin_* variants).
	* optabs.h (enum optab_index): Add new OTI_exp and OTI_log.
	Define exp_optab and log_optab.
	* optabs.c (init_optans): Initialize exp_optab and log_optab.
	* genopinit.c (optabs): Implement exp_optab and log_optab
	using exp?f2 and log?f2 patterns.
	* builtins.c (expand_builtin_mathfn): Handle BUILT_IN_EXP*
	and BUILT_IN_LOG* using exp_optab and log_optab respectively.
	(expand_builtin): Ignore the new builtins (and all cos and
	sin variants) when not optimizing.  Expand new builtins via
	expand_builtin_mathfn when flag_unsafe_math_optimizations.

	* doc/extend.texi: Document new exp and log builtins.
	* doc/md.texi: Document new exp?f2 and log?f2 patterns
	(and previously undocumented cos?f2 and sin?f2 patterns).

From-SVN: r56010
2002-08-03 23:21:31 +00:00
Roger Sayle c2ef6d3492 builtins.def [...]: Require an explicit ATTRS argument.
* builtins.def [DEF_GCC_BUILTIN]: Require an explicit ATTRS
	argument.  Mark BUILT_IN_RETURN, BUILT_IN_EH_RETURN,
	BUILT_IN_LONGJMP and BUILT_IN_TRAP as noreturn, the ISO C99
	floating point unordered comparisons (e.g. __builtin_isgreater)
	as const, and leave the remaining GCC_BUILTINs unchanged.

	* c-decl.c (builtin_function): No need to explicitly mark
	BUILT_IN_RETURN and BUILT_IN_EH_RETURN as noreturn.

	* cp/decl.c (builtin_function_1): No need to explicitly mark
	BUILT_IN_RETURN and BUILT_IN_EH_RETURN as noreturn.

From-SVN: r55805
2002-07-28 05:34:04 +00:00
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