Commit Graph

172 Commits

Author SHA1 Message Date
Richard Biener 3f8825c030 calls.c (special_function_p): setjmp-like functions are leaf.
2013-05-07  Richard Biener  <rguenther@suse.de>

	* calls.c (special_function_p): setjmp-like functions are leaf.
	* builtins.def (BUILT_IN_SETJMP): setjmp is leaf.
	* tree-inline.c (update_ssa_across_abnormal_edges): Remove assert.

From-SVN: r198681
2013-05-07 13:02:36 +00:00
Richard Biener f6b64c3501 re PR tree-optimization/56982 (Bad optimization with setjmp())
2013-04-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/56982
	* builtins.def (BUILT_IN_LONGJMP): longjmp is not a leaf
	function.
	* gimplify.c (gimplify_call_expr): Notice special calls.
	(gimplify_modify_expr): Likewise.
	* tree-cfg.c (make_abnormal_goto_edges): Handle setjmp-like
	abnormal control flow receivers.
	(call_can_make_abnormal_goto): Handle cfun->calls_setjmp
	in the same way as cfun->has_nonlocal_labels.
	(gimple_purge_dead_abnormal_call_edges): Likewise.
	(stmt_starts_bb_p): Make setjmp-like abnormal control flow
	receivers start a basic-block.

	* gcc.c-torture/execute/pr56982.c: New testcase.

From-SVN: r198096
2013-04-19 13:39:16 +00:00
Richard Sandiford d1e082c2c2 Update copyright years in gcc/
From-SVN: r195098
2013-01-10 20:38:27 +00:00
Jakub Jelinek 0e668eaf77 sanitizer.def: Add Address Sanitizer builtins.
* sanitizer.def: Add Address Sanitizer builtins.
	Rename BUILT_IN_TSAN_READ_* to BUILT_IN_TSAN_READ* and
	BUILT_IN_TSAN_WRITE_* to BUILT_IN_TSAN_WRITE*.
	* Makefile.in (asan.o): Depend on langhooks.h.
	(tsan.o): Depend on asan.h.
	* asan.h (initialize_sanitizer_builtins): New prototype.
	* asan.c: Include langhooks.h.
	(report_error_func): Use builtin_decl_implicit of corresponding
	BUILT_IN_ASAN_REPORT_{LOAD,STORE}*.
	(asan_init_func): Removed.
	(initialize_sanitizer_builtins): New function.
	(asan_finish_file): Call it.  Use builtin_decl_implicit
	on BUILT_IN_ASAN_{INIT,{,UN}REGISTER_GLOBALS}.
	(asan_instrument): Call initialize_sanitizer_builtins.
	* builtins.def (DEF_SANITIZER_BUILTIN): Change condition to
	(flag_asan || flag_tsan).
	* tsan.c: Include asan.h and tsan.h.
	(get_memory_access_decl): Rename BUILT_IN_TSAN_{READ,WRITE}_*
	to BUILT_IN_TSAN_{READ,WRITE}*.
	(tsan_pass): Call initialize_sanitizer_builtins.
	(tsan_gate, tsan_gate_O0): Don't check if
	builtin_decl_implicit_p (BUILT_IN_TSAN_INIT) is true.
	(tsan_finish_file): Call initialize_sanitizer_builtins.
	* builtin-types.def (BT_FN_VOID_PTR_PTRMODE): New fn type.

From-SVN: r194103
2012-12-03 18:28:10 +01:00
Dmitry Vyukov 32b4b7f53e builtins.def (DEF_SANITIZER_BUILTIN): Define tsan builtins.
2012-11-22  Dmitry Vyukov  <dvyukov@google.com>
	    Wei Mi  <wmi@google.com>

	* builtins.def (DEF_SANITIZER_BUILTIN): Define tsan builtins. 
	* sanitizer.def: Ditto. 
	* Makefile.in (tsan.o): Add tsan.o target. 
	(BUILTINS_DEF): Add sanitizer.def.
	* passes.c (init_optimization_passes): Add tsan passes.
	* tree-pass.h (register_pass_info): Ditto.
	* toplev.c (compile_file): Ditto. 
	* doc/invoke.texi: Document tsan related options.
	* gcc.c (LINK_COMMAND_SPEC): Add LIBTSAN_SPEC in link command if
	-fsanitize=thread.
	* tsan.c: New file about tsan.
	* tsan.h: Ditto.
	* common.opt: Add -fsanitize=thread.


Co-Authored-By: Wei Mi <wmi@google.com>

From-SVN: r193736
2012-11-22 21:56:58 +00:00
Jan Hubicka 4d84e22c4b builtins.def (BUILT_IN_UNREACHABLE): Make ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST.
* builtins.def (BUILT_IN_UNREACHABLE): Make ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST.
	* builtin-attrs.def (ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST): Define.

From-SVN: r192632
2012-10-20 10:12:36 +00:00
Chung-Lin Tang f959607b40 builtins.c (expand_builtin_thread_pointer): New.
2012-10-11  Chung-Lin Tang  <cltang@codesourcery.com>

	* builtins.c (expand_builtin_thread_pointer): New.
	(expand_builtin_set_thread_pointer): New.
	(expand_builtin): Add BUILT_IN_THREAD_POINTER,
	BUILT_IN_SET_THREAD_POINTER expand cases.
	* builtins.def (BUILT_IN_THREAD_POINTER):
	New __builtin_thread_pointer builtin.
	(BUILT_IN_SET_THREAD_POINTER):
	New __builtin_set_thread_pointer builtin.
	* optabs.def (get_thread_pointer,set_thread_pointer):
	New standard names.
	* doc/md.texi (Standard Names): Document get_thread_pointer and
	set_thread_pointer patterns.
	* config/alpha/alpha.md (get_thread_pointerdi): Rename from load_tp.
	(set_thread_pointerdi): Rename from set_tp.
	* config/alpha/alpha.c (alpha_legitimize_address_1): Change
	gen_load_tp calls to gen_get_thread_pointerdi.
	(alpha_builtin): Remove ALPHA_BUILTIN_THREAD_POINTER,
	ALPHA_BUILTIN_SET_THREAD_POINTER.
	(code_for_builtin): Remove CODE_FOR_load_tp, CODE_FOR_set_tp.
	(alpha_init_builtins): Remove __builtin_thread_pointer,
	__builtin_set_thread_pointer machine-specific builtins.
	(alpha_expand_builtin_thread_pointer): Add hook function for
	TARGET_EXPAND_BUILTIN_THREAD_POINTER.
	(alpha_expand_builtin_set_thread_pointer): Add hook function for
	TARGET_EXPAND_BUILTIN_SET_THREAD_POINTER.
	(alpha_fold_builtin): Remove ALPHA_BUILTIN_THREAD_POINTER,
	ALPHA_BUILTIN_SET_THREAD_POINTER cases.
	* config/arm/arm.md (get_thread_pointersi): New pattern.
	* config/arm/arm-protos.h (arm_load_tp): Add extern declaration.
	* config/arm/arm.c (arm_load_tp): Remove static.
	(arm_builtins): Remove ARM_BUILTIN_THREAD_POINTER.
	(arm_init_tls_builtins): Remove function.
	(arm_init_builtins): Remove call to arm_init_tls_builtins().
	(arm_expand_builtin): Remove ARM_BUILTIN_THREAD_POINTER case.
	* config/mips/mips.md (get_thread_pointer<mode>): New pattern.
	* config/mips/mips-protos.h (mips_expand_thread_pointer):
	Add extern declaration.
	* config/mips/mips.c (mips_expand_thread_pointer):
	Renamed from mips_get_tp.
	(mips_get_tp): New stub calling mips_expand_thread_pointer.
	* config/s390/s390.c (s390_builtin,code_for_builtin_64,
	code_for_builtin_31,s390_init_builtins,s390_expand_builtin): Remove.
	* config/s390/s390.md (get_tp_64,get_tp_31,set_tp_64,set_tp_31):
	Remove.
	(get_thread_pointer<mode>,set_thread_pointer<mode>):
	New, adapted from removed patterns.
	* config/xtensa/xtensa.md (get_thread_pointersi):
	Renamed from load_tp.
	(set_thread_pointersi): Renamed from set_tp.
	* config/xtensa/xtensa.c (xtensa_legitimize_tls_address):
	Change gen_load_tp calls to gen_get_thread_pointersi.
	(xtensa_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER and
	XTENSA_BUILTIN_SET_THREAD_POINTER.
	(xtensa_init_builtins): Remove __builtin_thread_pointer,
	__builtin_set_thread_pointer machine-specific builtins.
	(xtensa_fold_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER,
	XTENSA_BUILTIN_SET_THREAD_POINTER cases.
	(xtensa_expand_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER,
	XTENSA_BUILTIN_SET_THREAD_POINTER cases.

From-SVN: r192364
2012-10-11 15:05:44 +00:00
Richard Guenther 4f39564266 builtins.def (ATTR_MATHFN_FPROUNDING): Do not use no-vops with -frounding-math.
2012-10-01  Richard Guenther  <rguenther@suse.de>

	* builtins.def (ATTR_MATHFN_FPROUNDING): Do not use no-vops
	with -frounding-math.
	* builtin-attrs.def (ATTR_PURE_NOTHROW_NOVOPS_LIST): Remove.
	(ATTR_PURE_NOTHROW_NOVOPS_LEAF_LIST): Likewise.

From-SVN: r191925
2012-10-01 14:15:00 +00:00
Richard Guenther 3537a0cdbb builtin-types.def (BT_FN_CONST_STRING): Add.
2012-09-14  Richard Guenther  <rguenther@suse.de>

	* builtin-types.def (BT_FN_CONST_STRING): Add.
	* builtins.def (BUILT_IN_FILE, BUILT_IN_FUNCTION,
	BUILT_IN_LINE): New builtins.
	* gimplify.c (gimplify_call_expr): Expand them.
	* doc/extend.texi (__builtin_LINE, __builtin_FUNCTION,
	__builtin_FILE): Document.

	* g++.dg/torture/builtin-location.C: New testcase.

From-SVN: r191290
2012-09-14 08:50:01 +00:00
Bernd Schmidt e384e6b59c attribs.c (decl_attributes): Avoid emitting a warning if ATTR_FLAG_BUILT_IN.
* attribs.c (decl_attributes): Avoid emitting a warning if
	ATTR_FLAG_BUILT_IN.
	* doc/rtl.texi (CALL_INSN_FUNCTION_USAGE): Use lowercase for rtx
	codes.  Document meaning of sets inside CALL_INSN_FUNCTION_USAGE.
	* c-family/c-common.c (DEF_ATTR_STRING): Define and undefine as
	necessary.
	* builtin-attrs.def (DEF_ATTR_FOR_STRING): Define.  Use it to
	define a string "1".
	(ATTR_RET1_NOTHROW_NONNULL_LEAF): New attr definition.
	* builtins.def (BUILT_IN_MEMCPY, BUILT_IN_MEMMOVE, BUILT_IN_MEMSET,
	BUILT_IN_STRCPY): Use it for these functions.
	* postreload.c (reload_combine): Deal with SETs inside
	CALL_INSN_FUNCTION_USAGE.
	* caller-save.c (setup_save_areas, save_call_clobbered_regs):
	Look for REG_RETURNED notes and use a cheap restore if possible.
	* ira-int.h (struct ira_allocno): New member cheap_calls_crossed_num.
	(ALLOCNO_CHEAP_CALLS_CROSSED_NUM): New macro.
	* ira-build.c (ira_create_allocno, create_cap_allocno,
	propagate_allocno_info, propagate_some_info_from_allocno,
	copy_info_to_removed_store_destination, ira_flattening): Handle it.
	* ira-lives.c (pseudo_regno_single_word_and_live_p,
	find_call_crossed_cheap_reg): New static functions.
	(process_bb_node_lives): Look for SETs in CALL_INSN_FUNCTION_USAGE,
	and set ALLOCNO_CHEAP_CALLS_CROSSED_NUM if possible.  Also make
	a REG_RETURNED note in that case.
	* ira.c (setup_reg_renumber): Change assert to allow cases where
	allocnos only cross calls for which they are cheap to restore.
	* ira-costs.c (ira_tune_allocno_costs): Compare
	ALLOCNO_CALLS_CROSSED_NUM to ALLOCNO_CHEAP_CALLS_CROSSED_NUM rather
	than 0.
	* reg-notes.def (REG_RETURNED): New note.
	* cse.c (cse_insn): Likewise.
	* sched-deps.c (sched_analyze_insn): Likewise.
	* expr.c (init_block_move_fn): Set a "fn spec" attribute.
	* calls.c (decl_return_flags): New static function.
	(expand_call): Generate a SET in CALL_INSN_FUNCTION_USAGE for
	functions that return one of their arguments.
	* lto/lto-lang.c (handle_fnspec_attribute): New static function.
	(lto_attribute_table): Add "fn spec".
	(DEF_ATTR_STRING): Define and undefine along with the other macros.
	* regcprop.c (struct kill_set_value_data): New.
	(kill_set_value): Interpret data as a pointer to such a struct.
	Do nothing if the caller wants the register to be ignored.
	(copyprop_hardreg_forward_1): Handle SETs in CALL_INSN_FUNCTION_USAGE.

testsuite/
	* gcc.target/i386/retarg.c: New test.

From-SVN: r187459
2012-05-14 12:08:31 +00:00
Eric Botcazou ac868f29d7 re PR target/52624 (missing __builtin_bswap16)
PR target/52624
	* doc/extend.texi (Other Builtins): Document __builtin_bswap16.
	(PowerPC AltiVec/VSX Built-in Functions): Remove it.
	* doc/md.texi (Standard Names): Add bswap.
	* builtin-types.def (BT_UINT16): New primitive type.
	(BT_FN_UINT16_UINT16): New function type.
	* builtins.def (BUILT_IN_BSWAP16): New.
	* builtins.c (expand_builtin_bswap): Add TARGET_MODE argument.
	(expand_builtin) <BUILT_IN_BSWAP16>: New case.  Pass TARGET_MODE to
	expand_builtin_bswap.
	(fold_builtin_bswap): Add BUILT_IN_BSWAP16 case.
	(fold_builtin_1): Likewise.
	(is_inexpensive_builtin): Likewise.
	* optabs.c (expand_unop): Deal with bswap in HImode specially.  Add
	missing bits for bswap to libcall code.
	* tree.c (build_common_tree_nodes): Build uint16_type_node.
	* tree.h (enum tree_index): Add TI_UINT16_TYPE.
	(uint16_type_node): New define.
	* config/rs6000/rs6000-builtin.def (RS6000_BUILTIN_BSWAP_HI): Delete.
	* config/rs6000/rs6000.c (rs6000_expand_builtin): Remove handling of
	above builtin.
	(rs6000_init_builtins): Likewise.
	* config/rs6000/rs6000.md (bswaphi2): Add TARGET_POWERPC predicate.
c-family/
	* c-common.h (uint16_type_node): Rename into...
	(c_uint16_type_node): ...this.
	* c-common.c (c_common_nodes_and_builtins): Adjust for above renaming.
	* c-cppbuiltin.c (builtin_define_stdint_macros): Likewise.

From-SVN: r186308
2012-04-11 11:13:39 +00:00
Ian Lance Taylor 183dd1301c compiler: Use new __builtin_init_heap_trampoline.
PR go/47656
	* builtins.def (BUILT_IN_INIT_HEAP_TRAMPOLINE): Define.
	* builtins.c (expand_builtin_init_trampoline): Add onstack
	parameter.  Change caller.
	(expand_builtin): Handle BUILT_IN_INIT_HEAP_TRAMPOLINE.
	* tree.c (build_common_builtin_nodes): Declare
	__builtin_init_heap_trampoline.

From-SVN: r183650
2012-01-27 22:25:02 +00:00
Aldy Hernandez dda6ecaea8 re PR lto/51698 ([trans-mem] TM runtime and application with LTO)
PR lto/51698
        * builtin-types.def: (BT_CONST_DOUBLE_PTR): New.
        (BT_FN_VOID_PTR_CONST_PTR_SIZE): New.
        (BT_FN_VOID_PTR_INT_SIZE): New.
        (BT_FN_UINT_UINT_VAR): Remove.
        (BT_FN_UINT32_UINT32_VAR): New.
        (BT_FN_DOUBLE_VPTR): Remove.
        (BT_FN_DOUBLE_CONST_DOUBLE_PTR): New.
        * gtm-builtins.def (_ITM_abortTransaction): Set return type to
        void.
        (_ITM_changeTransactionMode): Same.
        (_ITM_memmoveRtWt): Change return type to void.
        (_ITM_memcpyRtWt): Same.
        (_ITM_memsetW): Same.
        (_ITM_RaRD): Change types to double.
        (_ITM_RD): Same.
        (_ITM_RaWD): Same.
        (_ITM_RfWD): Same.
        * builtins.def (DEF_TM_BUILTIN): Set BOTH_P to true.
testsuite/
        PR lto/51698
        * gcc.dg/lto/trans-mem-4_0.c: New.
        * gcc.dg/lto/trans-mem-4_1.c: New.
        * gcc.dg/lto/trans-mem-2_0.c: Provide correct argument types for
        TM builtins.
        * gcc.dg/lto/trans-mem-1_0.c: Require stdint_types.
        * gcc.dg/lto/trans-mem-1_1.c: Provide correct argument types for
        TM builtins.
        * gcc.dg/lto/trans-mem-3_0.c: Require stdint_types.
        * gcc.dg/lto/trans-mem-3_1.c: Provide correct argument types for
        TM builtins.

From-SVN: r183537
2012-01-25 20:32:57 +00:00
Romain Geissler f3fc9b804a builtins.def (BUILT_IN_STPNCPY_CHK): New definition.
* builtins.def (BUILT_IN_STPNCPY_CHK): New definition.
	* builtins.c (expand_builtin, fold_builtin_4, maybe_emit_chk_warning):
	Add BUILT_IN_STPNCPY_CHK case.
	* gimple-fold.c (gimple_fold_builtin): Likewise.
	* tree-object-size.c (pass_through_call): Likewise.
	* tree-ssa-alias.c (ref_maybe_used_by_call_p_1,
	call_may_clobber_ref_p_1): Likewise.
	* tree-ssa-structalias.c (find_func_aliases_for_builtin_call,
	find_func_clobbers): Likewise.
	* tree.h (fold_builtin_strncpy_chk): Rename to fold_builtin_stxncpy_chk
	* builtins.c (fold_builtin_strncpy_chk): Likewise.
	Rewrite stpncpy_chk calls to strncpy_chk calls if returned value is
	ignored.

	* gcc.c-torture/execute/builtins/chk.h (stpncpy, stpncpy_disallowed):
	New definitions.
	* gcc.c-torture/execute/builtins/lib/chk.c (stpncpy_disallowed):
	Likewise.
	(stpncpy, __stpncpy_chk): New functions.
	* gcc.c-torture/execute/builtins/stpncpy-chk-lib.c: New file.
	* gcc.c-torture/execute/builtins/stpncpy-chk.c: Likewise.

From-SVN: r182378
2011-12-15 18:26:10 +01:00
Aldy Hernandez 0a35513e4e Merge from transactional-memory branch.
From-SVN: r181154
2011-11-08 11:13:41 +00:00
Michael Meissner e79983f458 Convert standard builtin functions from being arrays to using a functional interface
From-SVN: r179820
2011-10-11 19:55:09 +00:00
Tom de Vries 13e49da934 re PR middle-end/50527 (inconsistent vla align)
2011-10-07  Tom de Vries  <tom@codesourcery.com>

	PR middle-end/50527
	* tree.c (build_common_builtin_nodes): Add local_define_builtin for
	BUILT_IN_ALLOCA_WITH_ALIGN.  Mark that BUILT_IN_ALLOCA_WITH_ALIGN can
	throw.
	* builtins.c (expand_builtin_alloca): Handle BUILT_IN_ALLOCA_WITH_ALIGN
	arglist.  Set align for	BUILT_IN_ALLOCA_WITH_ALIGN.
	(expand_builtin): Handle BUILT_IN_ALLOCA_WITH_ALIGN.
	(is_inexpensive_builtin): Handle BUILT_IN_ALLOCA_WITH_ALIGN.
	* tree-ssa-ccp.c (evaluate_stmt): Set align for
	BUILT_IN_ALLOCA_WITH_ALIGN.
	(fold_builtin_alloca_for_var): Rename to ...
	(fold_builtin_alloca_with_align): Set DECL_ALIGN from 2nd
	BUILT_IN_ALLOCA_WITH_ALIGN argument.
	(ccp_fold_stmt): Try folding BUILT_IN_ALLOCA_WITH_ALIGN using
	fold_builtin_alloca_with_align.
	(optimize_stack_restore): Handle BUILT_IN_ALLOCA_WITH_ALIGN.
	* builtins.def (BUILT_IN_ALLOCA_WITH_ALIGN): Declare using
	DEF_BUILTIN_STUB.
	* ipa-pure-const.c (special_builtin_state): Handle
	BUILT_IN_ALLOCA_WITH_ALIGN.
	* tree-ssa-alias.c (ref_maybe_used_by_call_p_1)
	(call_may_clobber_ref_p_1): Same.
	* function.c (gimplify_parameters): Lower vla to
	BUILT_IN_ALLOCA_WITH_ALIGN.
	* gimplify.c (gimplify_vla_decl): Same.
	* cfgexpand.c (expand_call_stmt): Handle BUILT_IN_ALLOCA_WITH_ALIGN.
	* tree-mudflap.c (mf_xform_statements): Same.
	* tree-ssa-dce.c (mark_stmt_if_obviously_necessary)
	(mark_all_reaching_defs_necessary_1, propagate_necessity): Same.
	* varasm.c (incorporeal_function_p): Same.
	* tree-object-size.c (alloc_object_size): Same.
	* gimple.c (gimple_build_call_from_tree): Same.

From-SVN: r179655
2011-10-07 12:49:49 +00:00
Uros Bizjak 6c32ee7449 builtins.def (BUILT_IN_ICEIL{,F,L}, [...]): New builtin definitions.
* builtins.def (BUILT_IN_ICEIL{,F,L}, BUILT_IN_IFLOOR{,F,L}
	BUILT_IN_IRINT{,F,L}, BUILT_IN_IROUND{,F,L}: New builtin definitions.
	* convert.c (convert_to_integer): Convert to BUILT_IN_ICEIL,
	BUILT_IN_IFLOOR, BUILT_IN_IRINT or BUILT_INT_IROUND when converting
	to integer_type_node.
	* fold-const.c (tree_call_nonnegative_warnv_p): Handle BUILT_IN_ICEIL,
	BUILT_IN_IFLOOR, BUILT_IN_IRINT and BUILT_INT_IROUND.
	* builtins.c (expand_builtin_in): Ditto.
	(mathfn_built_in_1): Ditto.
	(expand_builtin_int_roundingfn): Handle BUILT_IN_ICEIL and
	BUILT_IN_IFLOOR.
	(expand_builtin_int_roundingfn_2): Handle BUILT_IN_IRINT and
	BUILT_IN_IROUND.
	(fold_fixed_mathfn): Canonicalize BUILT_IN_ICEIL, BUILTIN_IN_IFLOOR
	BUILT_IN_IRINT and BUILT_IN_IROUND to BUILT_IN_LCEIL,
	BUILTIN_IN_LFLOOR, BUILT_IN_LRINT and BUILT_IN_LROUND on ILP32 targets.

testsuite/ChangeLog:

	* gcc.dg/builtins-67.c: New test.
	* gcc.target/i386/conversion.c: Ditto.

From-SVN: r177694
2011-08-12 14:32:41 +02:00
Jakub Jelinek 45d439ac1a builtin-types.def (BT_FN_PTR_CONST_PTR_SIZE_VAR): New.
* builtin-types.def (BT_FN_PTR_CONST_PTR_SIZE_VAR): New.
	* builtins.def (BUILT_IN_ASSUME_ALIGNED): New builtin.
	* tree-ssa-structalias.c (find_func_aliases_for_builtin_call,
	find_func_clobbers): Handle BUILT_IN_ASSUME_ALIGNED.
	* tree-ssa-ccp.c (bit_value_assume_aligned): New function.
	(evaluate_stmt, execute_fold_all_builtins): Handle
	BUILT_IN_ASSUME_ALIGNED.
	* tree-ssa-dce.c (propagate_necessity): Likewise.
	* tree-ssa-alias.c (ref_maybe_used_by_call_p_1,
	call_may_clobber_ref_p_1): Likewise.
	* builtins.c (is_simple_builtin, expand_builtin): Likewise.
	(expand_builtin_assume_aligned): New function.
	* doc/extend.texi (__builtin_assume_aligned): Document.

	* c-common.c (check_builtin_function_arguments): Handle
	BUILT_IN_ASSUME_ALIGNED.

	* gcc.dg/builtin-assume-aligned-1.c: New test.
	* gcc.dg/builtin-assume-aligned-2.c: New test.
	* gcc.target/i386/builtin-assume-aligned-1.c: New test.

From-SVN: r175541
2011-06-27 18:52:23 +02:00
Bernd Schmidt 3801c801f3 Makefile.in (lib2funcs): Add _clrsbsi2 and _clrsbdi2.
libgcc/
	* Makefile.in (lib2funcs): Add _clrsbsi2 and _clrsbdi2.
	* libgcc-std.ver.in (GCC_4.7.0): New section.

	gcc/
	* doc/extend.texi (__builtin_clrsb, __builtin_clrsbl,
	__builtin_clrsbll): Document.
	* doc/rtl.texi (clrsb): New entry.
	* optabs.c (widen_leading): Renamed from widen_clz.  New argument
	UNOPTAB.  All callers changed.  Use UNOPTAB instead of clz_optab.
	(expand_unop): Handle clrsb_optab.
	(init_optabs): Initialize it.
	* optabs.h (enum optab_index): New entry OTI_clrsb.
	(clrsb_optab): Define.
	* genopinit.c (optabs): Add an entry for it.
	* builtins.c (expand_builtin): Handle clrsb builtin functions.
	* builtins.def (BUILT_IN_CLRSB, BUILT_IN_CLRSBIMAX, BUILT_IN_CLRSBL,
	BUILT_IN_CLRSBLL): New.
	* rtl.def (CLRSB): New code.
	* dwarf2out.c (mem_loc_descriptor): Handle it.
	* simplify-rtx.c (simplify_const_unary_operation): Likewise.
	Use op_mode rather than mode when optimizing ffs, clz, ctz, parity
	and popcount.
	* libgcc2.c (__clrsbSI2, __clrsbDI2): New functions.
	* libgcc2.h (__clrsbSI2, __clrsbDI2): Define and declare.
	(__ctzDI2): Move declaration.
	* config/bfin/bfin.md (clrsbsi2): New expander.
	(signbitssi2): Use the CLRSB rtx.
	(clrsbhi2): Renamed from signbitshi2.  Use the CLRSB rtx.
	* config/bfin/bfin.c (bdesc_1arg): Changed accordingly.

	gcc/testsuite/
	* gcc.c-torture/excute/builtin-bitops-1.c (MAKE_FUNS): Make
	my_clrsb test functions.
	(main): Test clrsb.
	* gcc.dg/builtin-protos-1.c (test_s, test_u, test_sl, test_ul,
	test_sll, test_ull): Add clrsb tests.
	* gcc.dg/torture/builtin-attr-1.c: Add tests for clrsb, clrsbl,
	clrsbll.

From-SVN: r175261
2011-06-21 14:16:39 +00:00
Jan Hubicka b01890ffd3 tree.c (build_common_builtin_nodes): Do not initialize BUILT_IN_PROFILE_FUNC_ENTER and BUILT_IN_PROFILE_FUNC_EXIT.
* tree.c (build_common_builtin_nodes): Do not initialize
	BUILT_IN_PROFILE_FUNC_ENTER and BUILT_IN_PROFILE_FUNC_EXIT.
	* builtins.c (expand_builtin_profile_func): Remove.
	(expand_builtin): Do not handle BUILT_IN_PROFILE_FUNC_ENTER and
	BUILT_IN_PROFILE_FUNC_EXIT.
	* builtins.def (profile_func_enter, profile_func_exit): Remove stubs.
	(__cyg_profile_func_enter, __cyg_profile_func_exit): New.
	* gimplify.c (gimplify_function_tree): Reorganize code calling
	profiling functions.

From-SVN: r167342
2010-12-01 16:45:36 +00:00
Jakub Jelinek 933bc2328e builtins.def (BUILT_IN_CALLOC, [...]): Mark as leaf.
* builtins.def (BUILT_IN_CALLOC, BUILT_IN_REALLOC,
	BUILT_IN_ISALNUM, BUILT_IN_ISALPHA, BUILT_IN_ISASCII,
	BUILT_IN_ISBLANK, BUILT_IN_ISCNTRL, BUILT_IN_ISDIGIT,
	BUILT_IN_ISGRAPH, BUILT_IN_ISLOWER, BUILT_IN_ISPRINT,
	BUILT_IN_ISPUNCT, BUILT_IN_ISSPACE, BUILT_IN_ISUPPER,
	BUILT_IN_ISXDIGIT, BUILT_IN_TOASCII, BUILT_IN_TOLOWER,
	BUILT_IN_TOUPPER): Mark as leaf.

From-SVN: r165013
2010-10-06 09:48:46 +02:00
Jan Hubicka 0d6e14fdda builtin-attrs.def (ATTR_LEAF): New attribute.
* builtin-attrs.def (ATTR_LEAF): New attribute.
	(ATTR_NOVOPS_LEAF_LIST, ATTR_LEAF_LIST, ATTR_NOTHROW_LEAF_LIST,
	ATTR_CONST_NOTHROW_LEAF_LIST, ATTR_PURE_NOTHROW_LEAF_LIST,
	ATTR_PURE_NOTHROW_NOVOPS_LEAF_LIST, ATTR_NORETURN_NOTHROW_LEAF_LIST,
	ATTR_MALLOC_NOTHROW_LEAF_LIST, ATTR_SENTINEL_NOTHROW_LEAF_LIST,
	ATTR_NOTHROW_NONNULL_LEAF, ATTR_CONST_NOTHROW_NONNULL_LEAF,
	ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF, ATTR_PURE_NOTHROW_NONNULL_LEAF,
	ATTR_MALLOC_NOTHROW_NONNULL_LEAF): New attribute lists.
	* sync-builtins.def: Annotate all builtins by leaf.
	* omp-builtins.def: Annotate all builtins by leaf.
	* builtins.def: Annotate relevant builtins with leaf attribute.
	(ATTR_MATHFN_ERRNO, ATTR_MATHFN_FPROUNDING,
	ATTR_MATHFN_FPROUNDING_ERRNO, ATTR_MATHFN_FPROUNDING_STORE): Make
	leaf.
        * gcc-interface/utils.c (handle_leaf_attribute): New function.
        (gnat_internal_attribute_tables): Add leaf.

        * lto-lang.c (handle_leaf_attribute): New function.
        (lto_attribute_tables): Add leaf.

        * f95-lang.c (gfc_define_builtin): Make leaf.
        (gfc_init_builtin_functions): Handle only ATTR_CONST_NOTHROW_LEAF_LIST
        and ATTR_NOTHROW_LEAF_LIST.
        (DEF_SYNC_BUILTIN): Check ATTR_CONST_NOTHROW_LEAF_LIST.
        (DEF_GOMP_BUILTIN): Likewise.

From-SVN: r164689
2010-09-28 16:34:36 +00:00
Nathan Froyd c59a0a1d19 builtins.def (BUILT_IN_ARGS_INFO): Remove.
* builtins.def (BUILT_IN_ARGS_INFO): Remove.
	* ipa-pure-const.c (special_builtlin_state): Remove
	BUILT_IN_ARGS_INFO case.
	* tree-stdarg.c (execute_optimize_stdarg): Likewise.
	* builtins.c (expand_builtin): Likewise.
	(expand_builtin_args_info): Remove.
	* doc/tm.texi (__builtin_args_info): Remove.
	(__builtin_next_arg): Adjust to not refer to __builtin_args_info.
	* doc/tm.text.in: Likewise.

From-SVN: r162463
2010-07-23 14:31:20 +00:00
Kaveh R. Ghazi 43272bf5fd builtins.c (build_complex_cproj, [...]): New.
* builtins.c (build_complex_cproj, fold_builtin_cproj): New.
        (fold_builtin_1): Fold builtin cproj.
        * builtins.def (BUILT_IN_CPROJ, BUILT_IN_CPROJF, BUILT_IN_CPROJL):
        Use ATTR_CONST_NOTHROW_LIST.

From-SVN: r158573
2010-04-20 20:09:17 +00:00
H.J. Lu b8698a0f37 Remove trailing white spaces.
2009-11-25  H.J. Lu  <hongjiu.lu@intel.com>

	* alias.c: Remove trailing white spaces.
	* alloc-pool.c: Likewise.
	* alloc-pool.h: Likewise.
	* attribs.c: Likewise.
	* auto-inc-dec.c: Likewise.
	* basic-block.h: Likewise.
	* bb-reorder.c: Likewise.
	* bt-load.c: Likewise.
	* builtins.c: Likewise.
	* builtins.def: Likewise.
	* c-common.c: Likewise.
	* c-common.h: Likewise.
	* c-cppbuiltin.c: Likewise.
	* c-decl.c: Likewise.
	* c-format.c: Likewise.
	* c-lex.c: Likewise.
	* c-omp.c: Likewise.
	* c-opts.c: Likewise.
	* c-parser.c: Likewise.
	* c-pretty-print.c: Likewise.
	* c-tree.h: Likewise.
	* c-typeck.c: Likewise.
	* caller-save.c: Likewise.
	* calls.c: Likewise.
	* cfg.c: Likewise.
	* cfganal.c: Likewise.
	* cfgexpand.c: Likewise.
	* cfghooks.c: Likewise.
	* cfghooks.h: Likewise.
	* cfglayout.c: Likewise.
	* cfgloop.c: Likewise.
	* cfgloop.h: Likewise.
	* cfgloopmanip.c: Likewise.
	* cfgrtl.c: Likewise.
	* cgraph.c: Likewise.
	* cgraph.h: Likewise.
	* cgraphbuild.c: Likewise.
	* cgraphunit.c: Likewise.
	* cif-code.def: Likewise.
	* collect2.c: Likewise.
	* combine.c: Likewise.
	* convert.c: Likewise.
	* coverage.c: Likewise.
	* crtstuff.c: Likewise.
	* cse.c: Likewise.
	* cselib.c: Likewise.
	* dbgcnt.c: Likewise.
	* dbgcnt.def: Likewise.
	* dbgcnt.h: Likewise.
	* dbxout.c: Likewise.
	* dce.c: Likewise.
	* ddg.c: Likewise.
	* ddg.h: Likewise.
	* defaults.h: Likewise.
	* df-byte-scan.c: Likewise.
	* df-core.c: Likewise.
	* df-problems.c: Likewise.
	* df-scan.c: Likewise.
	* df.h: Likewise.
	* dfp.c: Likewise.
	* diagnostic.c: Likewise.
	* diagnostic.h: Likewise.
	* dominance.c: Likewise.
	* domwalk.c: Likewise.
	* double-int.c: Likewise.
	* double-int.h: Likewise.
	* dse.c: Likewise.
	* dwarf2asm.c: Likewise.
	* dwarf2asm.h: Likewise.
	* dwarf2out.c: Likewise.
	* ebitmap.c: Likewise.
	* ebitmap.h: Likewise.
	* emit-rtl.c: Likewise.
	* et-forest.c: Likewise.
	* except.c: Likewise.
	* except.h: Likewise.
	* expmed.c: Likewise.
	* expr.c: Likewise.
	* expr.h: Likewise.
	* final.c: Likewise.
	* flags.h: Likewise.
	* fold-const.c: Likewise.
	* function.c: Likewise.
	* function.h: Likewise.
	* fwprop.c: Likewise.
	* gcc.c: Likewise.
	* gcov-dump.c: Likewise.
	* gcov-io.c: Likewise.
	* gcov-io.h: Likewise.
	* gcov.c: Likewise.
	* gcse.c: Likewise.
	* genattr.c: Likewise.
	* genattrtab.c: Likewise.
	* genautomata.c: Likewise.
	* genchecksum.c: Likewise.
	* genconfig.c: Likewise.
	* genflags.c: Likewise.
	* gengtype-parse.c: Likewise.
	* gengtype.c: Likewise.
	* gengtype.h: Likewise.
	* genmddeps.c: Likewise.
	* genmodes.c: Likewise.
	* genopinit.c: Likewise.
	* genpreds.c: Likewise.
	* gensupport.c: Likewise.
	* ggc-common.c: Likewise.
	* ggc-page.c: Likewise.
	* ggc-zone.c: Likewise.
	* ggc.h: Likewise.
	* gimple-iterator.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimple.c: Likewise.
	* gimple.def: Likewise.
	* gimple.h: Likewise.
	* gimplify.c: Likewise.
	* graphds.c: Likewise.
	* graphite-clast-to-gimple.c: Likewise.
	* gthr-nks.h: Likewise.
	* gthr-posix.c: Likewise.
	* gthr-posix.h: Likewise.
	* gthr-posix95.h: Likewise.
	* gthr-single.h: Likewise.
	* gthr-tpf.h: Likewise.
	* gthr-vxworks.h: Likewise.
	* gthr.h: Likewise.
	* haifa-sched.c: Likewise.
	* hard-reg-set.h: Likewise.
	* hooks.c: Likewise.
	* hooks.h: Likewise.
	* hosthooks.h: Likewise.
	* hwint.h: Likewise.
	* ifcvt.c: Likewise.
	* incpath.c: Likewise.
	* init-regs.c: Likewise.
	* integrate.c: Likewise.
	* ipa-cp.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* ipa-reference.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa-struct-reorg.h: Likewise.
	* ipa-type-escape.c: Likewise.
	* ipa-type-escape.h: Likewise.
	* ipa-utils.c: Likewise.
	* ipa-utils.h: Likewise.
	* ipa.c: Likewise.
	* ira-build.c: Likewise.
	* ira-color.c: Likewise.
	* ira-conflicts.c: Likewise.
	* ira-costs.c: Likewise.
	* ira-emit.c: Likewise.
	* ira-int.h: Likewise.
	* ira-lives.c: Likewise.
	* ira.c: Likewise.
	* jump.c: Likewise.
	* lambda-code.c: Likewise.
	* lambda-mat.c: Likewise.
	* lambda-trans.c: Likewise.
	* lambda.h: Likewise.
	* langhooks.c: Likewise.
	* lcm.c: Likewise.
	* libgcov.c: Likewise.
	* lists.c: Likewise.
	* loop-doloop.c: Likewise.
	* loop-init.c: Likewise.
	* loop-invariant.c: Likewise.
	* loop-iv.c: Likewise.
	* loop-unroll.c: Likewise.
	* lower-subreg.c: Likewise.
	* lto-cgraph.c: Likewise.
	* lto-compress.c: Likewise.
	* lto-opts.c: Likewise.
	* lto-section-in.c: Likewise.
	* lto-section-out.c: Likewise.
	* lto-streamer-in.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* lto-streamer.c: Likewise.
	* lto-streamer.h: Likewise.
	* lto-symtab.c: Likewise.
	* lto-wpa-fixup.c: Likewise.
	* matrix-reorg.c: Likewise.
	* mcf.c: Likewise.
	* mode-switching.c: Likewise.
	* modulo-sched.c: Likewise.
	* omega.c: Likewise.
	* omega.h: Likewise.
	* omp-low.c: Likewise.
	* optabs.c: Likewise.
	* optabs.h: Likewise.
	* opts-common.c: Likewise.
	* opts.c: Likewise.
	* params.def: Likewise.
	* params.h: Likewise.
	* passes.c: Likewise.
	* plugin.c: Likewise.
	* postreload-gcse.c: Likewise.
	* postreload.c: Likewise.
	* predict.c: Likewise.
	* predict.def: Likewise.
	* pretty-print.c: Likewise.
	* pretty-print.h: Likewise.
	* print-rtl.c: Likewise.
	* print-tree.c: Likewise.
	* profile.c: Likewise.
	* read-rtl.c: Likewise.
	* real.c: Likewise.
	* recog.c: Likewise.
	* reg-stack.c: Likewise.
	* regcprop.c: Likewise.
	* reginfo.c: Likewise.
	* regmove.c: Likewise.
	* regrename.c: Likewise.
	* regs.h: Likewise.
	* regstat.c: Likewise.
	* reload.c: Likewise.
	* reload1.c: Likewise.
	* resource.c: Likewise.
	* rtl.c: Likewise.
	* rtl.def: Likewise.
	* rtl.h: Likewise.
	* rtlanal.c: Likewise.
	* sbitmap.c: Likewise.
	* sched-deps.c: Likewise.
	* sched-ebb.c: Likewise.
	* sched-int.h: Likewise.
	* sched-rgn.c: Likewise.
	* sched-vis.c: Likewise.
	* sdbout.c: Likewise.
	* sel-sched-dump.c: Likewise.
	* sel-sched-dump.h: Likewise.
	* sel-sched-ir.c: Likewise.
	* sel-sched-ir.h: Likewise.
	* sel-sched.c: Likewise.
	* sel-sched.h: Likewise.
	* sese.c: Likewise.
	* sese.h: Likewise.
	* simplify-rtx.c: Likewise.
	* stack-ptr-mod.c: Likewise.
	* stmt.c: Likewise.
	* stor-layout.c: Likewise.
	* store-motion.c: Likewise.
	* stringpool.c: Likewise.
	* stub-objc.c: Likewise.
	* sync-builtins.def: Likewise.
	* target-def.h: Likewise.
	* target.h: Likewise.
	* targhooks.c: Likewise.
	* targhooks.h: Likewise.
	* timevar.c: Likewise.
	* tlink.c: Likewise.
	* toplev.c: Likewise.
	* toplev.h: Likewise.
	* tracer.c: Likewise.
	* tree-affine.c: Likewise.
	* tree-affine.h: Likewise.
	* tree-browser.def: Likewise.
	* tree-call-cdce.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-chrec.c: Likewise.
	* tree-chrec.h: Likewise.
	* tree-complex.c: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-data-ref.h: Likewise.
	* tree-dfa.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-dump.h: Likewise.
	* tree-eh.c: Likewise.
	* tree-flow-inline.h: Likewise.
	* tree-flow.h: Likewise.
	* tree-if-conv.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-loop-linear.c: Likewise.
	* tree-mudflap.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-nomudflap.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-optimize.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-pass.h: Likewise.
	* tree-phinodes.c: Likewise.
	* tree-predcom.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-scalar-evolution.c: Likewise.
	* tree-ssa-address.c: Likewise.
	* tree-ssa-alias.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-coalesce.c: Likewise.
	* tree-ssa-copy.c: Likewise.
	* tree-ssa-copyrename.c: Likewise.
	* tree-ssa-dce.c: Likewise.
	* tree-ssa-dom.c: Likewise.
	* tree-ssa-dse.c: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* tree-ssa-ifcombine.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-live.h: Likewise.
	* tree-ssa-loop-ch.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-ssa-loop-unswitch.c: Likewise.
	* tree-ssa-loop.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-operands.c: Likewise.
	* tree-ssa-operands.h: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-ssa-pre.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-sink.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-ssa-ter.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-uncprop.c: Likewise.
	* tree-ssa.c: Likewise.
	* tree-ssanames.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* tree-tailcall.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-generic.c: Likewise.
	* tree-vect-loop-manip.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-slp.c: Likewise.
	* tree-vect-stmts.c: Likewise.
	* tree-vectorizer.c: Likewise.
	* tree-vectorizer.h: Likewise.
	* tree-vrp.c: Likewise.
	* tree.c: Likewise.
	* tree.def: Likewise.
	* tree.h: Likewise.
	* treestruct.def: Likewise.
	* unwind-compat.c: Likewise.
	* unwind-dw2-fde-glibc.c: Likewise.
	* unwind-dw2.c: Likewise.
	* value-prof.c: Likewise.
	* value-prof.h: Likewise.
	* var-tracking.c: Likewise.
	* varasm.c: Likewise.
	* varpool.c: Likewise.
	* vec.c: Likewise.
	* vec.h: Likewise.
	* vmsdbgout.c: Likewise.
	* web.c: Likewise.
	* xcoffout.c: Likewise.

From-SVN: r154645
2009-11-25 02:55:54 -08:00
Richard Henderson 384c400a82 except.h (struct eh_region_d): Add use_cxa_end_cleanup.
* except.h (struct eh_region_d): Add use_cxa_end_cleanup.
	* except.c (gen_eh_region): Set it.
	(duplicate_eh_regions_1): Copy it.
	* tree-eh.c (lower_resx): Use it to determine which function
	to call to resume.

	* langhooks.h (struct lang_hooks): Add eh_use_cxa_end_cleanup.
	* langhooks-def.h (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New.

	* builtins.def (BUILT_IN_CXA_END_CLEANUP): New.
	* tree.c (build_common_builtin_nodes): Remove parameter.  Build
	BUILT_IN_CXA_END_CLEANUP if necessary.
	* tree.h (build_common_builtin_nodes): Update decl.

	* c-common.c (c_define_builtins): Update call to
	build_common_builtin_nodes.

gcc/ada/
	* gcc-interface/utils.c (gnat_install_builtins): Update call to
	build_common_builtin_nodes.

gcc/cp/
	* cp-objcp-common.h (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New.

gcc/fortran/
	* f95-lang.c (gfc_init_builtin_functions): Update call to
	build_common_builtin_nodes.

gcc/java/
	* builtins.c (initialize_builtins): Update call to
	build_common_builtin_nodes.
	* lang.c (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New.

From-SVN: r152241
2009-09-28 09:44:32 -07:00
Richard Henderson 1d65f45cfa Squash commit of EH in gimple
From-SVN: r151696
2009-09-14 12:18:58 -07:00
David Daney 468059bcbb re PR c/39252 (Request new feature __builtin_unreachable ())
2009-06-11  David Daney  <ddaney@caviumnetworks.com>

	PR c/39252
	* doc/extend.texi ( __builtin_unreachable): Document new builtin.
	* builtins.c (expand_builtin_unreachable): New function.
	(expand_builtin): Handle BUILT_IN_UNREACHABLE case.
	* builtins.def (BUILT_IN_UNREACHABLE): Add new builtin.
	* cfgcleanup.c (try_optimize_cfg): Delete empty blocks with no
	successors.
	* cfgrtl.c (rtl_verify_flow_info): Handle empty blocks when
	searching for missing barriers.

2009-06-11  David Daney  <ddaney@caviumnetworks.com>

	PR c/39252
	* gcc.dg/builtin-unreachable-1.c: New test.
	* gcc.dg/builtin-unreachable-2.c: Same.

From-SVN: r148403
2009-06-11 23:55:45 +00:00
Jan Hubicka 90cc367655 builtins.def (va_start, [...]): Fix my previous commit.
* builtins.def (va_start, va_end, va_copy): Fix my previous commit.
	Wrong version of patch.

From-SVN: r146117
2009-04-15 14:07:55 +00:00
Jan Hubicka 6d14c0066a * builtins.def (va_start, va_end, va_copy): Mark nothrow.
From-SVN: r146113
2009-04-15 13:01:20 +00:00
Jakub Jelinek 66647d441f Update Copyright years for files modified in 2008 and/or 2009.
From-SVN: r144324
2009-02-20 16:20:38 +01:00
Ulrich Weigand 7b0518e33c targhooks.h (struct gcc_target): New member unwind_word_mode.
* targhooks.h (struct gcc_target): New member unwind_word_mode.
	(default_unwind_word_mode): Add prototype.
	* targhooks.c (default_unwind_word_mode): New function.
	(default_eh_return_filter_mode): Return targetm.unwind_word_mode ()
	instead of word_mode.
	* target-def.h (TARGET_UNWIND_WORD_MODE): New macro.
	(TARGET_INITIALIZER): Use it.

	* c-common.c (handle_mode_attribute): Support "unwind_word"
	mode attribute.
	* unwind-generic.h (_Unwind_Word, _Unwind_Sword): Use it.

	* except.c (init_eh): Use targetm.unwind_word_mode () instead of
	word_mode to access SjLj_Function_Context member "data".
	(sjlj_emit_dispatch_table): Likewise.  Also, perform type
	conversion from targetm.eh_return_filter_mode () to
	targetm.unwind_word_mode () if they differ.

	* builtin-types.def (BT_UNWINDWORD): New primitive type.
	(BT_FN_UNWINDWORD_PTR): New function type.
	(BT_FN_WORD_PTR): Remove.
	* builtins.def (BUILT_IN_EXTEND_POINTER): Use BT_FN_UNWINDWORD_PTR.
	* except.c (expand_builtin_extend_pointer): Convert pointer to
	targetm.unwind_word_mode () instead of word_mode.

	* config/spu/spu-protos.h (spu_eh_return_filter_mode): Remove.
	* config/spu/spu.c (spu_eh_return_filter_mode): Remove.
	(spu_unwind_word_mode): New function.
	(TARGET_EH_RETURN_FILTER_MODE): Do not define.
	(TARGET_UNWIND_WORD_MODE): Define.
	* config/spu/t-spu-elf (TARGET_LIBGCC2_CFLAGS): Remove -D__word__=SI.

From-SVN: r136912
2008-06-18 20:49:12 +00:00
Kaveh R. Ghazi 3bf5906b31 builtin-types.def (BT_FN_INT_INT_INT_INT_INT_INT_VAR): New.
* builtin-types.def (BT_FN_INT_INT_INT_INT_INT_INT_VAR): New.
	* builtins.c (fold_builtin_fpclassify): New.
	(fold_builtin_varargs): Handle BUILT_IN_FPCLASSIFY.
	* builtins.def (BUILT_IN_FPCLASSIFY): New.
	* c-common.c (handle_type_generic_attribute): Adjust to accept
	fixed arguments before an elipsis.
	(check_builtin_function_arguments): Handle BUILT_IN_FPCLASSIFY.
	* doc/extend.texi: Document __builtin_fpclassify.

testsuite:
	* gcc.dg/builtins-error.c: Test __builtin_fpclassify.  Also
	add tests for all previous type-generic builtins.
	* gcc.dg/pr28796-2.c: Add -DUNSAFE flag.
	* gcc.dg/tg-tests.h: Test __builtin_fpclassify.

From-SVN: r135789
2008-05-23 04:47:12 +00:00
Kaveh R. Ghazi 05f41289d8 re PR middle-end/35509 (builtin isinf() mismatch to compile-time substitution)
PR middle-end/35509

	* builtins.c (mathfn_built_in_1): Renamed from mathfn_built_in.
	Add `implicit' parameter.  Handle BUILT_IN_SIGNBIT.
	(mathfn_built_in): Rewrite in terms of mathfn_built_in_1.
	(fold_builtin_classify): Handle BUILT_IN_ISINF_SIGN.
	(fold_builtin_1): Likewise.
	* builtins.def (BUILT_IN_ISINF_SIGN): New.
	c-common.c (check_builtin_function_arguments): Handle
	BUILT_IN_ISINF_SIGN.
	* doc/extend.texi: Document __builtin_isinf_sign.
	* fold-const.c (operand_equal_p): Handle COND_EXPR.

testsuite:
	* gcc.dg/builtins-error.c: Test __builtin_isinf_sign.
	* gcc.dg/tg-tests.h: Likewise.  Mark variables volatile.
	* gcc.dg/torture/builtin-isinf_sign-1.c: New test.

From-SVN: r135517
2008-05-18 23:19:38 +00:00
Nathan Sidwell feb60f0328 targhooks.h (default_emutls_var_fields, [...]): Declare.
* targhooks.h (default_emutls_var_fields,
	default_emutls_var_init): Declare.
	* tree.h (DECL_THREAD_LOCAL): Compare against TLS_MODEL_REAL.
	* target.h (struct gcc_target): Add struct emutls member.
	* target-def.h (TARGET_EMUTLS_GET_ADDRESS,
	TARGET_EMUTLS_REGISTER_COMMON, TARGET_EMUTLS_VAR_SECTION,
	TARGET_EMUTLS_TMPL_SECTION, TARGET_EMUTLS_VAR_PREFIX,
	TARGET_EMUTLS_TMPL_PREFIX, TARGET_EMUTLS_VAR_FIELDS,
	TARGET_EMUTLS_VAR_INIT, TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS,
	TARGET_EMUTLS_VAR_ALIGN_FIXED, TARGET_EMUTLS): New.
	(TARGET_INITIALIZER): Add TARGET_EMUTLS.
	* builtins.def (BUILT_IN_EMUTLS_GET_ADDRESS,
	BUILT_IN_EMUTLS_REGISTER_COMMON): Get name from targetm structure.
	* dwarf2out.c (loc_descriptor_from_tree_1): Check if emutls can
	emit debug information.
	* coretypes.h (tls_model): Add TLS_MODEL_EMULATED, TLS_MODEL_REAL.
	* varasm.c: Include targhooks.h.
	(emutls_object_section, emutls_tmpl_section): New.
	(EMUTLS_VAR_PREFIX, EMUTLS_TMPL_PREFIX): Remove.
	(EMUTLS_SEPARATOR): New.
	(prefix_name): New.
	(get_emutls_object_name): New.
	(default_emutls_var_fields): New, broken out of ...
	(get_emutls_object_type): ... here.  Adjust to use target hooks.
	(get_emutls_init_templ_addr): Adjust to use target hooks.
	(emutls_decl): Adjust to use target hooks.
	(emutls_finish): Likewise.
	(default_emutls_var_init): New, broken out of ...
	(assemble_variable): ... here.  Adjust to use target hooks.
	* output.h (enum section_category): Add SECCAT_EMUTLS_VAR,
	SECCAT_EMUTLS_TMPL.
	* c-common.c (handle_section_attribute): Prevent overriding
	sections for emulated tls with special sections.
	* config/i386/i386.c (x86_64_elf_select_section): Add
	SECCAT_EMUTLS_VAR and SECCAT_EMUTLS_TMPL.
	(x86_64_elf_unique_section): Likewise.
	* config/vxworks.c: Include tree.h.
	(vxworks_emutls_var_fields, vxworks_emutls_var_init): New.
	(vxworks_override_options): Set TLS scheme.
	* gcc/doc/tm.texi (Emulated TLS): New node.

	gcc/testsuite/
	* gcc.dg/tls/section-2.c: New.
	* gcc.dg/tls/emutls-1.c: New.
	* lib/target-supports.exp (check_effective_target_tls_native):
	Exclude vxworks.

From-SVN: r134729
2008-04-27 15:35:19 +00:00
Manuel López-Ibáñez 4f01eeb4b5 re PR tree-optimization/26264 (Extraneous warning with __builtin_stdarg_start and optimization)
2008-02-26  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR 26264
	* builtins.def (BUILT_IN_STDARG_START): Remove.
	* builtins.c (expand_builtin): Remove BUILT_IN_STDARG_START.
	* tree-stdarg.c (execute_optimize_stdarg): Likewise.
	* tree-inline.c (inline_forbidden_p_1): Likewise.
cp/
	* call.c (magic_varargs_p):  Remove BUILT_IN_STDARG_START.
testsuite/
	* 20021023-1.c: Use __builtin_va_start instead of
	__builtin_stdarg_start.
	* pr17301-1.c: Likewise.
	* pr17301-2.c: Likewise.

From-SVN: r132677
2008-02-26 14:16:13 +00:00
Uros Bizjak 93e501259f re PR middle-end/19984 (nan should be C99 built-in)
PR middle-end/19984
	* builtins.def (BUILT_IN_NAN): Define as c99 builtin
	using DEF_C99_BUILTIN.
	(BUILT_IN_NANF): Ditto.
	(BUILT_IN_NANL): Ditto.

testsuite/ChangeLog:

	PR middle-end/19984
	* gcc.dg/pr19984.c: New test.
	* gcc.dg/dfp/compare-special.h: Use _nan instead of nan as the
	name of the variable.

From-SVN: r132617
2008-02-25 12:39:15 +01:00
Zdenek Dvorak 5f40b3cbe2 tree-parloops.c: New file.
* tree-parloops.c: New file.
	* tree-ssa-operands.h (free_stmt_operands): Declare.
	* tree-ssa-loop-manip.c (split_loop_exit_edge): Return the new basic
	block.
	* tree-pass.h (pass_parallelize_loops): Declare.
	* omp-low.c (expand_omp_parallel, expand_omp_for): Update SSA form for
	virtual operands.
	(build_omp_regions_1): Allow analysing just a single OMP region and
	its subregions.
	( build_omp_regions_root, omp_expand_local): New functions.
	(build_omp_regions): Add argument to build_omp_regions_1 call.
	* builtins.def (DEF_GOMP_BUILTIN): Initialize OMP builtins when
	autoparallelization is run.
	* timevar.def (TV_TREE_PARALLELIZE_LOOPS): New.
	* tree-ssa-loop.c (gate_tree_parallelize_loops, tree_parallelize_loops,
	pass_parallelize_loops): New.
	* common.opt (ftree-parallelize-loops): New.
	* tree-flow.h (omp_expand_local, tree_duplicate_sese_tail,
	parallelize_loops): Declare.
	(add_phi_args_after_copy, split_loop_exit_edge): Declaration changed.
	* Makefile.in (tree-parloops.o): Added.
	* tree-cfg.c (add_phi_args_after_copy_edge, tree_duplicate_sese_tail):
	New functions.
	(add_phi_args_after_copy_bb): Use add_phi_args_after_copy_edge.
	(add_phi_args_after_copy): Call add_phi_args_after_copy_edge for
	one extra edge as well.
	(tree_duplicate_sese_region): Add argument to add_phi_args_after_copy.
	Use VEC_free to free doms vector.
	(move_block_to_fn): Update loop info. Remove phi nodes for virtual
	operands.  Recompute operand caches in the new function.
	(move_sese_region_to_fn): Update loop info.
	* passes.c (init_optimization_passes): Add pass_parallelize_loops.
	* tree-ssa-operands.c (free_stmt_operands): New function.

	* doc/passes.texi: Document autoparallelization.
	* doc/invoke.texi (-ftree-parallelize-loops): New option.

	* gcc.dg/tree-ssa/parallelization-1.c: New test.

From-SVN: r128517
2007-09-15 21:53:45 +00:00
Jakub Jelinek ab0e176c5b builtins.def (BUILT_IN_VA_ARG_PACK_LEN): New builtin.
* builtins.def (BUILT_IN_VA_ARG_PACK_LEN): New builtin.
	* builtins.c (expand_builtin) <case BUILT_IN_VA_ARG_PACK_LEN>: Issue
	error if __builtin_va_arg_pack_len () wasn't optimized out during
	inlining.
	* tree-inline.c (copy_bb): Replace __builtin_va_arg_pack_len ()
	with the number of inline's anonymous arguments.
	* doc/extend.texi: Document __builtin_va_arg_pack_len ().

	* gcc.dg/va-arg-pack-len-1.c: New test.
	* g++.dg/va-arg-pack-len-1.C: New test.

From-SVN: r128376
2007-09-11 15:40:14 +02:00
Jakub Jelinek b1e3f20e51 builtin-attrs.def (ATTR_NONNULL_3): New.
* builtin-attrs.def (ATTR_NONNULL_3): New.
	(DEF_FORMAT_ATTRIBUTE): Use just ATTR_NONNULL_##FA instead of
	ATTR_NOTHROW_NONNULL_##FA.
	(DEF_FORMAT_ATTRIBUTE_NOTHROW, DEF_FORMAT_ATTRIBUTE_BOTH): New macros.
	(ATTR_FORMAT_PRINTF_NOTHROW_2_0, ATTR_PRINTF_NOTHROW_2_3,
	ATTR_FORMAT_PRINTF_NOTHROW_3_0, ATTR_FORMAT_PRINTF_NOTHROW_3_4,
	ATTR_FORMAT_PRINTF_NOTHROW_4_0, ATTR_PRINTF_NOTHROW_4_5,
	ATTR_FORMAT_PRINTF_NOTHROW_5_0, ATTR_FORMAT_PRINTF_NOTHROW_5_6,
	ATTR_FORMAT_SCANF_NOTHROW_2_0, ATTR_FORMAT_SCANF_NOTHROW_2_3,
	ATTR_FORMAT_STRFTIME_NOTHROW_3_0, ATTR_FORMAT_STRFMON_NOTHROW_3_4):
	New.
	(ATTR_FORMAT_PRINTF_4_0, ATTR_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0,
	ATTR_FORMAT_PRINTF_5_6, ATTR_FORMAT_STRFTIME_3_0,
	ATTR_FORMAT_NOTHROW_3_4): Remove.
	* builtins.def (snprintf, sprintf, sscanf, vsnprintf, vsprintf,
	vsscanf, strfmon, strftime, __snprintf_chk, __sprintf_chk,
	__vsnprintf_chk, __vsprintf_chk): Use ATTR_FORMAT_*_NOTHROW_*
	instead of ATTR_FORMAT_*_*.

From-SVN: r128158
2007-09-06 01:22:51 +02:00
Jakub Jelinek 6ef5231bdf builtins.def (BUILT_IN_VA_ARG_PACK): New built-in.
* builtins.def (BUILT_IN_VA_ARG_PACK): New built-in.
	* tree.h (CALL_EXPR_VA_ARG_PACK): Define.
	* tree-inline.h (copy_body_data): Add call_expr field.
	* tree-inline.c (expand_call_inline): Initialize call_expr.
	(copy_bb): Append anonymous inline fn arguments to arguments
	when inlining a CALL_EXPR_VA_ARG_PACK call.
	* builtins.c (expand_builtin): Issue an error if
	BUILT_IN_VA_ARG_PACK is seen during expand.
	(fold_call_expr, fold_builtin_call_array): Don't fold
	CALL_EXPR_VA_ARG_PACK CALL_EXPRs or calls with
	__builtin_va_arg_pack () call as last argument.
	* gimplify.c (gimplify_call_expr): If last argument to a vararg
	function is __builtin_va_arg_pack (), decrease number of call
	arguments and instead set CALL_EXPR_VA_ARG_PACK on the CALL_EXPR.
	* expr.c (expand_expr_real_1): Issue an error if
	CALL_EXPR_VA_ARG_PACK CALL_EXPR is seen during expand.
	* tree-pretty-print.c (dump_generic_node): Handle printing
	CALL_EXPR_VA_ARG_PACK bit on CALL_EXPRs.
	* doc/extend.texi (__builtin_va_arg_pack): Document.

	* gcc.c-torture/execute/va-arg-pack-1.c: New test.
	* gcc.dg/va-arg-pack-1.c: New test.

From-SVN: r128150
2007-09-05 22:45:27 +02:00
Francois-Xavier Coudert 4376b7cf2b builtin-types.def (BT_FN_PTR_PTR_SIZE): New type.
* builtin-types.def (BT_FN_PTR_PTR_SIZE): New type.
	* builtins.def (BUILT_IN_REALLOC): New builtin.

	* trans-array.c (gfc_grow_array): Use gfc_call_realloc.
	(gfc_array_allocate): Use gfc_allocate_with_status and
	gfc_allocate_array_with_status.
	(gfc_array_deallocate): Use gfc_deallocate_with_status.
	(gfc_trans_dealloc_allocated): Use gfc_deallocate_with_status.
	* trans-stmt.c (gfc_trans_allocate): Use gfc_allocate_with_status.
	(gfc_trans_deallocate): Use gfc_deallocate_with_status.
	* trans.c (gfc_allocate_with_status, gfc_allocate_array_with_status,
	gfc_deallocate_with_status, gfc_call_realloc): New functions.
	* trans.h (gfc_allocate_with_status, gfc_allocate_array_with_status,
	gfc_deallocate_with_status, gfc_call_realloc): New prototypes.
	(gfor_fndecl_internal_realloc, gfor_fndecl_allocate,
	gfor_fndecl_allocate_array, gfor_fndecl_deallocate): Remove.
	* f95-lang.c (gfc_init_builtin_functions): Create decl for
	BUILT_IN_REALLOC.
	* trans-decl.c (gfor_fndecl_internal_realloc,
	gfor_fndecl_allocate, gfor_fndecl_allocate_array,
	gfor_fndecl_deallocate): Remove function decls.
	(gfc_build_builtin_function_decls): Likewise.

	* runtime/memory.c (internal_realloc, allocate, allocate_array,
	deallocate): Remove functions.
	* gfortran.map (_gfortran_allocate, _gfortran_allocate_array,
	_gfortran_deallocate, _gfortran_internal_realloc): Remove symbols.
	* libgfortran.h (error_codes): Add comment.

	* gfortran.dg/alloc_comp_basics_1.f90: Update check.
	* gfortran.dg/alloc_comp_constructor_1.f90: Update check.

From-SVN: r127897
2007-08-29 12:44:32 +00:00
Nick Clifton 9dcd6f09a3 Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page.
From-SVN: r126948
2007-07-26 08:37:01 +00:00
Kaveh R. Ghazi 8a91c45bbf re PR target/30652 (SSE expansion is missing for isinf() and other fpclassify functions)
PR target/30652

	* builtins.c (expand_builtin_interclass_mathfn): Provide a generic
	transformation for builtin ISNORMAL.
	(expand_builtin): Handle BUILT_IN_ISNORMAL.
	* builtins.def (BUILT_IN_ISNORMAL): New.
	* doc/extend.texi: Document isnormal.

testsuite:
	* gcc.dg/pr28796-2.c: Add more cases.

From-SVN: r126726
2007-07-18 17:51:13 +00:00
Kaveh R. Ghazi 0c8d3c2b08 re PR target/30652 (SSE expansion is missing for isinf() and other fpclassify functions)
PR target/30652

	* builtins.c (expand_builtin_interclass_mathfn): Allow for missing
	optabs infrastructure.  Provide generic implementation for
	FINITE/ISFINITE.
	(expand_builtin): Handle FINITE/ISFINITE.
	(fold_builtin_classify): Make ISFINITE canonical instead of FINITE.
	(fold_builtin_1): Likewise.

	* builtins.def (BUILT_IN_ISFINITE): New.

	* doc/extend.texi: Document isfinite.

testsuite:
	* gcc.dg/pr28796-1.c: Add more cases.
	* gcc.dg/pr28796-2.c: Likewise.

From-SVN: r126725
2007-07-18 17:42:12 +00:00
Kaveh R. Ghazi b5d32c2537 re PR middle-end/32668 (The type-generic builtins apply default promotions)
PR middle-end/32668

	* builtin-attrs.def (ATTR_TYPEGENERIC,
	ATTR_CONST_NOTHROW_TYPEGENERIC): New.

	* builtins.def (BUILT_IN_ISINF, BUILT_IN_ISNAN,
	BUILT_IN_ISGREATER, BUILT_IN_ISGREATEREQUAL, BUILT_IN_ISLESS,
	BUILT_IN_ISLESSEQUAL, BUILT_IN_ISLESSGREATER,
	BUILT_IN_ISUNORDERED): Use ATTR_CONST_NOTHROW_TYPEGENERIC.

	* c-common.c (handle_type_generic_attribute): New.
	(c_common_attribute_table): Add "type generic".

	* c-typeck.c (convert_arguments): Handle "type generic" functions.

From-SVN: r126723
2007-07-18 16:13:09 +00:00
David Daney 677feb77ce builtins.def (BUILT_IN_CLEAR_CACHE): New builtin.
2007-07-10  David Daney  <ddaney@avtrex.com>

	* builtins.def (BUILT_IN_CLEAR_CACHE): New builtin.
	* builtins.c (expand_builtin___clear_cache): New function.
	(expand_builtin): Call expand_builtin___clear_cache for
	BUILT_IN_CLEAR_CACHE case.
	* doc/extend.texi (__builtin___clear_cache): Document new builtin.
	* doc/md.texi (clear_cache): Document new instruction pattern.
	* testsuite/gcc.dg/builtins-64.c: New test.

From-SVN: r126535
2007-07-11 04:13:10 +00:00
Kaveh R. Ghazi bf460eec6f builtins.c (CASE_MATHFN_REENT): New macro.
* builtins.c (CASE_MATHFN_REENT): New macro.
	(mathfn_built_in): Use it.
	* builtins.def (BUILT_IN_GAMMA_R, BUILT_IN_GAMMAF_R,
	BUILT_IN_GAMMAL_R, BUILT_IN_LGAMMA_R, BUILT_IN_LGAMMAF_R,
	BUILT_IN_LGAMMAL_R): New.
	* doc/extend.texi: Document new builtins.

testsuite:
	* gcc.dg/builtins-1.c: Test reentrant gamma functions.

From-SVN: r124821
2007-05-18 01:42:15 +00:00
Paolo Carlini 2a5fce6d48 re PR other/31852 (Missing __builtin_memchr)
2007-05-11  Paolo Carlini  <pcarlini@suse.de>

	PR other/31852
	* builtin-types.def: Add BT_FN_PTR_CONST_PTR_INT_SIZE.
	* builtins.def: Add BUILT_IN_MEMCHR, use the latter.
	* builtins.c (fold_builtin_memchr): New.
	(expand_builtin_memchr): Call the latter.
	(expand_builtin, fold_builtin_3): Deal with BUILT_IN_MEMCHR.
	* doc/extend.texi ([Other built-in functions provided by GCC]):
	Document memchr.

/testsuite
2007-05-11  Paolo Carlini  <pcarlini@suse.de>

	PR other/31852
	* gcc.c-torture/execute/builtins/memchr.c: New.
	* gcc.c-torture/execute/builtins/memchr-lib.c: New.
	* gcc.c-torture/execute/builtins/lib/memchr.c: New.

From-SVN: r124617
2007-05-11 11:49:29 +00:00