Commit Graph

796 Commits

Author SHA1 Message Date
Jakub Jelinek
aa4936945e re PR bootstrap/44426 (gcc 4.5.0 requires c9x compiler to build)
PR bootstrap/44426
	* tree.h (build_call_expr): Don't define as vararg macro, instead
	add a prototype.
	* builtins.c (build_call_nofold): Remove.
	(expand_builtin_int_roundingfn, expand_builtin_pow,
	expand_builtin_mempcpy_args, expand_builtin_stpcpy,
	expand_builtin_memset_args, expand_builtin_strcmp,
	expand_builtin_strncmp, expand_builtin_memory_chk): Use
	build_call_nofold_loc instead of build_call_nofold.
	(build_call_expr): New function.

From-SVN: r160754
2010-06-14 17:53:38 +02:00
Jakub Jelinek
005d613b2d re PR target/43636 (ICE in extract_insn, at recog.c:2103)
PR target/43636
	* builtins.c (expand_movstr): Use a temporary pseudo instead
	of target even when target is not NULL and not const0_rtx, but
	fails movstr predicate.
	* config/m32c/blkmov.md (movstr): Add predicate to first operand.

	* gcc.c-torture/compile/pr43636.c: New test.

From-SVN: r159972
2010-05-28 15:35:56 +02:00
Joseph Myers
1da2ed5f19 diagnostic-core.h: New.
* diagnostic-core.h: New.  Contents moved from diagnostic.h and
	toplev.h.
	* diagnostic.c: Don't include toplev.h.
	(progname): Define.  Moved from toplev.c.
	(seen_error): New function.
	* diagnostic.h: Include diagnostic-core.h.
	(diagnostic_t, emit_diagnostic): Don't declare here.
	* toplev.c (progname): Move to toplev.c.
	(emit_debug_global_declarations, compile_file, finalize,
	do_compile, toplev_main): Use seen_error.
	* toplev.h: Include diagnostic-core.h.
	(trim_filename, GCC_DIAG_STYLE, ATTRIBUTE_GCC_DIAG,
	internal_error, warning, warning_at, error, error_n, error_at,
	fatal_error, pedwarn, permerror, sorry, inform, inform_n,
	verbatim, fnotice, progname): Move to diagnostic-core.h.
	* builtins.c: Include diagnostic-core.h instead of diagnostic.h.
	(expand_builtin_expect): Use seen_error.
	* c-decl.c: Include diagnostic-core.h instead of diagnostic.h.
	(c_make_fname_decl, c_write_global_declarations): Use seen_error.
	* c-format.c: Include diagnostic-core.h instead of diagnostic.h.
	* c-gimplify.c: Include diagnostic-core.h instead of diagnostic.h.
	* c-lang.c: Include diagnostic-core.h instead of diagnostic.h.
	* c-lex.c (c_lex_with_flags, interpret_float): Don't increment
	errorcount for errors.
	* c-opts.c (c_common_finish): Use seen_error.
	* cgraph.c: Include diagnostic-core.h instead of diagnostic.h.
	* cgraphunit.c (verify_cgraph_node, verify_cgraph,
	cgraph_output_pending_asms, cgraph_optimize): Use seen_error.
	* coverage.c: Include diagnostic-core.h instead of diagnostic.h.
	(get_coverage_counts): Use seen_error.
	* dwarf2out.c (dwarf2out_finish): Use seen_error.
	* gimplify.c (gimplify_var_or_parm_decl, gimple_push_cleanup,
	gimplify_body): Use seen_error.
	* ipa-inline.c (cgraph_early_inlining): Use seen_error.
	* ipa-pure-const.c (gate_pure_const): Use seen_error.
	* ipa-reference.c (gate_reference): Use seen_error.
	* jump.c: Include diagnostic-core.h instead of diagnostic.h.
	* lambda-code.c: Include diagnostic-core.h instead of
	diagnostic.h.
	* lto-cgraph.c: Include diagnostic-core.h instead of diagnostic.h.
	* lto-compress.c: Include diagnostic-core.h instead of
	diagnostic.h.
	* lto-section-in.c: Include diagnostic-core.h instead of
	diagnostic.h.
	* lto-streamer-out.c: Include diagnostic-core.h instead of
	diagnostic.h.
	* lto-streamer.c: Include diagnostic-core.h instead of
	diagnostic.h.
	(gate_lto_out): Use seen_error.
	* matrix-reorg.c: Include diagnostic-core.h instead of
	diagnostic.h.
	* omega.c: Include diagnostic-core.h instead of diagnostic.h.
	* omp-low.c: Include diagnostic-core.h instead of diagnostic.h.
	(gate_expand_omp, lower_omp_1): Use seen_error.
	* passes.c: Include diagnostic-core.h instead of diagnostic.h.
	(rest_of_decl_compilation, rest_of_type_compilation,
	gate_rest_of_compilation, ipa_write_summaries): Use seen_error.
	* tree-cfg.c (label_to_block_fn): Use seen_error.
	* tree-inline.c (optimize_inline_calls): Use seen_error.
	* tree-mudflap.c (mudflap_finish_file): Use
	seen_error.
	* tree-optimize.c (gate_all_optimizations,
	gate_all_early_local_passes, gate_all_early_optimizations): Use
	seen_error.
	* tree-ssa-structalias.c (gate_ipa_pta): Use seen_error.
	* varpool.c: Include diagnostic-core.h instead of diagnostic.h.
	(varpool_remove_unreferenced_decls,
	varpool_assemble_pending_decls): Use seen_error.
	* Makefile.in (DIAGNOSTIC_CORE_H): Define.
	(TOPLEV_H, DIAGNOSTIC_H): Update.
	(c-decl.o, c-lang.o, c-format.o, lto-compress.o, lto-cgraph.o,
	lto-streamer-out.o, lto-section-in.o, lto-streamer.o,
	c-gimplify.o, omp-low.o, omega.o, diagnostic.o, passes.o,
	builtins.o, jump.o, cgraph.o, varpool.o, matrix-reorg.o,
	coverage.o, lambda-code.o): Update dependencies.

cp:
	* call.c: Include diagnostic-core.h instead of diagnostic.h.
	* cp-lang.c: Don't include diagnostic.h
	* name-lookup.c: Include diagnostic-core.h instead of
	diagnostic.h.
	(cp_emit_debug_info_for_using): Use seen_error.
	* optimize.c: Include diagnostic-core.h instead of diagnostic.h.
	* parser.c: Include diagnostic-core.h instead of diagnostic.h.
	* pt.c (iterative_hash_template_arg): Use seen_error.
	* repo.c: Include diagnostic-core.h instead of diagnostic.h.
	* typeck2.c: Include diagnostic-core.h instead of diagnostic.h.
	* Make-lang.in (cp/cp-lang.o, cp/typeck2.o, cp/call.o, cp/repo.o,
	cp/optimize.o, cp/parser.o, cp/name-lookup.o): Update
	dependencies.

lto:
	* lto.c: Include diagnostic-core.h instead of diagnostic.h.
	(read_cgraph_and_symbols, lto_main): Use seen_error.
	* Make-lang.in (lto/lto.o): Update dependencies.

objc:
	* objc-act.c: Include diagnostic-core.h instead of diagnostic.h.
	* Make-lang.in (objc/objc-act.o): Update dependencies.

From-SVN: r159947
2010-05-27 21:16:07 +01:00
Steven Bosscher
d49b6e1e33 real: Do not include gmp.h, mpfr.h, and mpc.h.
gcc/ChangeLog:
	* real: Do not include gmp.h, mpfr.h, and mpc.h.
	(REAL_VALUE_NEGATE, REAL_VALUE_ABS, real_arithmetic2): Remove.
	(real_value_negate, real_value_abs): New prototypes.
	(do_mpc_arg2, real_from_mpfr, mpfr_from_real): Move from here...
	* realmpfr.h (do_mpc_arg2, real_from_mpfr, mpfr_from_real): ...to here,
	new include file for interface between MPFR and REAL_VALUE_TYPE.
	* real.c: Include realmpfr.h.
	(real_arithmetic2): Remove legacy function.
	(real_value_negate): New.
	(real_value_abs): New.
	(mfpr_from_real, real_from_mpfr): Move from here...
	* realmpfr.c (mpfr_from_real, real_from_mpfr): ...to here, new file.
	* builtins.c: Include realmpfr.h.
	* fold-const.c: Include realmpfr.h.
	(fold_comparison): Use real_value_negate instead of REAL_VALUE_NEGATE.
	(fold_negate_const): Likewise.
	(fold_abs_const): Use real_value_abs instead of REAL_VALUE_ABS.
	* toplev.c: Include realmpfr.h.
	* simplify-rtx.c (simplify_const_unary_operation): Use real_value_abs
	and real_value_negate.
	* fixed-value.c (check_real_for_fixed_mode): Likewise.
	* config/arm/arm.c (neg_const_double_rtx_ok_for_fpa): Likewise.
	(vfp3_const_double_index): Likewise.
	(arm_print_operand): Likewise.
	* Makefile.in: Update dependencies.

fortran/ChangeLog:
	* trans-const.c: Include realmpfr.h.
	* Make-lang.in: Update dependencies.

From-SVN: r159679
2010-05-21 18:13:54 +00:00
Steven Bosscher
40013784db tree.h: Include real.h and fixed-value.h as basic datatypes.
gcc/ChangeLog:
	* tree.h: Include real.h and fixed-value.h as basic datatypes.
	* dfp.c, convert.c, reload1.c, reginfo.c, tree-flow.h,
	tree-ssa-threadedge.c, tree-ssanames.c, tree-loop-linear.c,
	tree-into-ssa.c, tree-vect-generic.c, tree-ssa-structalias.c,
	tree-ssa-loop-im.c, tree-dump.c, tree-complex.c, tree-ssa-uninit.c,
	genrecog.c, tree-ssa-threadupdate.c, tree-ssa-loop-niter.c,
	tree-pretty-print.c, tree-loop-distribution.c,
	tree-ssa-loop-unswitch.c, c-lex.c, optabs.c, postreload-gcse.c,
	tree-ssa-loop-manip.c, postreload.c, tree-ssa-loop-ch.c,
	tree-tailcall.c, tree.c, reload.c, tree-scalar-evolution.c, rtlanal.c,
	tree-phinodes.c, builtins.c, final.c, genoutput.c, fold-const.c,
	tree-ssa-dse.c, genautomata.c, tree-ssa-uncprop.c, toplev.c,
	tree-chrec.c, genemit.c, c-cppbuiltin.c, tree-ssa-sccvn.c,
	tree-ssa-ccp.c, tree-ssa-loop-ivopts.c, mode-switching.c,
	tree-call-cdce.c, cse.c, genpeep.c, tree-ssa-math-opts.c,
	tree-ssa-dom.c, tree-nrv.c, tree-ssa-propagate.c, tree-ssa-alias.c,
	tree-ssa-sink.c, jump.c, ifcvt.c, dwarf2out.c, expr.c, genattrtab.c,
	genconditions.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop.c,
	tree-parloops.c, recog.c, tree-ssa-address.c, lcm.c, tree-eh.c,
	gimple-pretty-print.c, c-pretty-print.c, print-rtl.c, gcse.c,
	tree-if-conv.c, tree-data-ref.c, tree-affine.c, gimplify.c,
	tree-ssa-phiopt.c, implicit-zee.c, expmed.c, tree-dfa.c, emit-rtl.c,
	store-motion.c, cselib.c, tree-cfgcleanup.c, simplify-rtx.c,
	tree-ssa-pre.c, genpreds.c, tree-mudflap.c, print-tree.c,
	tree-ssa-copy.c, tree-ssa-forwprop.c, tree-ssa-dce.c, varasm.c,
	tree-nested.c, tree-ssa.c, tree-ssa-loop-prefetch.c, rtl.c,
	tree-inline.c, integrate.c, tree-optimize.c, tree-ssa-phiprop.c,
	fixed-value.c, combine.c, tree-profile.c, c-common.c, sched-vis.c,
	tree-cfg.c, passes.c, tree-ssa-reassoc.c, config/alpha/alpha.c,
	config/frv/frv.c, config/s390/s390.c, config/m32c/m32c.c,
	config/spu/spu.c, config/sparc/sparc.c, config/mep/mep.c,
	config/m32r/m32r.c, config/rx/rx.c, config/i386/i386.c,
	config/sh/sh.c, config/pdp11/pdp11.c, config/avr/avr.c,
	config/crx/crx.c, config/xtensa/xtensa.c, config/stormy16/stormy16.c,
	config/fr30/fr30.c, config/lm32/lm32.c, config/moxie/moxie.c,
	config/m68hc11/m68hc11.c, config/cris/cris.c, config/iq2000/iq2000.c,
	config/mn10300/mn10300.c, config/ia64/ia64.c, config/m68k/m68k.c,
	config/rs6000/rs6000.c, config/picochip/picochip.c, config/darwin.c,
	config/arc/arc.c, config/mcore/mcore.c, config/score/score3.c,
	config/score/score7.c, config/score/score.c, config/arm/arm.c,
	config/pa/pa.c, config/mips/mips.c, config/vax/vax.c,
	config/h8300/h8300.c, config/v850/v850.c, config/mmix/mmix.c,
	config/bfin/bfin.c:
	Clean up redundant includes.
	* Makefile.in: Update accordingly.

java/ChangeLog:
	* typeck.c, decl.c, jcf-parse.c, except.c, expr.c:

cp/Changelog:
	* error.c, tree.c, typeck2.c, cxx-pretty-print.c, mangle.c:
	Clean up redundant includes.

fortran/ChangeLog:
	* trans-const.c, trans-types.c, trans-intrinsic.c:
	Clean up redundant includes.

From-SVN: r159663
2010-05-21 13:53:22 +00:00
Nathan Froyd
0a7561b793 re PR middle-end/44204 (ICE in gimple_op_ptr, at gimple.h:167)
PR middle-end/44204
	* builtins.c (fold_call_stmt): Pass &error_mark_node if the call
	statement has no arguments.

From-SVN: r159662
2010-05-21 13:17:04 +00:00
Nathan Froyd
f311c3b4a6 hooks.h (hook_tree_tree_tree_bool_null): Rename to...
* hooks.h (hook_tree_tree_tree_bool_null): Rename to...
	(hook_tree_tree_int_treep_bool_null): ...this.  Update signature.
	* hooks.c: Likewise.
	* target-def.h (TARGET_FOLD_BUILTIN): Define to
	hook_tree_tree_int_treep_bool_null.
	* target.h: (struct gcc_target): Update signature of fold_builtin
	field.
	* doc/tm.texi (TARGET_FOLD_BUILTIN): Update description and signature.
	* builtins.c (fold_call_expr): Pass call_expr_nargs and CALL_EXPR_ARGP
	instead of the call expression.
	(fold_builtin_call_array): Pass n and argarray directly.
	(fold_call_stmt): Pass nargs and gimple_call_arg_ptr instead of
	consing a list.
	* config/alpha/alpha.c (alpha_fold_builtin): Update signature.  Lift
	MAX_ARGS check out of the loop.  Delete declaration of `arity', declare
	`i' and use it in place of `arity'.
	* config/sparc/sparc.c (sparc_fold_builtin): Update signature.
	Dereference `args' directly.
	* config/xtensa/xtensa (xtensa_fold_builtin): Likewise.

From-SVN: r159585
2010-05-19 16:23:27 +00:00
Nathan Froyd
58a1185978 tree.h (CALL_EXPR_ARGS): Delete.
* tree.h (CALL_EXPR_ARGS): Delete.
	(call_expr_arglist): Delete.
	* tree.c (call_expr_arglist): Delete.
	* builtins.c (fold_call_expr): Pass the whole CALL_EXPR to
	targetm.fold_builtin.
	* config/alpha/alpha.c (alpha_fold_builtin): Rename arglist parameter.
	Rewrite iteration to work on call_expr_nargs rather than TREE_CHAIN.
	* config/picochip/picochip.c (picochip_expand_builtin_2op): Rename
	arglist parameter.  Use CALL_EXPR_ARG.
	(picochip_expand_builtin_3op): Likewise.
	(picochip_expand_builtin_2opvoid): Likewise.
	(picochip_expand_array_get): Likewise.
	(picochip_expand_array_put): Likewise.
	(picochip_expand_array_testport): Likewise.
	(picochip_expand_builtin): Don't call CALL_EXPR_ARGS.  Pass exp
	rather than arglist.
	* config/rx/rx.c (rx_expand_builtin): Call call_expr_nargs instead of
	CALL_EXPR_ARGS.
	* config/sparc/sparc.c (sparc_fold_builtin): Use CALL_EXPR_ARG rather
	than TREE_VALUE and TREE_CHAIN.
	* config/xtensa/xtensa.c (xtensa_fold_builtin): Likewise.
	* doc/tm.texi (TARGET_FOLD_BUILTIN): Pass CALL_EXPR tree instead of
	the arglist.

From-SVN: r159502
2010-05-17 18:16:27 +00:00
Anatoly Sokolov
82f81f18bf target.h (struct calls): Add function_value_regno_p field.
* target.h (struct calls): Add function_value_regno_p field.
	* target-def.h (TARGET_FUNCTION_VALUE_REGNO_P): Define.
	(TARGET_INITIALIZER): Use TARGET_FUNCTION_VALUE_REGNO_P.
	* targhooks.c (default_function_value_regno_p): New function.
	* targhooks.h (default_function_value_regno_p): Declare function.
	* rtlanal.c (keep_with_call_p): Use function_value_regno_p hook.
	* builtins.c. (apply_result_size): (Ditto.).
	* combine.c. (likely_spilled_retval_p): (Ditto.).
	* mode-switching.c. Include 'target.h'.
	(create_pre_exit): Use function_value_regno_p hook.
	* Makefile.in (mode-switching.o): Add dependency on TARGET_H.
	* doc/tm.texi (FUNCTION_VALUE_REGNO_P,
	TARGET_FUNCTION_VALUE_REGNO_P): Revise documentation.

	* config/i386/i386.h (TARGET_FUNCTION_VALUE_REGNO_P): Remove macro.
	* config/i386/i386.c (TARGET_FUNCTION_VALUE_REGNO_P): Define macro.
	(ix86_function_value_regno_p): Declare as static, change argument
	type to const unsigned int.
	* config/i386/i386-protos.h (ix86_function_value_regno_p): Remove.

From-SVN: r158970
2010-05-02 14:49:10 +04:00
Richard Guenther
0646825443 builtins.c (fold_builtin_1): Delete free (0).
2010-04-30  Richard Guenther  <rguenther@suse.de>

	* builtins.c (fold_builtin_1): Delete free (0).

	* gcc.dg/tree-ssa/builtin-free.c: New testcase.

From-SVN: r158923
2010-04-30 08:18:51 +00:00
Kaveh R. Ghazi
3c642f929e builtins.c (fold_builtin_cproj): Fold more cases.
* builtins.c (fold_builtin_cproj): Fold more cases.

testsuite:
        * gcc.dg/torture/builtin-cproj-1.c: Test more cases.

From-SVN: r158574
2010-04-20 20:12:47 +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
Anatoly Sokolov
54fb1ae03e double-int.h (double_int_setbit): Declare.
* double-int.h (double_int_setbit): Declare.
	* double-int.c (double_int_setbit): New function.
	* rtl.h (immed_double_int_const): Declare.
	* emit-rtl.c (immed_double_int_const): New function.
	* builtins.c (expand_builtin_signbit): Clean up, use double_int_*
	and immed_double_int_const functions.
	* optabs.c (expand_absneg_bit, expand_copysign_absneg,
	expand_copysign_bit):  (Ditto.).
	* simplify-rtx.c (simplify_binary_operation_1): (Ditto.).
	* tree-ssa-address.c (addr_for_mem_ref): (Ditto.).
	* dojump.c (prefer_and_bit_test): (Ditto.).
	* expr.c (convert_modes, reduce_to_bit_field_precision,
	const_vector_from_tree): (Ditto.).
	* expmed.c (mask_rtx, lshift_value): (Ditto.).

From-SVN: r158566
2010-04-20 20:33:46 +04:00
Michael Meissner
3eb4dbe35b PR 42694: Optimize pow (x, 0.25), pow (x, 0.75), pow (x, 1./6.)
From-SVN: r158346
2010-04-14 15:01:40 +00:00
Michael Matz
f78b86c049 re PR middle-end/43730 (internal compiler error: in expand_builtin_interclass_mathfn, at builtins.c:2313)
PR middle-end/43730
	* builtins.c (expand_builtin_interclass_mathfn): Also create
	a register if the predicate doesn't match.

testsuite/
	* gcc.dg/pr43730.c: New test.

From-SVN: r158268
2010-04-13 13:35:30 +00:00
Richard Guenther
54c5ec4fbf re PR bootstrap/43737 (Bootstrap broken at -O3)
2010-04-13  Richard Guenther  <rguenther@suse.de>

	PR bootstrap/43737
	* builtins.c (c_readstr): Fix assert.

From-SVN: r158264
2010-04-13 12:23:17 +00:00
Richard Guenther
6af84c851d re PR middle-end/40106 (Weird interaction between optimize_insn_for_speed_p and -funsafe-math-optimizations)
2010-03-22  Richard Guenther  <rguenther@suse.de>

	PR middle-end/40106
	* builtins.c (expand_builtin_pow): Expand pow (x, 1.5) as
	x * sqrt (x) even when optimizing for size if the target
	has native support for sqrt.

From-SVN: r157623
2010-03-22 12:38:02 +00:00
Michael Matz
8a0b1aa4c1 re PR target/43305 (ICE: in emit_unop_insn, at optabs.c:3838 with -Os -ffast-math and ilogbl())
PR 43305
	* builtins.c (expand_builtin_interclass_mathfn,
	expand_builtin_signbit): Use maybe_emit_unop_insn, emit libcalls
	if that fails.

testsuite/
	* gcc.dg/pr43305.c: New testcase.

From-SVN: r157567
2010-03-19 12:37:28 +00:00
Michael Matz
c21372c41e re PR middle-end/43419 (gcc replaces pow(x, 0.5) by sqrt(x), invalid when x is -0)
PR middle-end/43419
	* builtins.c (expand_builtin_pow): Don't transform pow(x, 0.5)
	into sqrt(x) if we need to preserve signed zeros.

testsuite/
	* gcc.dg/pr43419.c: New testcase.

From-SVN: r157543
2010-03-18 16:07:53 +00:00
Jakub Jelinek
40e90eac95 re PR middle-end/42233 (c++ builtin_expect code generation regression)
PR middle-end/42233
	* expr.h (jumpifnot, jumpifnot_1, jumpif, jumpif_1, do_jump,
	do_jump_1, do_compare_rtx_and_jump): Add PROB argument.
	* dojump.c: Include output.h.
	(inv): New inline function.
	(jumpifnot, jumpifnot_1, jumpif, jumpif_1, do_jump_1, do_jump,
	do_jump_by_parts_greater_rtx, do_jump_by_parts_greater,
	do_jump_by_parts_zero_rtx, do_jump_by_parts_equality_rtx,
	do_jump_by_parts_equality, do_compare_and_jump): Add PROB
	argument, pass it down to other calls.
	(do_compare_rtx_and_jump): Likewise.  If PROB is not -1,
	add REG_BR_PROB note to the conditional jump.
	* cfgexpand.c (add_reg_br_prob_note): Removed.
	(expand_gimple_cond): Don't call it, add the probability
	as last argument to jumpif_1/jumpifnot_1.
	* Makefile.in (dojump.o): Depend on output.h.
	* builtins.c (expand_errno_check): Adjust do_compare_rtx_and_jump
	callers.
	* expmed.c (emit_store_flag_force, do_cmp_and_jump): Likewise.
	* stmt.c (do_jump_if_equal): Likewise.
	* cfgrtl.c (rtl_lv_add_condition_to_bb): Likewise.
	* loop-unswitch.c (compare_and_jump_seq): Likewise.
	* config/rs6000/rs6000.c (rs6000_aix_emit_builtin_unwind_init):
	Likewise.
	* optabs.c (expand_doubleword_shift, expand_abs): Likewise.
	* expr.c (expand_expr_real_1): Adjust do_jump, jumpifnot and
	jumpifnot_1 callers.
	(expand_expr_real_2): Adjust jumpifnot_1 and do_compare_rtx_and_jump
	callers.
	(store_expr): Adjust jumpifnot caller.
	(store_constructor): Adjust jumpif caller.

From-SVN: r156889
2010-02-19 10:53:51 +01:00
Jakub Jelinek
cbb1ab1040 builtins.c (set_builtin_user_assembler_name): Also handle ffs if int is smaller than word.
* builtins.c (set_builtin_user_assembler_name): Also handle
	ffs if int is smaller than word.

	* gcc.dg/builtin-ffs-1.c: New test.

From-SVN: r156646
2010-02-10 10:21:12 +01:00
Jason Merrill
59d49708b2 re PR c++/35652 (offset warning should be given in the front-end)
PR c++/35652
	* builtins.c (c_strlen): Use EXPR_LOCATION in diagnostics.

From-SVN: r156469
2010-02-03 11:28:07 -05:00
Richard Guenther
ab996409bc re PR middle-end/42667 (internal compiler error: in insert_into_preds_of_block, at tree-ssa-pre.c:3146)
2010-01-10  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42667
	* builtins.c (fold_builtin_strlen): Add type argument and
	convert the resulting length to it.
	(fold_builtin_1): Adjust.

	* gcc.dg/torture/pr42667.c: New testcase.

From-SVN: r155791
2010-01-10 19:37:45 +00:00
H.J. Lu
0bdf1263df Move 2009 ChangeLog to ChangeLog-2009.
From-SVN: r155556
2010-01-01 09:08:32 -08:00
Richard Guenther
a28ff68b14 re PR middle-end/42559 (ice in emit_block_move_hints with -O2)
2010-01-01  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42559
	* builtins.c (get_object_alignment): Do not use DECL_ALIGN
	for LABEL_DECLs.

	* gcc.c-torture/compile/pr42559.c: New testcase.

From-SVN: r155554
2010-01-01 13:56:50 +00:00
Richard Guenther
e100f3957c re PR middle-end/42397 (FAIL: gfortran.dg/lto/20091028-2 f_lto_20091028-2_0.o-f_lto_20091028-2_1.o link, internal compiler error)
2009-12-17  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42397
	* builtins.c (get_object_alignment): Properly deal with
	a CONST_DECL base.
	* expr.c (emit_block_move_hints): Assert the alignment makes
	sense.

From-SVN: r155316
2009-12-17 14:36:43 +00:00
David Edelsohn
14aa63526a builtins.c (do_mpc_ckconv): Pass the component type to real_from_mpfr().
* builtins.c (do_mpc_ckconv): Pass the component type to
	real_from_mpfr().

From-SVN: r155122
2009-12-09 21:42:40 -05:00
Kaveh R. Ghazi
16a19648a2 re PR other/40302 (GCC must hard-require MPC before release)
PR other/40302
	* builtins.c: Remove HAVE_mpc* checks throughout.
	* fold-const.c: Likewise.
	* real.h: Likewise.
	* toplev.c: Likewise.

From-SVN: r155046
2009-12-07 15:42:55 +00:00
Michael Matz
6dc3bf569b builtins.c (expand_builtin_printf, [...]): Remove.
* builtins.c (expand_builtin_printf, expand_builtin_fprintf,
        expand_builtin_sprintf): Remove.
        (expand_builtin): Don't call them.

From-SVN: r154673
2009-11-26 13:49:35 +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
Michael Matz
a5883ba0de tree.h (union tree_ann_d): Don't declare.
* tree.h (union tree_ann_d): Don't declare.
	(tree_base): Remove ann field.
	(struct var_ann_d): Declare forward.
	(tree_result_decl, tree_parm_decl, tree_var_decl): Add ann field.
	(DECL_VAR_ANN_PTR): New macro.
	* tree-dfa.c (create_var_ann): Rewrite in terms of above macro,
	accept only VAR, PARM or RESULT decls.
	(create_tree_common_ann): Remove.
	(remove_referenced_var): Use DECL_VAR_ANN_PTR.
	* tree-eh.c (lookup_expr_eh_lp): Remove.
	* tree-flow-inline.h (var_ann, get_var_ann): Rewrite in terms of
	DECL_VAR_ANN_PTR.
	(ann_type, tree_common_ann, get_tree_common_ann): Remove.
	* tree-flow.h (enum tree_ann_type): Remove.
	(struct tree_ann_common_d): Remove.
	(struct var_ann_d): Remove common field.
	(union tree_ann_d): Remove.
	(tree_ann_t, tree_ann_common_t): Remove typedefs.
	(tree_common_ann, get_tree_common_ann, ann_type,
	create_tree_common_ann, lookup_expr_eh_lp): Don't declare.
	* tree-ssa.c (delete_tree_ssa): Use DECL_VAR_ANN_PTR.
	* tree.c (copy_node_stat): Use DECL_VAR_ANN_PTR.
	* builtins.c (expand_builtin_memcpy): Use
	currently_expanding_gimple_stmt instead of tree annotation.
	(expand_builtin_memset_args): Ditto.
	* cfgexpand.c (currently_expanding_gimple_stmt): Add global variable.
	(expand_call_stmt): Don't set tree annotation.
	(expand_gimple_basic_block): Set currently_expanding_gimple_stmt.
	* expr.c (expand_expr_real): Don't call lookup_expr_eh_lp.
	* gimple.h (currently_expanding_gimple_stmt): Declare.

From-SVN: r154502
2009-11-24 15:37:32 +00:00
Paolo Carlini
3ab084fa78 builtins.c (apply_args_reg_offset): Remove commented out delaration.
2009-11-08  Paolo Carlini  <paolo.carlini@oracle.com>

	* builtins.c (apply_args_reg_offset): Remove commented out delaration.

From-SVN: r154015
2009-11-08 21:26:57 +00:00
David Binderman
451409e493 builtins.c (apply_args_size, [...]): Remove some set but not used variables.
2009-11-07  David Binderman <dcb314@hotmail.com>

	* builtins.c (apply_args_size, expand_builtin_mathfn, expand_powi,
	expand_builtin_expect, maybe_emit_sprintf_chk_warning): Remove some
	set but not used variables.
	* calls.c (flags_from_decl_or_type): Likewise.
	* genautomata.c (check_regexp_units_distribution): Likewise.

From-SVN: r154001
2009-11-07 20:51:14 +00:00
Jakub Jelinek
f46835f5ad re PR debug/41801 (VTA: ICE in loc_cmp.)
PR debug/41801
	* builtins.c (get_builtin_sync_mem): Expand loc in ptr_mode,
	call convert_memory_address on addr.

	* g++.dg/ext/sync-3.C: New test.

From-SVN: r153669
2009-10-28 15:43:04 +01:00
Kaveh R. Ghazi
376da68ead builtins.c (fold_builtin_cabs): Use validate_arg().
* builtins.c (fold_builtin_cabs): Use validate_arg().
	(fold_builtin_cexp): Fix if-logic.
	(fold_builtin_1): Check subtype for BUILT_IN_CIMAG.

From-SVN: r153488
2009-10-23 05:28:25 +00:00
Kaveh R. Ghazi
7610abd8cb builtins.c (fold_builtin_1): Support complex "arc" functions.
* builtins.c (fold_builtin_1): Support complex "arc" functions.
	* real.h (HAVE_mpc_arc): Define.

testsuite:
	* gcc.dg/torture/builtin-math-6.c: Test complex "arc" functions.
	* lib/target-supports.exp (check_effective_target_mpc_arc): New.

From-SVN: r152746
2009-10-14 01:14:53 +00:00
Michael Matz
6728ee7987 re PR middle-end/41573 (segfault in trunk related to strings)
PR middle-end/41573
	* builtins.c (fold_builtin_isascii): Use fold_build2.
	(fold_builtin_isdigit): Ditto.
	* except.c (duplicate_eh_regions_1): Tolerate NULL labels.
	* tree-cfg.c (struct rus_data, remove_useless_stmts_warn_notreached,
	remove_useless_stmts_cond, remove_useless_stmts_tf,
	remove_useless_stmts_tc, remove_useless_stmts_bind,
	remove_useless_stmts_goto, remove_useless_stmts_label,
	remove_useless_stmts_1, remove_useless_stmts,
	pass_remove_useless_stmts): Remove.
	* tree-pass.h (pass_remove_useless_stmts): Don't declare.
	* passes.c (init_optimization_passes): Don't add
	pass_remove_useless_stmts.
	* tree-eh.c (lower_eh_constructs_2): Handle empty cleanups.
	* tree.c (free_lang_data_in_decl): Don't clear DECL_INITIAL of
	static constants.
	* lto-symtab.c (lto_symtab_register_decl): Accepts DECL_INITIAL
	for static constants.
	* lto-streamer-out.c (output_gimple_stmt): Handle GIMPLE_NOP.
	* lto-streamer-in.c (input_gimple_stmt): Handle GIMPLE_NOP.

testsuite/
	* gcc.dg/tree-ssa/foldstring-1.c: Use fre dump.
	* gcc.dg/tree-ssa/useless-1.c: Use gimple dump.
	* gcc.dg/pr41573.c: New test.

From-SVN: r152563
2009-10-08 16:03:11 +00:00
Diego Novillo
d7f09764d7 Merge lto branch into trunk.
From-SVN: r152434
2009-10-03 17:10:11 -04:00
Michael Matz
44e10129de builtins.c (interclass_mathfn_icode): New helper.
* builtins.c (interclass_mathfn_icode): New helper.
	(expand_builtin_interclass_mathfn): Use it here, and split folding
	into ...
	(fold_builtin_interclass_mathfn): ... this new folder.
	(build_call_nofold_loc): New static helper.
	(build_call_nofold): New wrapper macro for above.
	(expand_builtin_int_roundingfn): Use it instead of build_call_expr.
	(expand_builtin_pow): Ditto.
	(expand_builtin_memset_args): Ditto.
	(expand_builtin_printf): Ditto.
	(expand_builtin_fprintf): Ditto.
	(expand_builtin_sprintf): Ditto.
	(expand_builtin_memory_chk): Ditto.
	(expand_builtin_mempcpy_args): Ditto and don't call folders.
	(expand_builtin_stpcpy): Ditto.
	(expand_builtin_strcmp): Ditto.
	(expand_builtin_strncmp): Ditto.
	(expand_builtin_strcpy): Remove FNDECL and MODE arguments.
	(expand_builtin_strcpy_args): Don't call folders.
	(expand_builtin_memcmp): Ditto.
	(expand_builtin_strncpy): Ditto, and use target.
	(expand_builtin_memcpy): Ditto.
	(expand_builtin_strstr, expand_builtin_strchr, expand_builtin_strrchr,
	expand_builtin_strpbrk, expand_builtin_memmove,
	expand_builtin_memmove_args, expand_builtin_bcopy,
	expand_builtin_memchr, expand_builtin_strcat, expand_builtin_strncat,
	expand_builtin_strspn, expand_builtin_strcspn,
	expand_builtin_fputs): Remove these.
	(expand_builtin): Don't call the above, change calls to other
	expanders that changed prototype.
	(fold_builtin_stpcpy): New folder split out from expand_builtin_stpcpy.
	(fold_builtin_1 <ISFINITE, ISINF, ISNORMAL>): Call
	fold_builtin_interclass_mathfn.
	(fold_builtin_2 <STPCPY>): Call fold_builtin_stpcpy.
	(fold_builtin_strcat): Add folding split from expand_builtin_strcat.

	* fold-const.c (fold_binary_loc <NE_EXPR>): Add !exp != 0 -> !exp.
	* passes.c (init_optimization_passes): Move pass_fold_builtins
	after last phiopt pass.
	* tree-inline.c (fold_marked_statements): When folding builtins
	iterate over all instruction potentially generated.
	* tree-ssa-ccp.c (gimplify_and_update_call_from_tree): Declare
	earlier.
	(fold_gimple_call): Use it to always fold calls (into potentially
	multiple instructions).
	* tree-ssa-dom.c (optimize_stmt): Resolve __builtin_constant_p
	calls into zero at this time.
	* tree-ssa-propagate.c (substitute_and_fold): Ignore multiple 
	statements generated by builtin folding.

testsuite/
	* gcc.dg/builtins-44.c: Use __builtin_isinf_sign when checking
	for sign of -Inf.

From-SVN: r152236
2009-09-28 12:54:23 +00:00
Richard Henderson
531ca746f9 re PR target/41246 (should "sorry" when regparm=3 and nested functions are encountered)
PR target/41246
	* target.h (struct gcc_target): Add asm_out.trampoline_template,
	calls.static_chain, calls.trampoline_init,
	calls.trampoline_adjust_address.
	* target-def.h (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
	(TARGET_STATIC_CHAIN, TARGET_TRAMPOLINE_INIT): New.
	(TARGET_TRAMPOLINE_ADJUST_ADDRESS): New.
	* builtins.c (expand_builtin_setjmp_receiver): Use
	targetm.calls.static_chain; only clobber registers.
	(expand_builtin_init_trampoline): Use targetm.calls.trampoline_init;
	set up memory attributes properly for the trampoline block.
	(expand_builtin_adjust_trampoline): Use
	targetm.calls.trampoline_adjust_address.
	* calls.c (prepare_call_address): Add fndecl argument.  Use
	targetm.calls.static_chain.
	* df-scan.c (df_need_static_chain_reg): Remove.
	(df_get_entry_block_def_set): Use targetm.calls.static_chain;
	consolodate static chain handling.
	* doc/tm.texi: Document new hooks.
	* emit-rtl.c (static_chain_rtx, static_chain_incoming_rtx): Remove.
	(init_emit_regs): Don't initialize them.
	* expr.h (prepare_call_address): Update decl.
	* final.c (profile_function): Use targetm.calls.static_chain.
	* function.c (expand_function_start): Likewise.
	* rtl.h (static_chain_rtx, static_chain_incoming_rtx): Remove.
	* stmt.c (expand_nl_goto_receiver): Use targetm.calls.static_chain;
	only clobber registers.
	* targhooks.c (default_static_chain): New.
	(default_asm_trampoline_template, default_trampoline_init): New.
	(default_trampoline_adjust_address): New.
	* targhooks.h: Declare them.
	* varasm.c (assemble_trampoline_template): Use
	targetm.asm_out.trampoline_template.  Make the memory block const
	and set its size.

From-SVN: r151983
2009-09-22 08:11:37 -07:00
Kaveh R. Ghazi
ca75b92633 re PR middle-end/30789 (complex folding inexact)
PR middle-end/30789
	* builtins.c (do_mpc_arg2): Accept DO_NONFINITE parameter.
	(do_mpc_ckconv): Accept FORCE_CONVERT parameter.
	(fold_builtin_2, do_mpc_arg1): Update accordingly.
	* fold-const.c (const_binop): Likewise.
	* real.h (do_mpc_arg2): Update prototype.

testsuite:
	* gcc.dg/torture/builtin-math-7.c: Update for testing Annex G
	cases in static initializers.

From-SVN: r151904
2009-09-20 15:39:22 +00:00
Richard Henderson
1c384bf142 builtins.c (expand_builtin_synchronize): Use gimple_build_asm_vec.
* builtins.c (expand_builtin_synchronize): Use gimple_build_asm_vec.
	* cfgbuild.c (make_edges): Handle asm goto.
	* cfglayout.c (fixup_reorder_chain): Likewise.
	* cfgrtl.c (patch_jump_insn): Likewise.
	* gimple-pretty-print.c (dump_gimple_asm): Likewise.
	* gimple.c (gimple_build_asm_1): Add and use nlabels parameter.
	(gimple_build_asm_vec): Add and use labels parameter.
	(gimple_build_asm): Remove.
	(walk_gimple_asm): Walk labels too.
	* gimple.def (GIMPLE_ASM): Update docs.
	* gimple.h: Update decls.
	(struct gimple_statement_asm): Change nc to use unsigned char;
	add nl member.
	(gimple_asm_nlabels): New.
	(gimple_asm_label_op, gimple_asm_set_label_op): New.
	* gimplify.c (gimplify_asm_expr): Copy labels from ASM_EXPR
	into gimple_build_asm_vec.
	* jump.c (mark_jump_label_asm): New.
	(mark_jump_label): Use it.
	(redirect_jump_1): Handle asm goto.
	(invert_jump_1): Soft fail if X is null.
	* recog.c (extract_asm_operands): New.
	(asm_noperands): Use it; handle asm labels.
	(decode_asm_operands): Use extract_asm_operands.
	(asm_operand_ok): Properly handle empty string.
	* reg-stack.c (get_asm_operands_in_out): Rename from
	get_asm_operand_n_inputs; use extract_asm_operands; return both
	inputs and outputs by reference; update all callers.
	* rtl.def (ASM_OPERANDS): Add label vector as operand 6.
	* rtl.h (ASM_OPERANDS_LABEL_VEC): New.
	(ASM_OPERANDS_LABEL_LENGTH, ASM_OPERANDS_LABEL): New.
	(ASM_OPERANDS_SOURCE_LOCATION): Renumber.
	(extract_asm_operands): Declare.
	* stmt.c (expand_asm_operands): Add and use labels parameter.
	(check_unique_operand_names): Likewise.
	(resolve_asm_operand_names, resolve_operand_name_1): Likewise.
	(expand_asm_stmt): Handle asm labels.
	* tree-cfg.c (make_gimple_asm_edges): New.
	(make_edges): Use it.
	(cleanup_dead_labels): Handle asm labels.
	(is_ctrl_altering_stmt): Likewise.
	(gimple_redirect_edge_and_branch): Likewise.
	* tree.def (ASM_EXPR): Add 5th operand.
	* tree.h (ASM_LABELS): New.
	(resolve_asm_operand_names): Update decl.

	* c-parser.c (c_parser_asm_statement): Parse asm goto.
	(c_parser_asm_goto_operands): New.
	* c-tree.h (build_asm_expr): Update decl.
	* c-typeck.c (build_asm_expr): Add and use labels parameter.
	* doc/extend.texi: Document asm goto.

gcc/ada/
	* gcc-interface/trans.c (Pragma_to_gnu): Use build5 for ASM_EXPR.

gcc/cp/
	* cp-tree.h (finish_asm_stmt): Update decl.
	* parser.c (cp_parser_asm_definition): Parse asm goto.
	(cp_parser_asm_label_list): New.
	* pt.c (tsubst_copy_asm_operands): Don't recurse on labels.
	(tsubst_expr): Handle asm labels.
	* semantics.c (finish_asm_stmt): Add and use labels parameter.

gcc/testsuite/
	* c-c++-common/asmgoto-1.c, c-c++-common/asmgoto-2.c,
	c-c++-common/asmgoto-3.c, gcc.c-torture/compile/asmgoto-1.c,
	gcc.dg/tree-ssa/asmgoto-1.c: New files.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r151701
2009-09-14 13:17:24 -07:00
Richard Henderson
1d65f45cfa Squash commit of EH in gimple
From-SVN: r151696
2009-09-14 12:18:58 -07:00
Michael Matz
28ed065ef9 expr.h (emit_storent_insn, [...]): Declare.
* expr.h (emit_storent_insn, expand_expr_real_1,
	expand_expr_real_2): Declare.
	* expr.c (emit_storent_insn, expand_expr_real_1,
	expand_expr_real_2): Export.
	(store_expr): Setting and evaluating dont_return_target is
	useless.
	(expand_expr_real_1, <case GOTO_EXPR, RETURN_EXPR, SWITCH_EXPR,
	LABEL_EXPR and ASM_EXPR>): Move to gcc_unreachable.
	* except.c (expand_resx_expr): Rename to ...
	(expand_resx_stmt): ... this.  Rewrite to take gimple statement.
	* except.h (expand_resx_stmt): Declare.
	* stmt.c: Add include gimple.h
	(expand_asm_expr): Rename to ...
	(expand_asm_stmt): ... this. Rewrite to take gimple statement.
	(expand_case): Rewrite to take gimple statement.
	* tree.h (expand_asm_stmt): Declare.
	(expand_case): Change prototype.
	* Makefile.in (stmt.o): Depend on gimple.h.
	* builtins.c (expand_builtin_synchronize): Build gimple asm
	statement, not an ASM_EXPR.
	* cfgexpand.c (gimple_cond_pred_to_tree, set_expr_location_r,
	gimple_to_tree, release_stmt_tree): Remove.
	(expand_gimple_cond): Don't call gimple_cond_pred_to_tree or
	ggc_free, but hold comparison code and operands separately.
	Call jumpif_1 and jumpifnot_1 instead of jumpif and jumpifnot.
	(expand_call_stmt, expand_gimple_stmt_1,
	expand_gimple_stmt): New helpers.
	(expand_gimple_tailcall): Don't call gimple_to_tree, expand_expr_stmt,
	release_stmt_tree.  Call expand_gimple_stmt instead.
	(expand_gimple_basic_block): Ditto.

	* calls.c (emit_call_1): Don't look at EH regions here, make
	fntree parameter useless.
	(expand_call): New local rettype for TREE_TYPE(exp), use it
	throughout.  Remove local p, use addr instead.
	Don't look at EH regions here.

From-SVN: r151350
2009-09-02 21:13:34 +00:00
Richard Guenther
638381579b revert: builtins.c (fold_builtin_memory_op): Use the alias oracle to query if the memory regions for memmove overlap.
2009-09-02  Richard Guenther  <rguenther@suse.de>

        Revert
        2009-08-31  Richard Guenther  <rguenther@suse.de>

        * builtins.c (fold_builtin_memory_op): Use the alias oracle
        to query if the memory regions for memmove overlap.
        * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Relax the
        asserts on pointers, instead deal with odd trees.
        (ptr_derefs_may_alias_p): Likewise.
        (refs_may_alias_p_1): Constructor bases also never alias.

From-SVN: r151320
2009-09-02 11:58:27 +00:00
Richard Guenther
71c00b5c99 tree.c (tree_expr_size): New function.
2009-09-01  Richard Guenther  <rguenther@suse.de>

	* tree.c (tree_expr_size): New function.
	* tree.h (tree_expr_size): Declare.
	* rtlanal.c (rtx_addr_can_trap_p_1): Adjust comment.
	* builtins.c (fold_builtin_memory_op): Use tree_expr_size.
	* langhooks.c (lhd_expr_size): Remove.
	* langhooks.h (struct lang_hooks): Remove expr_size.
	* explow.c (expr_size): Use tree_expr_size.
	(int_expr_size): Likewise.
	* langhooks-def.h (lhd_expr_size): Remove.
	(LANG_HOOKS_EXPR_SIZE): Likewise.
	(LANG_HOOKS_INITIALIZER): Adjust.

	cp/
	* cp-objcp-common.c (cp_expr_size): Use tree_expr_size.
	* cp-objcp-common.h (LANG_HOOKS_EXPR_SIZE): Do not define.

From-SVN: r151261
2009-09-01 08:41:53 +00:00
Richard Guenther
e2abde5f35 builtins.c (fold_builtin_memory_op): Use the alias oracle to query if the memory regions for memmove overlap.
2009-08-31  Richard Guenther  <rguenther@suse.de>

	* builtins.c (fold_builtin_memory_op): Use the alias oracle
	to query if the memory regions for memmove overlap.
	* tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Relax the
	asserts on pointers, instead deal with odd trees.
	(ptr_derefs_may_alias_p): Likewise.
	(refs_may_alias_p_1): Constructor bases also never alias.

From-SVN: r151241
2009-08-31 12:52:17 +00:00
Richard Guenther
776e717416 re PR middle-end/41094 (Erroneous optimization of pow() with -ffast-math)
2009-08-18  Richard Guenther  <rguenther@suse.de>

	PR middle-end/41094
	* builtins.c (fold_builtin_pow): Fold pow(pow(x,y),z) to
	pow(x,y*z) only if x is nonnegative.

	* gcc.dg/torture/pr41094.c: New testcase.
	* gcc.dg/torture/builtin-power-1.c: Adjust.
	* gcc.dg/builtins-10.c: Likewise.

From-SVN: r150874
2009-08-18 13:40:18 +00:00
Kaveh R. Ghazi
2f440f6aba re PR middle-end/30789 (complex folding inexact)
PR middle-end/30789

	* builtins.c (do_mpc_arg2): Make extern, define for any MPC
	version.  Move declaration...
	* real.h (do_mpc_arg2): ... here.
	* fold-const.c (const_binop): Use MPC for complex MULT_EXPR
	and RDIV_EXPR.

testsuite:
	* gcc.dg/torture/builtin-math-7.c: New.

From-SVN: r150760
2009-08-14 16:44:36 +00:00
Richard Guenther
ac8f7e421b re PR bootstrap/40788 (ICE on sparc: tree check: expected class 'expression', have 'declaration' (var_decl) in gimplify_va_arg_expr, at builtins.c:5107)
2009-08-11  Richard Guenther  <rguenther@suse.de>
        
        PR bootstrap/40788
        * builtins.c (gimplify_va_arg_expr): Do not call 
        SET_EXPR_LOCATION.

From-SVN: r150648
2009-08-11 11:39:43 +00:00