Commit Graph

505 Commits

Author SHA1 Message Date
Jakub Jelinek b1b46af04f re PR lto/69254 (ICE in streamer_get_builtin_tree when using -fsanitize=shift on the compile side only)
PR lto/69254
	* opts.h (parse_sanitizer_options): New prototype.
	* opts.c (sanitizer_opts): New array.
	(parse_sanitizer_options): New function.
	(common_handle_option): Use parse_sanitizer_options.

From-SVN: r232826
2016-01-26 14:01:44 +01:00
David Malcolm d6874f5662 Fix memory chunk corruption for opts_obstack (PR jit/68446)
gcc/ChangeLog:
	PR jit/68446
	* gcc.c (driver::decode_argv): Add call to
	init_opts_obstack before init_options_struct.
	* opts.c (init_opts_obstack): Remove idempotency.
	(init_options_struct): Replace call to init_opts_obstack
	with a gcc_assert to verify that it has already been called.
	* toplev.c (toplev::main): Add call to init_opts_obstack before
	calls to init_options_struct.
	(toplev::finalize): Move cleanup of opts_obstack next to
	cleanup of save_decoded_options, clearing the latter, and
	save_decoded_options_count.

From-SVN: r232567
2016-01-19 14:35:16 +00:00
Martin Jambor b2b4005150 Merge of HSA
2016-01-19  Martin Jambor  <mjambor@suse.cz>
	    Martin Liska  <mliska@suse.cz>
	    Michael Matz <matz@suse.de>

libgomp/
	* plugin/Makefrag.am: Add HSA plugin requirements.
	* plugin/configfrag.ac (HSA_RUNTIME_INCLUDE): New variable.
	(HSA_RUNTIME_LIB): Likewise.
	(HSA_RUNTIME_CPPFLAGS): Likewise.
	(HSA_RUNTIME_INCLUDE): New substitution.
	(HSA_RUNTIME_LIB): Likewise.
	(HSA_RUNTIME_LDFLAGS): Likewise.
	(hsa-runtime): New configure option.
	(hsa-runtime-include): Likewise.
	(hsa-runtime-lib): Likewise.
	(PLUGIN_HSA): New substitution variable.
	Fill HSA_RUNTIME_INCLUDE and HSA_RUNTIME_LIB according to the new
	configure options.
	(PLUGIN_HSA_CPPFLAGS): Likewise.
	(PLUGIN_HSA_LDFLAGS): Likewise.
	(PLUGIN_HSA_LIBS): Likewise.
	Check that we have access to HSA run-time.
	* libgomp-plugin.h (offload_target_type): New element
	OFFLOAD_TARGET_TYPE_HSA.
	* libgomp.h (gomp_target_task): New fields firstprivate_copies and
	args.
	(bool gomp_create_target_task): Updated.
	(gomp_device_descr): Extra parameter of run_func and async_run_func,
	new field can_run_func.
	* libgomp_g.h (GOMP_target_ext): Update prototype.
	* oacc-host.c (host_run): Added a new parameter args.
	* target.c (calculate_firstprivate_requirements): New function.
	(copy_firstprivate_data): Likewise.
	(gomp_target_fallback_firstprivate): Use them.
	(gomp_target_unshare_firstprivate): New function.
	(gomp_get_target_fn_addr): Allow returning NULL for shared memory
	devices.
	(GOMP_target): Do host fallback for all shared memory devices.  Do not
	pass any args to plugins.
	(GOMP_target_ext): Introduce device-specific argument parameter args.
	Allow host fallback if device shares memory.  Do not remap data if
	device has shared memory.
	(gomp_target_task_fn): Likewise.  Also treat shared memory devices
	like host fallback for mappings.
	(GOMP_target_data): Treat shared memory devices like host fallback.
	(GOMP_target_data_ext): Likewise.
	(GOMP_target_update): Likewise.
	(GOMP_target_update_ext): Likewise.  Also pass NULL as args to
	gomp_create_target_task.
	(GOMP_target_enter_exit_data): Likewise.
	(omp_target_alloc): Treat shared memory devices like host fallback.
	(omp_target_free): Likewise.
	(omp_target_is_present): Likewise.
	(omp_target_memcpy): Likewise.
	(omp_target_memcpy_rect): Likewise.
	(omp_target_associate_ptr): Likewise.
	(gomp_load_plugin_for_device): Also load can_run.
	* task.c (GOMP_PLUGIN_target_task_completion): Free
	firstprivate_copies.
	(gomp_create_target_task): Accept new argument args and store it to
	ttask.
	* plugin/plugin-hsa.c: New file.

gcc/
	* Makefile.in (OBJS): Add new source files.
	(GTFILES): Add hsa.c.
	* common.opt (disable_hsa): New variable.
	(-Whsa): New warning.
	* config.in (ENABLE_HSA): New.
	* configure.ac: Treat hsa differently from other accelerators.
	(OFFLOAD_TARGETS): Define ENABLE_OFFLOADING according to
	$enable_offloading.
	(ENABLE_HSA): Define ENABLE_HSA according to $enable_hsa.
	* doc/install.texi (Configuration): Document --with-hsa-runtime,
	--with-hsa-runtime-include, --with-hsa-runtime-lib and
	--with-hsa-kmt-lib.
	* doc/invoke.texi (-Whsa): Document.
	(hsa-gen-debug-stores): Likewise.
	* lto-wrapper.c (compile_images_for_offload_targets): Do not attempt
	to invoke offload compiler for hsa acclerator.
	* opts.c (common_handle_option): Determine whether HSA offloading
	should be performed.
	* params.def (PARAM_HSA_GEN_DEBUG_STORES): New parameter.
	* builtin-types.def (BT_FN_VOID_UINT_PTR_INT_PTR): New.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): Removed.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_PTR): New.
	* gimple-low.c (lower_stmt): Also handle GIMPLE_OMP_GRID_BODY.
	* gimple-pretty-print.c (dump_gimple_omp_for): Also handle
	GF_OMP_FOR_KIND_GRID_LOOP.
	(dump_gimple_omp_block): Also handle GIMPLE_OMP_GRID_BODY.
	(pp_gimple_stmt_1): Likewise.
	* gimple-walk.c (walk_gimple_stmt): Likewise.
	* gimple.c (gimple_build_omp_grid_body): New function.
	(gimple_copy): Also handle GIMPLE_OMP_GRID_BODY.
	* gimple.def (GIMPLE_OMP_GRID_BODY): New.
	* gimple.h (enum gf_mask): Added GF_OMP_PARALLEL_GRID_PHONY,
	GF_OMP_FOR_KIND_GRID_LOOP, GF_OMP_FOR_GRID_PHONY and
	GF_OMP_TEAMS_GRID_PHONY.
	(gimple_statement_omp_single_layout): Updated comments.
	(gimple_build_omp_grid_body): New function.
	(gimple_has_substatements): Also handle GIMPLE_OMP_GRID_BODY.
	(gimple_omp_for_grid_phony): New function.
	(gimple_omp_for_set_grid_phony): Likewise.
	(gimple_omp_parallel_grid_phony): Likewise.
	(gimple_omp_parallel_set_grid_phony): Likewise.
	(gimple_omp_teams_grid_phony): Likewise.
	(gimple_omp_teams_set_grid_phony): Likewise.
	(gimple_return_set_retbnd): Also handle GIMPLE_OMP_GRID_BODY.
	* omp-builtins.def (BUILT_IN_GOMP_OFFLOAD_REGISTER): New.
	(BUILT_IN_GOMP_OFFLOAD_UNREGISTER): Likewise.
	(BUILT_IN_GOMP_TARGET): Updated type.
	* omp-low.c: Include symbol-summary.h, hsa.h and params.h.
	(adjust_for_condition): New function.
	(get_omp_for_step_from_incr): Likewise.
	(extract_omp_for_data): Moved parts to adjust_for_condition and
	get_omp_for_step_from_incr.
	(build_outer_var_ref): Handle GIMPLE_OMP_GRID_BODY.
	(fixup_child_record_type): Bail out if receiver_decl is NULL.
	(scan_sharing_clauses): Handle OMP_CLAUSE__GRIDDIM_.
	(scan_omp_parallel): Do not create child functions for phony
	constructs.
	(check_omp_nesting_restrictions): Handle GIMPLE_OMP_GRID_BODY.
	(scan_omp_1_op): Checking assert we are not remapping to
	ERROR_MARK.  Also also handle GIMPLE_OMP_GRID_BODY.
	(parallel_needs_hsa_kernel_p): New function.
	(expand_parallel_call): Register apprpriate parallel child
	functions as HSA kernels.
	(grid_launch_attributes_trees): New type.
	(grid_attr_trees): New variable.
	(grid_create_kernel_launch_attr_types): New function.
	(grid_insert_store_range_dim): Likewise.
	(grid_get_kernel_launch_attributes): Likewise.
	(get_target_argument_identifier_1): Likewise.
	(get_target_argument_identifier): Likewise.
	(get_target_argument_value): Likewise.
	(push_target_argument_according_to_value): Likewise.
	(get_target_arguments): Likewise.
	(expand_omp_target): Call get_target_arguments instead of looking
	up for teams and thread limit.
	(grid_expand_omp_for_loop): New function.
	(grid_arg_decl_map): New type.
	(grid_remap_kernel_arg_accesses): New function.
	(grid_expand_target_kernel_body): New function.
	(expand_omp): Call it.
	(lower_omp_for): Do not emit phony constructs.
	(lower_omp_taskreg): Do not emit phony constructs but create for them
	a temporary variable receiver_decl.
	(lower_omp_taskreg): Do not emit phony constructs.
	(lower_omp_teams): Likewise.
	(lower_omp_grid_body): New function.
	(lower_omp_1): Call it.
	(grid_reg_assignment_to_local_var_p): New function.
	(grid_seq_only_contains_local_assignments): Likewise.
	(grid_find_single_omp_among_assignments_1): Likewise.
	(grid_find_single_omp_among_assignments): Likewise.
	(grid_find_ungridifiable_statement): Likewise.
	(grid_target_follows_gridifiable_pattern): Likewise.
	(grid_remap_prebody_decls): Likewise.
	(grid_copy_leading_local_assignments): Likewise.
	(grid_process_kernel_body_copy): Likewise.
	(grid_attempt_target_gridification): Likewise.
	(grid_gridify_all_targets_stmt): Likewise.
	(grid_gridify_all_targets): Likewise.
	(execute_lower_omp): Call grid_gridify_all_targets.
	(make_gimple_omp_edges): Handle GIMPLE_OMP_GRID_BODY.
	* tree-core.h (omp_clause_code): Added OMP_CLAUSE__GRIDDIM_.
	(tree_omp_clause): Added union field dimension.
	* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__GRIDDIM_.
	* tree.c (omp_clause_num_ops): Added number of arguments of
	OMP_CLAUSE__GRIDDIM_.
	(omp_clause_code_name): Added name of OMP_CLAUSE__GRIDDIM_.
	(walk_tree_1): Handle OMP_CLAUSE__GRIDDIM_.
	* tree.h (OMP_CLAUSE_GRIDDIM_DIMENSION): New.
	(OMP_CLAUSE_SET_GRIDDIM_DIMENSION): Likewise.
	(OMP_CLAUSE_GRIDDIM_SIZE): Likewise.
	(OMP_CLAUSE_GRIDDIM_GROUP): Likewise.
	* passes.def: Schedule pass_ipa_hsa and pass_gen_hsail.
	* tree-pass.h (make_pass_gen_hsail): Declare.
	(make_pass_ipa_hsa): Likewise.
	* ipa-hsa.c: New file.
	* lto-section-in.c (lto_section_name): Add hsa section name.
	* lto-streamer.h (lto_section_type): Add hsa section.
	* timevar.def (TV_IPA_HSA): New.
        * hsa-brig-format.h: New file.
	* hsa-brig.c: New file.
	* hsa-dump.c: Likewise.
	* hsa-gen.c: Likewise.
	* hsa.c: Likewise.
	* hsa.h: Likewise.
	* toplev.c (compile_file): Call hsa_output_brig.
	* hsa-regalloc.c: New file.

gcc/fortran/
	* types.def (BT_FN_VOID_UINT_PTR_INT_PTR): New.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): Removed.
	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_PTR): New.

gcc/lto/
	* lto-partition.c: Include "hsa.h"
	(add_symbol_to_partition_1): Put hsa implementations into the
	same partition as host implementations.

liboffloadmic/
	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_async_run): New
	unused parameter.
	(GOMP_OFFLOAD_run): Likewise.

include/
	* gomp-constants.h (GOMP_DEVICE_HSA): New macro.
	(GOMP_VERSION_HSA): Likewise.
	(GOMP_TARGET_ARG_DEVICE_MASK): Likewise.
	(GOMP_TARGET_ARG_DEVICE_ALL): Likewise.
	(GOMP_TARGET_ARG_SUBSEQUENT_PARAM): Likewise.
	(GOMP_TARGET_ARG_ID_MASK): Likewise.
	(GOMP_TARGET_ARG_NUM_TEAMS): Likewise.
	(GOMP_TARGET_ARG_THREAD_LIMIT): Likewise.
	(GOMP_TARGET_ARG_VALUE_SHIFT): Likewise.
	(GOMP_TARGET_ARG_HSA_KERNEL_ATTRIBUTES): Likewise.

From-SVN: r232549
2016-01-19 11:35:10 +01:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Jeff Law 72ca20f9cb [PATCH] Limit path splitting to loops we optimize for speed
* doc/invoke.texi (-O2 options): Remove -fsplit-paths.
	(-O3 options): Add -fsplit-paths.
	* gimple-ssa-split-paths.c: Include predict.h
	(split_paths): Only split paths in a loop that should be
	optimized for speed.
	* opts.c (default_options_table): Move -fsplit-paths from -O2 to
	-O3.

	* gcc.dg/tree-ssa/split-path-1.c: Explicitly ask for path
	splitting optimizations.

From-SVN: r231790
2015-12-17 16:33:44 -07:00
Tom de Vries 597a8ab9c6 Add pass_oacc_ipa
2015-12-16  Tom de Vries  <tom@codesourcery.com>

	* opts.c (default_options_optimization): Set fipa-pta on by default for
	fopenacc.
	* passes.def: Move kernels pass group to pass_ipa_oacc.
	* tree-pass.h (make_pass_oacc_kernels2): Remove.
	(make_pass_ipa_oacc, make_pass_ipa_oacc_kernels): Declare.
	* tree-ssa-loop.c (pass_oacc_kernels2, make_pass_oacc_kernels2): Remove.
	(pass_ipa_oacc, pass_ipa_oacc_kernels): New pass.
	(make_pass_ipa_oacc, make_pass_ipa_oacc_kernels): New function.
	* tree-ssa-structalias.c (pass_ipa_pta::clone): New function.

	* g++.dg/ipa/devirt-37.C: Update for new fre2 pass.
	* g++.dg/ipa/devirt-40.C: Same.
	* g++.dg/tree-ssa/pr61034.C: Same.
	* gcc.dg/ipa/ipa-pta-1.c: Update for new pta1 pass.
	* gcc.dg/ipa/ipa-pta-10.c: Same.
	* gcc.dg/ipa/ipa-pta-11.c: Same.
	* gcc.dg/ipa/ipa-pta-14.c: Same.
	* gcc.dg/ipa/ipa-pta-16.c: Same.
	* gcc.dg/ipa/ipa-pta-2.c: Same.
	* gcc.dg/ipa/ipa-pta-5.c: Same.
	* gcc.dg/ipa/ipa-pta-6.c: Same.
	* gcc.dg/torture/ipa-pta-1.c: Same.
	* gcc.dg/ipa/ipa-pta-13.c: Update for new fre2 and pta1 pass.
	* gcc.dg/ipa/ipa-pta-3.c: Same.
	* gcc.dg/ipa/ipa-pta-4.c: Same.

From-SVN: r231690
2015-12-16 13:49:07 +00:00
Jakub Jelinek 63bbf46d5f re PR c/48088 (-Werror=frame-larger-than=100 does not work as expected)
PR c/48088
	PR c/68657
	* common.opt (Wframe-larger-than=): Add Warning.
	* opts.h (control_warning_option): Add ARG argument.
	* opts-common.c (cmdline_handle_error): New function.
	(read_cmdline_option): Use it.
	(control_warning_option): Likewise.  Add ARG argument.
	If non-NULL, decode it if needed and pass through
	to handle_generated_option.  Handle CLVC_ENUM like
	CLVC_BOOLEAN.
	* opts.c (common_handle_option): Adjust control_warning_option
	caller.
	(enable_warning_as_error): Likewise.
c-family/
	* c.opt (Wfloat-conversion, Wsign-conversion): Add Warning.
	* c-pragma.c (handle_pragma_diagnostic): Adjust
	control_warning_option caller.
ada/
	* gcc-interface/trans.c (Pragma_to_gnu): Adjust
	control_warning_option caller.
testsuite/
	* c-c++-common/pr68657-1.c: New test.
	* c-c++-common/pr68657-2.c: New test.
	* c-c++-common/pr68657-3.c: New test.
	* gcc.dg/cpp/warn-normalized-3.c: Use
	-Werror=normalized=nfc instead of -Werror=normalized=
	in dg-options.

From-SVN: r231406
2015-12-08 14:26:35 +01:00
Max Ostapenko b59e2a4903 libsanitizer merge from upstream r253555, compiler part.
gcc/

	* opts.c (finish_options): Allow -fsanitize-recover=address for
	userspace sanitization.
	* asan.c (asan_expand_check_ifn): Redefine recover_p.
	* doc/invoke.texi (fsanitize-recover): Update documentation.

gcc/testsuite/

	* c-c++-common/asan/halt_on_error-1.c: New test.
	* c-c++-common/asan/halt_on_error-2.c: Likewise.

From-SVN: r230741
2015-11-23 11:15:13 +02:00
Richard Sandiford 883cabdecd Extend tree-call-cdce to calls whose result is used
For -fmath-errno, builtins.c currently expands calls to sqrt to:

        y = sqrt_optab (x);
        if (y != y)
          [ sqrt (x); or errno = EDOM; ]

The drawbacks of this are:

- the call to sqrt is protected by the result of the optab rather
      than the input.  It would be better to check __builtin_isless (x, 0),
      like tree-call-cdce.c does.

- the branch isn't exposed at the gimple level and so gets little
      high-level optimisation.

- we do this for log too, but for log a zero input produces
      -inf rather than a NaN, and sets errno to ERANGE rather than EDOM.

This patch moves the code to tree-call-cdce.c instead, with the optab
operation being represented as an internal function.  This means that
we can use the existing argument-based range checks rather than the
result-based checks and that we get more gimple optimisation of
the branch.

Previously the pass was only enabled by default at -O2 or above,
but the old builtins.c code was enabled at -O.  The patch therefore
enables the pass at -O as well.

The previous patch to cfgexpand.c handled cases where functions
don't (or are assumed not to) set errno, so this patch makes
the builtins.c code dead.

Tested on x86_64-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabi
and visium-elf (for the EDOM stuff).

gcc/
	* builtins.c (expand_errno_check, expand_builtin_mathfn)
	(expand_builtin_mathfn_2): Delete.
	(expand_builtin): Remove handling of functions with
	internal function equivalents.
	* internal-fn.def (SET_EDOM): New internal function.
	* internal-fn.h (set_edom_supported_p): Declare.
	* internal-fn.c (expand_SET_EDOM): New function.
	(set_edom_supported_p): Likewise.
	* tree-call-cdce.c: Include builtins.h and internal-fn.h.
	Rewrite comment at head of file.
	(is_call_dce_candidate): Rename to...
	(can_test_argument_range): ...this.  Don't check gimple_call_lhs
	or gimple_call_builtin_p here.
	(edom_only_function): New function.
	(shrink_wrap_one_built_in_call_with_conds): New function, split out
	from...
	(shrink_wrap_one_built_in_call): ...here.
	(can_use_internal_fn, use_internal_fn): New functions.
	(shrink_wrap_conditional_dead_built_in_calls): Call use_internal_fn
	for calls that have an lhs.
	(pass_call_cdce::gate): Remove optimize_function_for_speed_p check.
	(pass_call_cdce::execute): Skip blocks that are optimized for size.
	Check gimple_call_builtin_p here.  Use can_use_internal_fn for
	calls with an lhs.
	* opts.c (default_options_table): Enable -ftree-builtin-call-cdce
	at -O and above.

From-SVN: r230488
2015-11-17 18:51:55 +00:00
Ajit Agarwal 8fe17e23b0 [Patch,tree-optimization]: Add new path Splitting pass on tree ssa
representation

	* Makefile.in (OBJS): Add gimple-ssa-split-paths.o
	* common.opt (-fsplit-paths): New flag controlling path splitting.
	* doc/invoke.texi (fsplit-paths): Document.
	* opts.c (default_options_table): Add -fsplit-paths to -O2.
	* passes.def: Add split_paths pass.
	* timevar.def (TV_SPLIT_PATHS): New timevar.
	* tracer.c: Include "tracer.h"
	(ignore_bb_p): No longer static.
	(transform_duplicate): New function, broken out of tail_duplicate.
	(tail_duplicate): Use transform_duplicate.
	* tracer.h (ignore_bb_p): Declare
	(transform_duplicate): Likewise.
	* tree-pass.h (make_pass_split_paths): Declare.
	* gimple-ssa-split-paths.c: New file.

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

Co-Authored-By: Jeff Law <law@redhat.com>

From-SVN: r230364
2015-11-13 16:31:51 -07:00
Martin Liska de5672fcb2 Fix big memory leak in ix86_valid_target_attribute_p
* config/i386/i386.c (ix86_valid_target_attribute_p):
	Finalize options at the of the function.
	* gcc.c (driver_get_configure_time_options): Call newly
	introduced init_opts_obstack.
	* lto-wrapper.c (main): Likewise.
	* opts.c (init_opts_obstack): New function.
	(init_options_struct): Call newly
	introduced init_opts_obstack.
	* opts.h (init_options_struct): Declare.

From-SVN: r230264
2015-11-12 15:50:05 +00:00
Martin Sebor a7b2e1845f Improve --help output to generate references to option aliases.
gcc/
	PR driver/68043
	* opts.c (undocumented_msg, use_diagnosed_msg): New globals.
	(print_filtered_help): Reference aliased option's name and encourage
	readers to use it in preference to the alias if the former is not
	documented.  Mention when using an option is diagnosed.
	* gcc.c (display_help): End each sentence with a period.

	* ada/gcc-interface/lang.opt: End each sentence that describes
	an option with a period.
	* c-family/c.opt: Same.
	* common.opt: Same.
	* config/aarch64/aarch64.opt: Same.
	* config/alpha/alpha.opt: Same.
	* config/arc/arc.opt: Same.
	* config/arm/arm.opt: Same.
	* config/avr/avr.opt: Same.
	* config/bfin/bfin.opt: Same.
	* config/c6x/c6x.opt: Same.
	* config/cr16/cr16.opt: Same.
	* config/cris/cris.opt: Same.
	* config/cris/linux.opt: Same.
	* config/darwin.opt: Same.
	* config/epiphany/epiphany.opt: Same.
	* config/fr30/fr30.opt: Same.
	* config/frv/frv.opt: Same.
	* config/ft32/ft32.opt: Same.
	* config/g.opt: Same.
	* config/h8300/h8300.opt: Same.
	* config/i386/cygming.opt: Same.
	* config/i386/djgpp.opt: Same.
	* config/i386/i386.opt: Same.
	* config/i386/interix.opt: Same.
	* config/i386/mingw-w64.opt: Same.
	* config/i386/mingw.opt: Same.
	* config/ia64/ia64.opt: Same.
	* config/ia64/ilp32.opt: Same.
	* config/iq2000/iq2000.opt: Same.
	* config/linux.opt: Same.
	* config/lm32/lm32.opt: Same.
	* config/lynx.opt: Same.
	* config/m32c/m32c.opt: Same.
	* config/m32r/m32r.opt: Same.
	* config/m68k/ieee.opt: Same.
	* config/m68k/m68k.opt: Same.
	* config/mcore/mcore.opt: Same.
	* config/mep/mep.opt: Same.
	* config/microblaze/microblaze.opt: Same.
	* config/mips/mips.opt: Same.
	* config/mmix/mmix.opt: Same.
	* config/mn10300/mn10300.opt: Same.
	* config/moxie/moxie.opt: Same.
	* config/msp430/msp430.opt: Same.
	* config/nios2/elf.opt: Same.
	* config/nios2/nios2.opt: Same.
	* config/nvptx/nvptx.opt: Same.
	* config/pa/pa-hpux.opt: Same.
	* config/pa/pa-hpux1010.opt: Same.
	* config/pa/pa-hpux1111.opt: Same.
	* config/pa/pa-hpux1131.opt: Same.
	* config/pa/pa.opt: Same.
	* config/pa/pa64-hpux.opt: Same.
	* config/pdp11/pdp11.opt: Same.
	* config/rl78/rl78.opt: Same.
	* config/rs6000/476.opt: Same.
	* config/rs6000/aix64.opt: Same.
	* config/rs6000/darwin.opt: Same.
	* config/rs6000/linux64.opt: Same.
	* config/rs6000/rs6000.opt: Same.
	* config/rs6000/sysv4.opt: Same.
	* config/s390/s390.opt: Same.
	* config/s390/tpf.opt: Same.
	* config/sh/sh.opt: Same.
	* config/sol2.opt: Same.
	* config/sparc/long-double-switch.opt: Same.
	* config/sparc/sparc.opt: Same.
	* config/spu/spu.opt: Same.
	* config/stormy16/stormy16.opt: Same.
	* config/tilegx/tilegx.opt: Same.
	* config/tilepro/tilepro.opt: Same.
	* config/v850/v850.opt: Same.
	* config/vax/vax.opt: Same.
	* config/visium/visium.opt: Same.
	* config/vms/vms.opt: Same.
	* config/vxworks.opt: Same.
	* config/xtensa/xtensa.opt: Same.
	* fortran/lang.opt: Same.

testsuite/
	PR driver/68043
	* gcc.misc-tests/help.exp: Adjust.
	* lib/options.exp (check_for_options): Add detail to output.

From-SVN: r229155
2015-10-21 16:24:41 -06:00
Trevor Saunders e90bedf52c unconditionally compile most of the delay slot code
gcc/ChangeLog:

2015-10-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* cfgrtl.c (pass_free_cfg::execute): Adjust.
	* final.c (dbr_sequence_length): Always define.
	(shorten_branches): Adjust.
	* genattr-common.c (main): Always define DELAY_SLOTS.
	* genattr.c (main): Unconditionally declare functions and define
	macros related to delay slots.
	* genattrtab.c (write_eligible_delay): Adjust.
	(main): Always write out delay slot functions.
	* opts.c (default_options_table): Adjust.
	* reorg.c (redirect_with_delay_slots_safe_p): Likewise.
	(redirect_with_delay_list_safe_p): Likewise.
	(fill_simple_delay_slots): Likewise.
	(fill_slots_from_thread): Likewise.
	(make_return_insns): Likewise.
	(dbr_schedule): Likewise.
	(rest_of_handle_delay_slots): Likewise.
	(pass_delay_slots::gate): Likewise.
	* toplev.c (process_options): Likewise.

From-SVN: r229145
2015-10-21 21:05:02 +00:00
Tom de Vries d78182cc0c Support DEFPARAMENUM in params.def
2015-10-13  Tom de Vries  <tom@codesourcery.com>

	* Makefile.in (PARAMS_H, PLUGIN_HEADERS): Add params-enum.h.
	* params-enum.h: New file.
	* opts.c (handle_param): Handle case that param arg is a string.
	* params-list.h: Handle DEFPARAMENUM5 in params.def.
	* params.c (find_param): New function, factored out of ...
	(set_param_value): ... here.
	(param_string_value_p): New function.
	* params.h (struct param_info): Add value_names field.
	(find_param, param_string_value_p): Declare.

From-SVN: r228755
2015-10-13 10:08:50 +00:00
Segher Boessenkool 59faab7cc4 bb-reorder: Add -freorder-blocks-algorithm= and wire it up
This adds an -freorder-blocks-algorithm=[simple|stc] flag, with "simple"
as default.  For -O2 and up (except -Os) it is switched to "stc" instead.
Targets that never want STC can override this.  This changes -freorder-blocks
to be on at -O1 and up (was -O2 and up).

In effect, the changes are for -O1 (which now gets "simple" instead of
nothing), -Os (which now gets "simple" instead of "stc", since STC results
in much bigger code), and for targets that wish to never use STC (not in
this patch though).


2015-09-23   Segher Boessenkool  <segher@kernel.crashing.org>

	* bb-reorder.c (reorder_basic_blocks): Use the algorithm selected
	with flag_reorder_blocks_algorithm.
	* common.opt (freorder-blocks-algorithm=): New flag.
	(reorder_blocks_algorithm): New enum.
	* flag-types.h (reorder_blocks_algorithm): New enum.
	* opts.c (default_options_table): Use -freorder-blocks at -O1 and up,
	and -freorder-blocks-algorithm=stc at -O2 and up (not at -Os).

From-SVN: r228318
2015-10-01 08:38:24 +02:00
Teresa Johnson 6697104844 This patch unsets -freorder-blocks-and-partition when -fprofile-use is not specified.
This patch unsets -freorder-blocks-and-partition when -fprofile-use
is not specified. Function splitting was not actually being performed
in that case, as probably_never_executed_bb_p does not distinguish
any basic blocks as being cold vs hot when there is no profile data.
Leaving it enabled, however, causes the assembly code generator to create
(empty) cold sections and labels, leading to unnecessary size overhead.

2015-09-25  Teresa Johnson  <tejohnson@google.com>

	* opts.c (finish_options): Unset -freorder-blocks-and-partition
	if not using profile.

From-SVN: r228136
2015-09-25 16:53:40 +00:00
Manuel López-Ibáñez 3563212292 fdiagnostics-color=never does not disable color for some diagnostics
Actually, I was trying to reject non-warning options as argument to
-Werror=. However, the new test fails because -fdiagnostics-color=never is
always placed by the driver after the warning options when calling the compiler
proper. This patch prunes all -fdiagnostics-color from the command-line but the
last one, which is moved to the first position.

gcc/ChangeLog:

2015-09-24  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/67640
	* opts-common.c (prune_options): Discard all -fdiagnostics-color
	but the last one, which is moved to the front to be processed
	first.
	* opts.c (enable_warning_as_error): Reject options that do not
	control warnings.

gcc/testsuite/ChangeLog:

2015-09-24  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/67640
	* gcc.dg/Werror-13.c: New test.

From-SVN: r228094
2015-09-24 16:37:43 +00:00
Magnus Granberg e0f6cba004 common.opt (fstack-protector): Initialize to -1.
* common.opt (fstack-protector): Initialize to -1.
        (fstack-protector-all): Likewise.
        (fstack-protector-strong): Likewise.
        (fstack-protector-explicit): Likewise.
        * configure.ac: Add --enable-default-ssp.
        * defaults.h (DEFAULT_FLAG_SSP): New.  Default SSP to strong.
        * opts.c (finish_options): Update opts->x_flag_stack_protect if it is
        -1.
        * doc/install.texi: Document --enable-default-ssp.
        * config.in: Regenerated.
        * configure: Likewise.

        * lib/target-supports.exp
        (check_effective_target_fstack_protector_enabled): New test.
        * gcc.target/i386/ssp-default.c: New test.

From-SVN: r227017
2015-08-19 16:07:06 -06:00
Alexandre Oliva 1f9ceff111 [PR64164] Drop copyrename, use coalescible partition as base when optimizing.
for  gcc/ChangeLog

	PR rtl-optimization/64164
	PR bootstrap/66978
	PR middle-end/66983
	PR rtl-optimization/67000
	PR middle-end/67034
	PR middle-end/67035
	* Makefile.in (OBJS): Drop tree-ssa-copyrename.o.
	* tree-ssa-copyrename.c: Removed.
	* opts.c (default_options_table): Drop -ftree-copyrename.  Add
	-ftree-coalesce-vars.
	* passes.def: Drop all occurrences of pass_rename_ssa_copies.
	* common.opt (ftree-copyrename): Ignore.
	(ftree-coalesce-inlined-vars): Likewise.
	* doc/invoke.texi: Remove the ignored options above.
	* gimple-expr.h (gimple_can_coalesce_p): Move declaration
	* tree-ssa-coalesce.h: ... here.
	* tree-ssa-uncprop.c: Include tree-ssa-coalesce.h and other
	headers required by it.
	* gimple-expr.c (gimple_can_coalesce_p): Allow coalescing
	across variables when flag_tree_coalesce_vars.  Check register
	use and promoted modes to allow coalescing.  Do not coalesce
	maybe-byref parms with SSA_NAMEs of other variables, or
	anonymous SSA_NAMEs.  Moved to tree-ssa-coalesce.c.
	* tree-ssa-live.c (struct tree_int_map_hasher): Move along
	with its member functions to tree-ssa-coalesce.c.
	(var_map_base_init): Likewise.  Renamed to
	compute_samebase_partition_bases.
	(partition_view_normal): Drop want_bases parameter.
	(partition_view_bitmap): Likewise.
	* tree-ssa-live.h: Adjust declarations.
	* tree-ssa-coalesce.c: Include explow.h and cfgexpand.h.
	(build_ssa_conflict_graph): Process PARM_ and RESULT_DECLs's
	default defs at the entry point.
	(dump_part_var_map): New.
	(compute_optimized_partition_bases): New, called by...
	(coalesce_ssa_name): ... when flag_tree_coalesce_vars, instead
	of compute_samebase_partition_bases.  Adjust.
	* alias.c (nonoverlapping_memrefs_p): Disregard gimple-regs.
	* cfgexpand.c (leader_merge, parm_maybe_byref_p): New.
	(ssa_default_def_partition): New.
	(get_rtl_for_parm_ssa_default_def): New.
	(align_local_variable, add_stack_var): Support anonymous SSA
	names.
	(defer_stack_allocation): Likewise.  Declare earlier.
	(set_rtl): Merge exprs and attrs, even for MEMs and non-SSA
	vars.  Update DECL_RTL for PARM_DECLs and RESULT_DECLs too.
	Do no record deferred-allocation marker in
	SA.partition_to_pseudo.
	(expand_stack_vars): Adjust check for the marker in it.
	(expand_one_stack_var_at): Handle anonymous SSA_NAMEs.  Drop
	redundant MEM attr setting.
	(expand_one_stack_var_1): Handle anonymous SSA_NAMEs.  Renamed
	from...
	(expand_one_stack_var): ... this.  New wrapper to check and
	skip already expanded SSA partitions.
	(record_alignment_for_reg_var): New, factored out of...
	(expand_one_var): ... this.
	(expand_one_ssa_partition): New.
	(adjust_one_expanded_partition_var): New.
	(expand_one_register_var): Check and skip already expanded SSA
	partitions.
	(expand_used_vars): Don't create DECLs for anonymous SSA
	names.  Expand all SSA partitions, then adjust all SSA names.
	(pass::execute): Replace the loops that set
	SA.partition_to_pseudo from partition leaders and cleared
	DECL_RTL for multi-location variables, and that which used to
	rename vars and set attrs, with one that clears DECL_RTL and
	checks that PARMs and RESULTs default_defs match DECL_RTL.
	* cfgexpand.h (get_rtl_for_parm_ssa_default_def): Declare.
	* emit-rtl.c: Include stor-layout.h.
	(set_reg_attrs_for_parm): Handle NULL decl.
	(set_reg_attrs_for_decl_rtl): Take mode from expression if
	it's not a DECL.
	* stmt.c (emit_case_decision_tree): Pass it the SSA_NAME
	rather than its possibly-NULL DECL.
	* explow.c (promote_ssa_mode): New.
	* explow.h (promote_ssa_mode): Declare.
	* expr.c (expand_expr_real_1): Handle anonymous SSA_NAMEs.
	(read_complex_part): Export.
	* expr.h (read_complex_part): Declare.
	* cfgexpand.h (parm_maybe_byref_p): Declare.
	* function.c: Include cfgexpand.h.
	(use_register_for_decl): Handle SSA_NAMEs, anonymous or not.
	(use_register_for_parm_decl): Wrapper for the above to
	special-case the result_ptr.
	(rtl_for_parm): Ditto for get_rtl_for_parm_ssa_default_def.
	(split_complex_args): Take assign_parm_data_all argument.
	Pass it to rtl_for_parm.  Set up rtl and context for split
	args.  Reset complex parm before fetching its default decl
	rtl.
	(assign_parms_unsplit_complex): Use the default-def complex
	parm rtl if it matches the components.
	(assign_parms_augmented_arg_list): Adjust.
	(maybe_reset_rtl_for_parm): Reset DECL_RTL of parms with
	multiple locations.  Recognize split complex args.
	(assign_parm_adjust_stack_rtl): Add all and parm arguments,
	for rtl_for_parm.  For SSA-assigned parms, zero stack_parm.
	(assign_parm_setup_block): Prefer SSA-assigned location, and
	fill in its address if the memory location of a maybe-byref
	parm was not assigned by cfgexpand.
	(assign_parm_setup_reg): Likewise.  Adjust its mode as
	needed.  Use entry_parm for equiv if stack_parm is NULL.  Make
	sure passed_pointer parms don't need conversion.  Copy address
	or value as needed.
	(assign_parm_setup_stack): Prefer SSA-assigned location.
	(assign_parms): Maybe reset DECL_RTL of params.  Adjust stack
	rtl before testing for pointer bounds.  Special-case result_ptr.
	(expand_function_start): Maybe reset DECL_RTL of result.
	Prefer SSA-assigned location for result and static chain.
	Factor out DECL_RESULT and SET_DECL_RTL.  Convert static chain
	to Pmode if needed, from H.J. Lu  <hongjiu.lu@intel.com>.
	* tree-outof-ssa.c (insert_value_copy_on_edge): Handle
	anonymous SSA names.  Use promote_ssa_mode.
	(get_temp_reg): Likewise.
	(remove_ssa_form): Adjust.
	* stor-layout.c (layout_decl): Don't set mem attributes of
	non-MEMs.
	* var-tracking.c (dataflow_set_clear_at_call): Take call_insn
	and get its reg_usage for reg invalidation.
	(compute_bb_dataflow): Pass it insn.
	(emit_notes_in_bb): Likewise.

for  gcc/testsuite/ChangeLog

	* gcc.dg/guality/pr54200.c: Add -fno-tree-coalesce-vars.
	* gcc.dg/ssp-1.c: Make counter a register.
	* gcc.dg/ssp-2.c: Likewise.
	* gcc.dg/torture/parm-coalesce.c: New.

From-SVN: r226901
2015-08-14 18:51:50 +00:00
Thomas Schwinge c9665100d6 Add DWARF2_LINENO_DEBUGGING_INFO, and use it for nvptx
gcc/
	* config/nvptx/nvptx.c (nvptx_option_override): Don't override
	debug options.
	* config/nvptx/nvptx.h (DWARF2_LINENO_DEBUGGING_INFO): Define.
	(DWARF2_DEBUGGING_INFO): Don't define.
	* debug.h (dwarf2_lineno_debug_hooks): Declare.
	* toplev.c (process_options): Add a case for it.
	* dwarf2out.c (dwarf2_lineno_debug_hooks): New variable.
	(dwarf2out_init): Skip most initializations if
	DWARF2_LINENO_DEBUGGING_INFO, but set cur_line_info_table in that
	case.
	* defaults.h (PREFERRED_DEBUGGING_TYPE): Also use DWARF2_DEBUG if
	DWARF2_LINENO_DEBUGGING_INFO.
	* opts.c (set_debug_level): Likewise.

Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>

From-SVN: r226890
2015-08-14 12:37:14 +02:00
David Edelsohn 64d7fb90be Revert:
2015-07-23  Alexandre Oliva <aoliva@redhat.com>

From-SVN: r226202
2015-07-24 21:28:21 -04:00
Alexandre Oliva 7eb9f42e3b [PR64164] Drop copyrename, use coalescible partition as base when optimizing.
for  gcc/ChangeLog

	PR rtl-optimization/64164
	* Makefile.in (OBJS): Drop tree-ssa-copyrename.o.
	* tree-ssa-copyrename.c: Removed.
	* opts.c (default_options_table): Drop -ftree-copyrename.  Add
	-ftree-coalesce-vars.
	* passes.def: Drop all occurrences of pass_rename_ssa_copies.
	* common.opt (ftree-copyrename): Ignore.
	(ftree-coalesce-inlined-vars): Likewise.
	* doc/invoke.texi: Remove the ignored options above.
	* gimple-expr.h (gimple_can_coalesce_p): Move declaration
	* tree-ssa-coalesce.h: ... here.
	* tree-ssa-uncprop.c: Include tree-ssa-coalesce.h and other
	headers required by it.
	* gimple-expr.c (gimple_can_coalesce_p): Allow coalescing
	across variables when flag_tree_coalesce_vars.  Check register
	use and promoted modes to allow coalescing.  Moved to
	tree-ssa-coalesce.c.
	* tree-ssa-live.c (struct tree_int_map_hasher): Move along
	with its member functions to tree-ssa-coalesce.c.
	(var_map_base_init): Likewise.  Renamed to
	compute_samebase_partition_bases.
	(partition_view_normal): Drop want_bases parameter.
	(partition_view_bitmap): Likewise.
	* tree-ssa-live.h: Adjust declarations.
	* tree-ssa-coalesce.c: Include explow.h.
	(build_ssa_conflict_graph): Process PARM_ and RESULT_DECLs's
	default defs at the entry point.
	(dump_part_var_map): New.
	(compute_optimized_partition_bases): New, called by...
	(coalesce_ssa_name): ... when flag_tree_coalesce_vars, instead
	of compute_samebase_partition_bases.  Adjust.
	* alias.c (nonoverlapping_memrefs_p): Disregard gimple-regs.
	* cfgexpand.c (leader_merge): New.
	(get_rtl_for_parm_ssa_default_def): New.
	(set_rtl): Merge exprs and attrs, even for MEMs and non-SSA
	vars.  Update DECL_RTL for PARM_DECLs and RESULT_DECLs too.
	(expand_one_stack_var_at): Handle anonymous SSA_NAMEs.  Drop
	redundant MEM attr setting.
	(expand_one_stack_var_1): Handle anonymous SSA_NAMEs.  Renamed
	from...
	(expand_one_stack_var): ... this.  New wrapper to check and
	skip already expanded SSA partitions.
	(record_alignment_for_reg_var): New, factored out of...
	(expand_one_var): ... this.
	(expand_one_ssa_partition): New.
	(adjust_one_expanded_partition_var): New.
	(expand_one_register_var): Check and skip already expanded SSA
	partitions.
	(expand_used_vars): Don't create DECLs for anonymous SSA
	names.  Expand all SSA partitions, then adjust all SSA names.
	(pass::execute): Replace the loops that set
	SA.partition_to_pseudo from partition leaders and cleared
	DECL_RTL for multi-location variables, and that which used to
	rename vars and set attrs, with one that clears DECL_RTL and
	checks that PARMs and RESULTs default_defs match DECL_RTL.
	* cfgexpand.h (get_rtl_for_parm_ssa_default_def): Declare.
	* emit-rtl.c (set_reg_attrs_for_parm): Handle NULL decl.
	* explow.c (promote_ssa_mode): New.
	* explow.h (promote_ssa_mode): Declare.
	* expr.c (expand_expr_real_1): Handle anonymous SSA_NAMEs.
	* function.c: Include cfgexpand.h.
	(use_register_for_decl): Handle SSA_NAMEs, anonymous or not.
	(use_register_for_parm_decl): Wrapper for the above to
	special-case the result_ptr.
	(rtl_for_parm): Ditto for get_rtl_for_parm_ssa_default_def.
	(split_complex_args): Take assign_parm_data_all argument.
	Pass it to rtl_for_parm.  Set up rtl and context for split
	args.
	(assign_parms_augmented_arg_list): Adjust.
	(maybe_reset_rtl_for_parm): Reset DECL_RTL of parms with
	multiple locations.  Recognize split complex args.
	(assign_parm_adjust_stack_rtl): Add all and parm arguments,
	for rtl_for_parm.  For SSA-assigned parms, zero stack_parm.
	(assign_parm_setup_block): Prefer SSA-assigned location.
	(assign_parm_setup_reg): Likewise.  Use entry_parm for equiv
	if stack_parm is NULL.
	(assign_parm_setup_stack): Prefer SSA-assigned location.
	(assign_parms): Maybe reset DECL_RTL of params.  Adjust stack
	rtl before testing for pointer bounds.  Special-case result_ptr.
	(expand_function_start): Maybe reset DECL_RTL of result.
	Prefer SSA-assigned location for result and static chain.
	Factor out DECL_RESULT and SET_DECL_RTL.
	* tree-outof-ssa.c (insert_value_copy_on_edge): Handle
	anonymous SSA names.  Use promote_ssa_mode.
	(get_temp_reg): Likewise.
	(remove_ssa_form): Adjust.
	* stor-layout.c (layout_decl): Don't set mem attributes of
	non-MEMs.
	* var-tracking.c (dataflow_set_clear_at_call): Take call_insn
	and get its reg_usage for reg invalidation.
	(compute_bb_dataflow): Pass it insn.
	(emit_notes_in_bb): Likewise.

for  gcc/testsuite/ChangeLog

	* gcc.dg/guality/pr54200.c: Add -fno-tree-coalesce-vars.
	* gcc.dg/ssp-1.c: Make counter a register.
	* gcc.dg/ssp-2.c: Likewise.
	* gcc.dg/torture/parm-coalesce.c: New.

From-SVN: r226113
2015-07-23 15:34:49 +00:00
Andrew MacLeod 903f5c23c8 opth-gen.awk: Check for UNKNOWN_LOCATION rather than GCC_TM_H, don't include input.h.
2015-07-15  Andrew MacLeod  <amacleod@redhat.com>

	* opth-gen.awk: Check for UNKNOWN_LOCATION rather than GCC_TM_H, don't
	include input.h.
	* opts.c: Remove multiline #include comment.


2015-07-15  Andrew MacLeod  <amacleod@redhat.com>

	* java/expr.c: Remove multiline #include comment.


2015-07-15  Andrew MacLeod  <amacleod@redhat.com>

	* fortran/trans-types.c: Remove multiline #include comment.


2015-07-15  Andrew MacLeod  <amacleod@redhat.com>

	* c-family/c-opts.c: Remove multiline #include comment.

From-SVN: r225846
2015-07-15 19:50:23 +00:00
Alexandre Oliva 0f9f9784ad Revert "[PR64164] Drop copyrename, use coalescible partition as base when optimizing."
This reverts commit c66acc7cedd89bfd22124caec44b8427c9082dac.

Conflicts:
	gcc/ChangeLog
	gcc/testsuite/ChangeLog

From-SVN: r224310
2015-06-10 00:37:39 +00:00
Alexandre Oliva 7b337d2061 [PR64164] Drop copyrename, use coalescible partition as base when optimizing.
for  gcc/ChangeLog

	PR rtl-optimization/64164
	* Makefile.in (OBJS): Drop tree-ssa-copyrename.o.
	* tree-ssa-copyrename.c: Removed.
	* opts.c (default_options_table): Drop -ftree-copyrename.  Add
	-ftree-coalesce-vars.
	* passes.def: Drop all occurrences of pass_rename_ssa_copies.
	* common.opt (ftree-copyrename): Ignore.
	(ftree-coalesce-inlined-vars): Likewise.
	* doc/invoke.texi: Remove the ignored options above.
	* gimple-expr.h (gimple_can_coalesce_p): Move declaration
	* tree-ssa-coalesce.h: ... here.
	* tree-ssa-uncprop.c: Include tree-ssa-coalesce.h and other
	headers required by it.
	* gimple-expr.c (gimple_can_coalesce_p): Allow coalescing
	across variables when flag_tree_coalesce_vars.  Check register
	use and promoted modes to allow coalescing.  Moved to
	tree-ssa-coalesce.c.
	* tree-ssa-live.c (struct tree_int_map_hasher): Move along
	with its member functions to tree-ssa-coalesce.c.
	(var_map_base_init): Likewise.  Renamed to
	compute_samebase_partition_bases.
	(partition_view_normal): Drop want_bases parameter.
	(partition_view_bitmap): Likewise.
	* tree-ssa-live.h: Adjust declarations.
	* tree-ssa-coalesce.c: Include explow.h.
	(build_ssa_conflict_graph): Process PARM_ and RESULT_DECLs's
	default defs at the entry point.
	(dump_part_var_map): New.
	(compute_optimized_partition_bases): New, called by...
	(coalesce_ssa_name): ... when flag_tree_coalesce_vars, instead
	of compute_samebase_partition_bases.  Adjust.
	* alias.c (nonoverlapping_memrefs_p): Disregard gimple-regs.
	* cfgexpand.c (leader_merge): New.
	(get_rtl_for_parm_ssa_default_def): New.
	(set_rtl): Merge exprs and attrs, even for MEMs and non-SSA
	vars.  Update DECL_RTL for PARM_DECLs and RESULT_DECLs too.
	(expand_one_stack_var_at): Handle anonymous SSA_NAMEs.  Drop
	redundant MEM attr setting.
	(expand_one_stack_var_1): Handle anonymous SSA_NAMEs.  Renamed
	from...
	(expand_one_stack_var): ... this.  New wrapper to check and
	skip already expanded SSA partitions.
	(record_alignment_for_reg_var): New, factored out of...
	(expand_one_var): ... this.
	(expand_one_ssa_partition): New.
	(adjust_one_expanded_partition_var): New.
	(expand_one_register_var): Check and skip already expanded SSA
	partitions.
	(expand_used_vars): Don't create DECLs for anonymous SSA
	names.  Expand all SSA partitions, then adjust all SSA names.
	(pass::execute): Replace the loops that set
	SA.partition_to_pseudo from partition leaders and cleared
	DECL_RTL for multi-location variables, and that which used to
	rename vars and set attrs, with one that clears DECL_RTL and
	checks that PARMs and RESULTs default_defs match DECL_RTL.
	* cfgexpand.h (get_rtl_for_parm_ssa_default_def): Declare.
	* emit-rtl.c (set_reg_attrs_for_parm): Handle NULL decl.
	* explow.c (promote_ssa_mode): New.
	* explow.h (promote_ssa_mode): Declare.
	* expr.c (expand_expr_real_1): Handle anonymous SSA_NAMEs.
	* function.c: Include cfgexpand.h.
	(use_register_for_decl): Handle SSA_NAMEs, anonymous or not.
	(use_register_for_parm_decl): Wrapper for the above to
	special-case the result_ptr.
	(rtl_for_parm): Ditto for get_rtl_for_parm_ssa_default_def.
	(maybe_reset_rtl_for_parm): Reset DECL_RTL of parms with
	multiple locations.
	(assign_parm_adjust_stack_rtl): Add all and parm arguments,
	for rtl_for_parm.  For SSA-assigned parms, zero stack_parm.
	(assign_parm_setup_block): Prefer SSA-assigned location.
	(assign_parm_setup_reg): Likewise.  Use entry_parm for equiv
	if stack_parm is NULL.
	(assign_parm_setup_stack): Prefer SSA-assigned location.
	(assign_parms): Maybe reset DECL_RTL of params.  Adjust stack
	rtl before testing for pointer bounds.  Special-case result_ptr.
	(expand_function_start): Maybe reset DECL_RTL of result.
	Prefer SSA-assigned location for result and static chain.
	Factor out DECL_RESULT and SET_DECL_RTL.
	* tree-outof-ssa.c (insert_value_copy_on_edge): Handle
	anonymous SSA names.  Use promote_ssa_mode.
	(get_temp_reg): Likewise.
	(remove_ssa_form): Adjust.
	* var-tracking.c (dataflow_set_clear_at_call): Take call_insn
	and get its reg_usage for reg invalidation.
	(compute_bb_dataflow): Pass it insn.
	(emit_notes_in_bb): Likewise.
	* tree-ssa-loop-niter.c (loop_exits_before_overflow): Don't
	fail assert on conversion between unsigned types.

for  gcc/testsuite/ChangeLog

	* gcc.dg/guality/pr54200.c: Add -fno-tree-coalesce-vars.
	* gcc.dg/ssp-1.c: Make counter a register.
	* gcc.dg/ssp-2.c: Likewise.
	* gcc.dg/torture/parm-coalesce.c: New.

From-SVN: r224262
2015-06-09 05:05:34 +00:00
H.J. Lu 428b381275 Add --enable-default-pie option to GCC configure
Add --enable-default-pie option to configure GCC to generate PIE by
default.

gcc/

	* Makefile.in (COMPILER): Add @NO_PIE_CFLAGS@.
	(BUILD_CFLAGS): Likewise.
	(BUILD_CXXFLAGS): Likewise.
	(LINKER): Add @NO_PIE_FLAG@.
	(BUILD_LDFLAGS): Likewise.
	(libgcc.mvars): Set NO_PIE_CFLAGS to -fno-PIE for
	--enable-default-pie.
	* common.opt (fPIE): Initialize to -1.
	(fpie): Likewise.
	(no-pie): New option.
	(pie): Replace "Negative(shared)" with "Negative(no-pie)".
	* configure.ac: Add --enable-default-pie.
	(NO_PIE_CFLAGS): New.  Check if -fno-PIE works.  AC_SUBST.
	(NO_PIE_FLAG): New.  Check if -no-pie works.  AC_SUBST.
	* defaults.h (DEFAULT_FLAG_PIE): New.  Default PIE to -fPIE.
	* gcc.c (NO_PIE_SPEC): New.
	(PIE_SPEC): Likewise.
	(NO_FPIE1_SPEC): Likewise.
	(FPIE1_SPEC): Likewise.
	(NO_FPIE2_SPEC): Likewise.
	(FPIE2_SPEC): Likewise.
	(NO_FPIE2_SPEC): Likewise.
	(FPIE_SPEC): Likewise.
	(NO_FPIE_SPEC): Likewise.
	(NO_FPIC1_SPEC): Likewise.
	(FPIC1_SPEC): Likewise.
	(NO_FPIC2_SPEC): Likewise.
	(FPIC2_SPEC): Likewise.
	(NO_FPIC2_SPEC): Likewise.
	(FPIC_SPEC): Likewise.
	(NO_FPIC_SPEC): Likewise.
	(NO_FPIE1_AND_FPIC1_SPEC): Likewise.
	(FPIE1_OR_FPIC1_SPEC): Likewise.
	(NO_FPIE2_AND_FPIC2_SPEC): Likewise.
	(FPIE2_OR_FPIC2_SPEC): Likewise.
	(NO_FPIE_AND_FPIC_SPEC): Likewise.
	(FPIE_OR_FPIC_SPEC): Likewise.
	(LD_PIE_SPEC): Likewise.
	(LINK_PIE_SPEC): Handle -no-pie.  Use PIE_SPEC and LD_PIE_SPEC.
	* opts.c (finish_options): Update opts->x_flag_pie if it is -1.
	* config/darwin.h (PIE_SPEC): Renamed to ...
	(DARWIN_PIE_SPEC): This.
	(LINK_SPEC): Replace PIE_SPEC with DARWIN_PIE_SPEC.
	* config/darwin9.h (PIE_SPEC): Renamed to ...
	(DARWIN_PIE_SPEC): This.
	* config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Use
	PIE_SPEC and NO_PIE_SPEC if HAVE_LD_PIE is defined.
	* config/openbsd.h (ASM_SPEC): Use FPIE1_OR_FPIC1_SPEC and
	FPIE2_OR_FPIC2_SPEC.
	* config/m68k/netbsd-elf.h (ASM_SPEC): Likewise.
	* config/m68k/openbsd.h (ASM_SPEC): Likewise.
	* gcc/config/sol2.h (ASM_PIC_SPEC): Likewise.
	* config/arm/freebsd.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise.
	* config/arm/netbsd-elf.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise.
	* config/arm/semi.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise.
	* config/cris/linux.h (CRIS_ASM_SUBTARGET_SPEC): Likewise.
	* config/m32r/m32r.h (ASM_SPEC): Likewise.
	* config/m68k/uclinux.h (DRIVER_SELF_SPECS): Likewise.
	* config/rs6000/linux64.h (ASM_SPEC32): Likewise.
	* config/rs6000/sysv4.h (ASM_SPEC): Likewise.
	* config/sparc/freebsd.h (ASM_SPEC): Likewise.
	* config/sparc/linux.h (ASM_SPEC): Likewise.
	* config/sparc/linux64.h (ASM_SPEC): Likewise.
	* config/sparc/netbsd-elf.h (ASM_SPEC): Likewise.
	* config/sparc/openbsd64.h (ASM_SPEC): Likewise.
	* config/sparc/sp-elf.h (ASM_SPEC): Likewise.
	* config/sparc/sp64-elf.h (ASM_SPEC): Likewise.
	* config/sparc/sparc.h (ASM_SPEC): Likewise.
	* config/sparc/sysv4.h (ASM_SPEC): Likewise.
	* config/sparc/vxworks.h (ASM_SPEC): Likewise.
	* config/c6x/elf-common.h (ASM_SPEC): Use NO_FPIC2_SPEC,
	FPIC2_SPEC, FPIC1_SPEC and FPIC2_SPEC.
	* config/c6x/uclinux-elf.h (LINK_SPEC): Use FPIE_SPEC.
	* config/frv/frv.h (DRIVER_SELF_SPECS): Use FPIC_SPEC,
	NO_FPIC_SPEC and NO_FPIE1_AND_FPIC1_SPEC.
	(ASM_SPEC): Use FPIE1_OR_FPIC1_SPEC and FPIE2_OR_FPIC2_SPEC.
	* config/m68k/m68k.h (ASM_PCREL_SPEC): Use FPIC_SPEC and
	NO_FPIC_SPEC.
	* config/mips/gnu-user.h (NO_SHARED_SPECS): Use
	NO_FPIE_AND_FPIC_SPEC.
	* config/mips/vxworks.h (SUBTARGET_ASM_SPEC): Use FPIC_SPEC.
	* config/rs6000/freebsd64.h (ASM_SPEC32): Likewise.
	* config/rs6000/vxworks.h (ASM_SPEC): Likewise.
	* config/vax/linux.h (ASM_SPEC): Likewise.
	* doc/install.texi: Document --enable-default-pie.
	* doc/invoke.texi: Document -no-pie.
	* config.in: Regenerated.
	* configure: Likewise.

gcc/ada/

	* gcc-interface/Makefile.in (TOOLS_LIBS): Add @NO_PIE_FLAG@.

libgcc/

	* Makefile.in (CRTSTUFF_CFLAGS): Add $(NO_PIE_CFLAGS).

From-SVN: r223796
2015-05-27 19:36:55 -07:00
Martin Liska 68d070ac6a dbgcnt: enhance behavior.
* dbgcnt.def: Sort counters.
	* opts.c (common_handle_option): Do not compile if
	-fdbg-cnt-list is enabled.

From-SVN: r223287
2015-05-18 09:03:28 +00:00
Marek Polacek e0f0d3b9d2 c-ubsan.c (ubsan_instrument_bounds): Don't skip instrumenting flexible member array-like members if...
* c-ubsan.c (ubsan_instrument_bounds): Don't skip instrumenting
	flexible member array-like members if SANITIZE_BOUNDS_STRICT.

	* doc/invoke.texi: Document -fsanitize=bounds-strict.
	* flag-types.h (enum sanitize_code): Add SANITIZE_BOUNDS_STRICT, or it
	into SANITIZE_NONDEFAULT.
	* opts.c (common_handle_option): Handle -fsanitize=bounds-strict.

	* c-c++-common/ubsan/bounds-10.c: New test.

From-SVN: r222871
2015-05-07 08:08:57 +00:00
David Malcolm 6f3d1a5e66 Fix spurious semicolons
gcc/ChangeLog:
	* builtins.c (fold_builtin_1): Remove spurious second
	semicolon.
	* cgraph.h (symtab_node::get_availability): Likewise.
	* opts.c (common_handle_option): Remove spurious second semicolon.
	* tree-ssa-loop-ivopts.c (extract_cond_operands): Likewise.
	* tree-ssa-loop-niter.c (derive_constant_upper_bound_ops): Likewise.

gcc/cp/ChangeLog:
	* cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove spurious
	trailing semicolon.

gcc/fortran/ChangeLog:
	* options.c (gfc_init_options): Remove spurious second
	semicolon.
	* trans-stmt.c (gfc_trans_allocate): Likewise.

From-SVN: r222658
2015-04-30 21:07:45 +00:00
H.J. Lu 3c99176a7f Add -fipa-cp-alignment
This patch adds -fipa-cp-alignment to provide a way to enable/disable
alignment discovery and propagation in IPA-CP.

gcc/

	* common.opt (fipa-cp-alignment): New.
	* ipa-cp.c (ipcp_store_alignment_results): Check
	flag_ipa_cp_alignment.
	* opts.c (default_options_table): Enable -fipa-cp-alignment for
	-O2.
	(enable_fdo_optimizations): Set x_flag_ipa_cp_alignment.
	* doc/invoke.texi: Document -fipa-cp-alignment.

gcc/testsuite/

	* gcc.dg/ipa/propalign-3.c: New test.

From-SVN: r220773
2015-02-17 13:25:56 -08:00
David Howells 81018dcf98 tree-sra.c (dump_dereferences_table): Avoid -Wformat-security warning.
* tree-sra.c (dump_dereferences_table): Avoid -Wformat-security
	warning.
	* tree-ssa-uninit.c (dump_predicates): Likewise.
	* opts.c (print_filtered_help): Likewise.

From-SVN: r220662
2015-02-12 22:29:21 +01:00
Joseph Myers 40fecdd62f Always pass explicit location to fatal_error.
The patch <https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00698.html>
adding an overload for fatal_error that passes an explicit location
broke gcc.pot regeneration because xgettext cannot handle function
overloads with the diagnostic string argument in different positions.

As the desired direction is for all diagnostics to have explicit
locations, this patch addresses the regression by removing the version
of fatal_error that does not pass a location, passing explicit
input_location everywhere (in the hope that those will incrementally
be changed to other locations, much as with the addition of a location
argument to pedwarn some time ago - a lot of cases aren't meaningfully
associated with a source file so UNKNOWN_LOCATION may be better).

Note that this patch does not attempt to fix any existing issues with
these diagnostics (such as wrongly starting with capital letters or
ending with '.' or '\n'); it just adds the input_location argument.

Bootstrapped with no regressions for x86_64-unknown-linux-gnu (Go
excluded).

gcc:
	* diagnostic.c (fatal_error (const char *, ...)): Remove function.
	* diagnostic-core.h (fatal_error (const char *, ...)): Remove
	prototype.
	* toplev.h (init_asm_output): Update comment on use of
	UNKNOWN_LOCATION with fatal_error.
	* cgraph.c, collect-utils.c, collect2.c, config/arc/arc.c,
	config/arc/arc.md, config/avr/avr.c, config/c6x/c6x.h,
	config/darwin.c, config/host-darwin.c, config/i386/host-cygwin.c,
	config/i386/intelmic-mkoffload.c, config/nios2/nios2.c,
	config/nvptx/mkoffload.c, config/nvptx/nvptx.h,
	config/rs6000/host-darwin.c, config/rs6000/rs6000.c,
	config/s390/s390.c, gcc.c, gcov-io.h, gcov-tool.c, ggc-common.c,
	ggc-page.c, graph.c, ipa-inline-analysis.c, ipa-reference.c,
	lto-cgraph.c, lto-section-in.c, lto-streamer-in.c, lto-streamer.c,
	lto-wrapper.c, objc/objc-act.c, opts.c, passes.c, plugin.c,
	tlink.c, toplev.c, tree-streamer-in.c, varpool.c: All callers of
	fatal_error changed to pass input_location as first argument.

gcc/c-family:
	* c-opts.c, c-pch.c, cppspec.c: All callers of fatal_error changed
	to pass input_location as first argument.

gcc/cp:
	* class.c, except.c, parser.c, pt.c: All callers of fatal_error
	changed to pass input_location as first argument.

gcc/fortran:
	* f95-lang.c, gfortranspec.c, trans-const.c, trans-expr.c: All
	callers of fatal_error changed to pass input_location as first
	argument.

gcc/java:
	* class.c, expr.c, jcf-parse.c, jvspec.c: All callers of
	fatal_error changed to pass input_location as first argument.

gcc/lto:
	* lto-object.c, lto-symtab.c, lto.c: All callers of fatal_error
	changed to pass input_location as first argument.

libcc1:
	* plugin.cc: All callers of fatal_error changed to pass
	input_location as first argument.

From-SVN: r220293
2015-01-30 16:15:00 +00:00
Jakub Jelinek 35228ac722 flag-types.h (enum sanitize_code): Add SANITIZE_VPTR, include SANITIZE_VPTR in SANITIZE_UNDEFINED.
* flag-types.h (enum sanitize_code): Add SANITIZE_VPTR,
	include SANITIZE_VPTR in SANITIZE_UNDEFINED.
	* opts.c (common_handle_option): Add -fsanitize=vptr.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS,
	BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS_ABORT): New.
	* ubsan.h (enum ubsan_null_ckind): Add UBSAN_DOWNCAST_POINTER,
	UBSAN_DOWNCAST_REFERENCE, UBSAN_UPCAST and UBSAN_CAST_TO_VBASE.
	(ubsan_expand_vptr_ifn): New prototype.
	* internal-fn.c (expand_ANNOTATE, expand_GOMP_SIMD_LANE,
	expand_GOMP_SIMD_VF, expand_GOMP_SIMD_LAST_LANE, expand_UBSAN_NULL,
	expand_UBSAN_BOUNDS, expand_UBSAN_OBJECT_SIZE, expand_ASAN_CHECK,
	expand_LOOP_VECTORIZED): Make argument nameless, remove
	ATTRIBUTE_UNUSED.
	(expand_UBSAN_VPTR): New function.
	* internal-fn.def (UBSAN_NULL, ASAN_CHECK): Use R instead of W
	in fn spec.
	(UBSAN_VPTR): New internal function.
	* sanopt.c (tree_map_traits): Renamed to ...
	(sanopt_tree_map_traits): ... this.
	(sanopt_tree_triplet, sanopt_tree_triplet_map_traits): New classes.
	(sanopt_ctx): Adjust asan_check_map type for tree_map_traits
	to sanopt_tree_map_traits renaming.  Add vptr_check_map field.
	(maybe_optimize_ubsan_vptr_ifn): New function.
	(sanopt_optimize_walker): Handle IFN_UBSAN_VPTR.
	(pass_sanopt::execute): Likewise.  Call sanopt_optimize even for
	-fsanitize=vptr.
	* tree-ssa-alias.c (call_may_clobber_ref_p_1): Handle certain
	internal calls like pure functions for aliasing, even when they
	have other side-effects that prevent making them ECF_PURE.
	* ubsan.c (ubsan_vptr_type_cache_decl): New variable.
	(ubsan_expand_vptr_ifn): New function.
cp/
	* cp-gimplify.c (cp_genericize_r): Call
	cp_ubsan_maybe_instrument_member_call for member calls.
	(cp_ubsan_check_member_access_r): New function.
	(cp_genericize_tree): Call cp_ubsan_instrument_member_accesses.
	* cp-tree.h (cp_ubsan_maybe_instrument_member_call,
	cp_ubsan_instrument_member_accesses,
	cp_ubsan_maybe_instrument_downcast,
	cp_ubsan_maybe_instrument_cast_to_vbase): New prototypes.
	* cp-ubsan.c: New file.
	* Make-lang.in (CXX_AND_OBJCXX_OBJS): Add cp/cp-ubsan.o.
	* constexpr.c (cxx_eval_call_expression): Return void_node
	for IFN_UBSAN_VPTR.
	(potential_constant_expression_1): Return true for
	UBSAN_NULL, UBSAN_BOUNDS and UBSAN_VPTR internal calls.
	* typeck.c (build_class_member_access_expr): Provide locus
	for COMPONENT_REFs.
	(build_static_cast_1): Instrument downcasts.
	* class.c (build_base_path): For -fsanitize=vptr and !fixed_type_p
	add ubsan instrumentation for virtual_access.
	* call.c: Include internal-fn.h.
	(set_flags_from_callee): Handle internal calls.
gcc/testsuite/
	* g++.dg/ubsan/vptr-1.C: New test.
	* g++.dg/ubsan/vptr-2.C: New test.
	* g++.dg/ubsan/vptr-3.C: New test.
	* g++.dg/ubsan/vptr-4.C: New test.
	* g++.dg/ubsan/vptr-5.C: New test.
	* g++.dg/ubsan/vptr-6.C: New test.
	* g++.dg/ubsan/vptr-7.C: New test.
	* g++.dg/ubsan/vptr-8.C: New test.
	* g++.dg/ubsan/vptr-9.C: New test.

From-SVN: r219695
2015-01-15 23:58:42 +01:00
Jakub Jelinek fb153d02da opts.c (common_handle_option): Add support for -fno-sanitize=all and -f{,no-}sanitize-recover=all.
* opts.c (common_handle_option): Add support for
	-fno-sanitize=all and -f{,no-}sanitize-recover=all.
	* doc/invoke.texi: Document -fno-sanitize=all,
	-f{,no-}sanitize-recover=all.  Document that
	-fsanitize=float-cast-overflow is not enabled
	by -fsanitize=undefined.  Fix up documentation
	of -f{,no-}sanitize-recover.

	* c-c++-common/asan/sanitize-all-1.c: New test.
	* c-c++-common/ubsan/sanitize-all-1.c: New test.
	* c-c++-common/ubsan/sanitize-all-2.c: New test.
	* c-c++-common/ubsan/sanitize-all-3.c: New test.
	* c-c++-common/ubsan/sanitize-all-4.c: New test.

From-SVN: r219241
2015-01-06 10:52:06 +01:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Tobias Burnus c9db45aaf4 diagnostic.c (get_terminal_width): Renamed from
2014-12-11  Tobias Burnus  <burnus@net-b.de>
            Manuel López-Ibáñez  <manu@gcc.gnu.org>

gcc/
        * diagnostic.c (get_terminal_width): Renamed from
        * getenv_columns,
        removed static, and additionally use ioctl to get width.
        (diagnostic_set_caret_max_width): Update call.
        * diagnostic.h (get_terminal_width): Add prototype.
        * opts.c (print_specific_help): Use it for x_help_columns.
        * doc/invoke.texi (fdiagnostics-show-caret): Document how the
        width is set.

gcc/fortran/
        * error.c (gfc_get_terminal_width): Renamed from
        get_terminal_width and use same-named common function.
        (gfc_error_init_1): Update call.


Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>

From-SVN: r218619
2014-12-11 09:20:24 +01:00
Manuel López-Ibáñez 97aa8bb6e2 diagnostic.c (diagnostic_color_init): New.
gcc/ChangeLog:

2014-12-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* diagnostic.c (diagnostic_color_init): New.
	* diagnostic.h: Declare.
	* gcc.c (driver::global_initializations): Use it.
	(driver_handle_option): Handle -fdiagnostics-color_.
	* toplev.c: Do not include diagnostic-color.h.
	(process_options): Do not initialize color diagnostics here.
	* common.opt (fdiagnostics-color=): Add Driver.
	* opts-global.c (init_options_once): Initialize color here.
	* opts.c (common_handle_option): Use diagnostics_color_init.
	* diagnostic-color.h: Fix comment.

From-SVN: r218406
2014-12-04 23:09:41 +00:00
Tom de Vries 1e2881031c Rename fuse-caller-save
2014-12-03  Tom de Vries  <tom@codesourcery.com>

	PR rtl-optimization/63957
	* doc/invoke.texi: Replace -fuse-caller-save with -fipa-ra.
	* final.c (rest_of_handle_final): Replace flag_use_caller_save with
	flag_ipa_ra.
	(get_call_reg_set_usage): Same.
	* lra-assigns.c (lra_assign): Same.
	* lra-constraints.c (need_for_call_save_p): Same.
	* lra-lives.c (process_bb_lives): Same.
	* lra.c (lra): Same.
	* calls.c (expand_call): Same.
	(emit_library_call_value_1): Same.
	* config/arm/arm.c (arm_option_override): Same.
	* opts.c (default_options_table): Replace OPT_fuse_caller_save with
	OPT_fipa_ra.
	* target.def (call_fusage_contains_non_callee_clobbers): Replace
	fuse-caller-save with fipa-ra.
	* doc/tm.texi (TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS): Same.
	* common.opt: Same.

	* gcc.dg/ira-shrinkwrap-prep-1.c: Replace -fno-use-caller-save with
	-fno-ipa-ra.
	* gcc.dg/ira-shrinkwrap-prep-2.c: Same.
	* gcc.target/aarch64/aapcs64/aapcs64.exp: Same.
	* gcc.dg/fuse-caller-save.c: Replace -fuse-caller-save with -fipa-ra.
	* gcc.target/aarch64/fuse-caller-save.c: Same.
	* gcc.target/arm/fuse-caller-save.c: Same.
	* gcc.target/i386/fuse-caller-save-rec.c: Same.
	* gcc.target/i386/fuse-caller-save-xmm-run.c: Same.
	* gcc.target/i386/fuse-caller-save-xmm.c: Same.
	* gcc.target/i386/fuse-caller-save.c: Same.
	* gcc.target/mips/fuse-caller-save-micromips.c: Same.
	* gcc.target/mips/fuse-caller-save-mips16.c: Same.
	* gcc.target/mips/fuse-caller-save.c: Same.
	* gcc.target/mips/mips.exp: Replace use-caller-save with ipa-ra in
	-ffoo/-fno-foo options.

From-SVN: r218305
2014-12-03 10:28:25 +00:00
Mark Wielaard 5d45c9c04e PR debug/38757 continued. Handle C11, C++11 and C++14.
Add experimental (minimal) DWARFv5 support.

This change depends on the new DWARFv5 constants mentioned in the
following draft: http://dwarfstd.org/doc/dwarf5.20141029.pdf

gcc/ChangeLog

	* doc/invoke.texi (-gdwarf-@{version}): Mention experimental DWARFv5.
	* opts.c (common_handle_option): Accept -gdwarf-5.
	* dwarf2out.c (is_cxx): Add DW_LANG_C_plus_plus_11 and
	DW_LANG_C_plus_plus_14.
	(lower_bound_default): Likewise. Plus DW_LANG_C11.
	(gen_compile_unit_die): Output DW_LANG_C_plus_plus_11,
	DW_LANG_C_plus_plus_14 or DW_LANG_C11.
	(output_compilation_unit_header): Output at most a DWARFv4 header.
	(output_skeleton_debug_sections): Likewise.
	(output_line_info): Likewise.
	(output_aranges): Document header version number.

gcc/testsuite/ChangeLog

	* gcc.dg/debug/dwarf2/lang-c11.c: New test.
	* gcc.dg/debug/dwarf2/lang-c11-d4-strict.c: Likewise.
	* g++.dg/debug/dwarf2/lang-cpp11.C: Likewise.
	* g++.dg/debug/dwarf2/lang-cpp14.C: Likewise.
	* g++.dg/debug/dwarf2/lang-cpp98.C: Likewise.

include/ChangeLog

	* dwarf2.h: Add DW_LANG_C_plus_plus_11, DW_LANG_C11 and
	DW_LANG_C_plus_plus_14.

From-SVN: r218077
2014-11-26 11:05:20 +00:00
David Malcolm 0ef443cf01 PR jit/63854: Fix memory leak within gcc_options
gcc/ChangeLog:
	PR jit/63854
	* opts.c (finalize_options_struct): New.
	* opts.h (finalize_options_struct): New.
	* toplev.c (toplev::finalize): Call finalize_options_struct
	on global_options and global_options_set.

From-SVN: r217791
2014-11-19 19:08:29 +00:00
Marat Zakirov 9ca0032c91 opts.c (finish_options): Disable aggressive opts for sanitizer.
gcc

2014-11-18  Marat Zakirov  <m.zakirov@samsung.com>

	* opts.c (finish_options): Disable aggressive opts for sanitizer.  
	(common_handle_option): Move code to finish_options.  

gcc/testsuite

2014-11-18  Marat Zakirov  <m.zakirov@samsung.com>

	* c-c++-common/asan/aggressive-opts.c: New test.

From-SVN: r217690
2014-11-18 08:46:39 +00:00
Bernd Schmidt c713ddc031 [PATCH 6/7] OpenMP 4.0 offloading infrastructure: option handling.
gcc/
	* common.opt (foffload, foffload-abi): New options.
	* config/i386/i386.c (ix86_offload_options): New static function.
	(TARGET_OFFLOAD_OPTIONS): Define.
	* coretypes.h (enum offload_abi): New enum.
	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in (TARGET_OFFLOAD_OPTIONS): Document.
	* gcc.c (offload_targets): New static variable.
	(handle_foffload_option): New static function.
	(driver_handle_option): Handle OPT_foffload_.
	(driver::maybe_putenv_OFFLOAD_TARGETS): Set OFFLOAD_TARGET_NAMES
	according to offload_targets.
	* hooks.c (hook_charptr_void_null): New hook.
	* hooks.h (hook_charptr_void_null): Declare.
	* lto-opts.c: Include lto-section-names.h.
	(lto_write_options): Append options from target offload_options hook and
	store them to offload_lto section.  Do not store target-specific,
	driver and diagnostic options in offload_lto section.
	* lto-wrapper.c (merge_and_complain): Handle OPT_foffload_ and
	OPT_foffload_abi_.
	(append_compiler_options, append_linker_options)
	(append_offload_options): New static functions.
	(compile_offload_image): Add new arguments with options.
	Call append_compiler_options and append_offload_options.
	(compile_images_for_offload_targets): Add new arguments with options.
	(find_and_merge_options): New static function.
	(run_gcc): Outline options handling into the new functions:
	find_and_merge_options, append_compiler_options, append_linker_options.
	* opts.c (common_handle_option): Don't handle OPT_foffload_.
	Forbid OPT_foffload_abi_ for non-offload compiler.
	* target.def (offload_options): New target hook.

Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>

From-SVN: r217493
2014-11-13 13:54:07 +00:00
Vladimir Makarov d9cf932c33 common.opt (flra-remat): New.
2014-11-12  Vladimir Makarov  <vmakarov@redhat.com>

	* common.opt (flra-remat): New.
	* opts.c (default_options_table): Add entry for flra_remat.
	* timevar_def (TV_LRA_REMAT): New.
	* doc/invoke.texi (-flra-remat): Add description of the new
	option.
	* doc/passes.texi (-flra-remat): Remove lra-equivs.c and
	lra-saves.c.  Add lra-remat.c.
	* Makefile.in (OBJS): Add lra-remat.o.
	* lra-remat.c: New file.
	* lra.c: Add info about the rematerialization pass in the top
	comment.
	(collect_non_operand_hard_regs, add_regs_to_insn_regno_info):
	Process unallocatable regs too.
	(lra_constraint_new_insn_uid_start): Remove.
	(lra): Add code for calling rematerialization sub-pass.
	* lra-int.h (lra_constraint_new_insn_uid_start): Remove.
	(lra_constrain_insn, lra_remat): New prototypes.
	(lra_eliminate_regs_1): Add parameter.
	* lra-lives.c (make_hard_regno_born, make_hard_regno_dead):
	Process unallocatable hard regs too.
	(process_bb_lives): Ditto.
	* lra-spills.c (remove_pseudos): Add argument to
	lra_eliminate_regs_1 call.
	* lra-eliminations.c (lra_eliminate_regs_1): Add parameter.  Use it
	for sp offset calculation.
	(lra_eliminate_regs): Add argument for lra_eliminate_regs_1 call.
	(eliminate_regs_in_insn): Add parameter.  Use it for sp offset
	calculation.
	(process_insn_for_elimination): Add argument for
	eliminate_regs_in_insn call.
	* lra-constraints.c (get_equiv_with_elimination):  Add argument
	for lra_eliminate_regs_1 call.
	(process_addr_reg): Add parameter.  Use it.
	(process_address_1): Ditto.  Add argument for process_addr_reg
	call.
	(process_address): Ditto.
	(curr_insn_transform): Add parameter.  Use it.  Add argument for
	process_address calls.
	(lra_constrain_insn): New function.
	(lra_constraints): Add argument for curr_insn_transform call.

From-SVN: r217458
2014-11-13 03:02:49 +00:00
Manuel López-Ibáñez 778e02fdc4 opts-global.c (postpone_unknown_option_warning): Fix spelling.
2014-11-13  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* opts-global.c (postpone_unknown_option_warning): Fix spelling.
	(print_ignored_options): Fix quoting.
	* opts.c (common_handle_option): Likewise.
	(set_debug_level): Likewise.
	* toplev.c (process_options): Likewise.

From-SVN: r217457
2014-11-13 01:08:06 +00:00
Yury Gribov fed4de37b8 Enable -fsanitize-recover for KASan.
2014-10-28  Yury Gribov  <y.gribov@samsung.com>

gcc/
	* asan.c (report_error_func): Add noabort path.
	(check_func): Ditto.  Formatting.
	(asan_expand_check_ifn): Handle noabort path.
	* common.opt (flag_sanitize_recover): Add SANITIZE_KERNEL_ADDRESS
	to default value.
	* doc/invoke.texi (-fsanitize-recover=): Mention KASan.
	* opts.c (finish_options): Reword comment.
	* sanitizer.def: Add noabort ASan builtins.

gcc/testsuite/
	* c-c++-common/asan/kasan-recover-1.c: New test.
	* c-c++-common/asan/kasan-recover-2.c: New test.
	* c-c++-common/asan/instrument-with-calls-1.c: Get rid of -save-temps.
	* c-c++-common/asan/instrument-with-calls-2.c: Likewise.
	* c-c++-common/asan/instrument-with-calls-3.c: Likewise.
	* c-c++-common/asan/kasan-recover-1.c: Likewise.
	* c-c++-common/asan/kasan-recover-2.c: Likewise.
	* c-c++-common/asan/no-asan-globals.c: Likewise.
	* c-c++-common/asan/no-instrument-reads.c: Likewise.
	* c-c++-common/asan/no-instrument-writes.c: Likewise.
	* c-c++-common/asan/no-use-after-return.c: Likewise.

From-SVN: r216778
2014-10-28 10:33:04 +00:00
Yury Gribov fd960af2df Allow to override Asan shadow offset.
2014-10-28  Yury Gribov  <y.gribov@samsung.com>

gcc/
	* asan.c (set_asan_shadow_offset): New function.
	(asan_shadow_offset): Likewise.
	(asan_emit_stack_protection): Call asan_shadow_offset.
	(build_shadow_mem_access): Likewise.
	* asan.h (set_asan_shadow_offset): Declare.
	* common.opt (fasan-shadow-offset): New option.
	(frandom-seed): Fixed parameter name.
	* doc/invoke.texi (fasan-shadow-offset): Describe new option.
	(frandom-seed): Fixed parameter name.
	* opts-global.c (handle_common_deferred_options): Handle
	-fasan-shadow-offset.
	* opts.c (common_handle_option): Likewise.

gcc/testsuite/
	* c-c++-common/asan/shadow-offset-1.c: New test.

From-SVN: r216773
2014-10-28 09:46:29 +00:00
Jakub Jelinek d95a270347 New syntax for -fsanitize-recover.
2014-10-22  Jakub Jelinek  <jakub@redhat.com>
	    Yury Gribov  <y.gribov@samsung.com>

gcc/
	* common.opt (flag_sanitize_recover): New variable.
	(fsanitize-recover): Remove Var/Init, deprecate.
	(fsanitize-recover=): New option.
	* doc/invoke.texi (fsanitize-recover): Update docs.
	* opts.c (finish_options): Use opts->x_flag_sanitize
	instead of flag_sanitize.  Prohibit -fsanitize-recover
	for anything besides UBSan.  Formatting.
	(common_handle_option): Handle OPT_fsanitize_recover_
	and OPT_fsanitize_recover.  Use opts->x_flag_sanitize
	instead of flag_sanitize.
	* asan.c (pass_sanopt::execute): Fix up formatting.
	* ubsan.c (ubsan_expand_bounds_ifn, ubsan_expand_null_ifn,
	ubsan_expand_objsize_ifn, ubsan_build_overflow_builtin,
	instrument_bool_enum_load, ubsan_instrument_float_cast,
	instrument_nonnull_arg, instrument_nonnull_return): Check
	bits in flag_sanitize_recover bitmask instead of
	flag_sanitize_recover as bool flag.

gcc/c-family/
	* c-ubsan.c (ubsan_instrument_division, ubsan_instrument_shift,
	ubsan_instrument_vla): Check bits in flag_sanitize_recover bitmask
	instead of flag_sanitize_recover as bool flag.

gcc/testsuite/
	* c-c++-common/ubsan/align-1.c: Update cmdline options.
	* c-c++-common/ubsan/align-3.c: Likewise.
	* c-c++-common/ubsan/bounds-1.c: Likewise.
	* c-c++-common/ubsan/div-by-zero-7.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-7.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
	* c-c++-common/ubsan/nonnull-2.c: Likewise.
	* c-c++-common/ubsan/nonnull-3.c: Likewise.
	* c-c++-common/ubsan/object-size-3.c: Likewise.
	* c-c++-common/ubsan/overflow-1.c: Likewise.
	* c-c++-common/ubsan/overflow-add-1.c: Likewise.
	* c-c++-common/ubsan/overflow-add-3.c: Likewise.
	* c-c++-common/ubsan/overflow-mul-1.c: Likewise.
	* c-c++-common/ubsan/overflow-mul-3.c: Likewise.
	* c-c++-common/ubsan/overflow-negate-2.c: Likewise.
	* c-c++-common/ubsan/overflow-sub-1.c: Likewise.
	* c-c++-common/ubsan/pr59503.c: Likewise.
	* c-c++-common/ubsan/pr60613-1.c: Likewise.
	* c-c++-common/ubsan/save-expr-1.c: Likewise.
	* c-c++-common/ubsan/shift-3.c: Likewise.
	* c-c++-common/ubsan/shift-6.c: Likewise.
	* c-c++-common/ubsan/undefined-1.c: Likewise.
	* c-c++-common/ubsan/vla-2.c: Likewise.
	* c-c++-common/ubsan/vla-3.c: Likewise.
	* c-c++-common/ubsan/vla-4.c: Likewise.
	* g++.dg/ubsan/cxx11-shift-1.C: Likewise.
	* g++.dg/ubsan/return-2.C: Likewise.
	* c-c++-common/ubsan/recovery-1.c: New test.
	* c-c++-common/ubsan/recovery-2.c: New test.
	* c-c++-common/ubsan/recovery-3.c: New test.
	* c-c++-common/ubsan/recovery-common.inc: New file.

Co-Authored-By: Yury Gribov <y.gribov@samsung.com>

From-SVN: r216552
2014-10-22 11:07:10 +00:00
Dehao Chen be3c16c474 Add AutoFDO.
gcc/ChangeLog:

2014-10-21  Dehao Chen  <dehao@google.com>

	* auto-profile.c: New file.
	* auto-profile.h: New file.
	* basic-block.h (maybe_hot_count_p): New export func.
	(add_working_set): New export func.
	* gcov-io.h (GCOV_TAG_AFDO_FILE_NAMES): New tag.
	(GCOV_TAG_AFDO_FUNCTION): Likewise.
	(GCOV_TAG_AFDO_WORKING_SET): Likewise.
	* opts.c (enable_fdo_optimizations): New func.
	(common_handle_option): Handle -fauto-profile flag.
	* ipa-inline.c (want_early_inline_function_p): Iterative-einline.
	(class pass_early_inline): Export early_inliner.
	(early_inliner): Likewise.
	(pass_early_inline::execute): Likewise.
	* ipa-inline.h (early_inliner): Likewise.
	* predict.c (maybe_hot_count_p): New export func.
	(counts_to_freqs): AutoFDO logic.
	(rebuild_frequencies): Likewise.
	* tree-profile.c (pass_ipa_tree_profile::gate): Likewise.
	* profile.c (add_working_set): New func.
	* Makefile.in (auto-profile.o): New object file.
	* passes.def (pass_ipa_auto_profile): New pass.
	* tree-ssa-live.c (remove_unused_scope_block_p): AutoFDO logic.
	* tree-pass.h (make_pass_ipa_auto_profile): New pass.
	* toplev.c (compile_file): AutoFDO logic.
	* doc/invoke.texi (-fauto-profile): New doc.
	* coverage.c (coverage_init): AutoFDO logic.
	* common.opt (-fauto-profile): New flag.
	* timevar.def (TV_IPA_AUTOFDO): New tag.
	* value-prof.c (gimple_alloc_histogram_value): New export func.
	(check_ic_target): Likewise.
	* value-prof.h (gimple_alloc_histogram_value): Likewise.
	(check_ic_target): Likewise.

From-SVN: r216523
2014-10-21 17:59:30 +00:00
Martin Liska 9d4ded759a Temporary fix for PR63566.
* ipa-icf.c (sem_function::merge): Local flags are set to false
	to enforce equal calling convention to be used.
	* opts.c (common_handle_option): Indentation fix.

From-SVN: r216386
2014-10-17 09:37:35 +00:00
Martin Liska b84d4347ac IPA ICF pass, part 3/5
* Makefile.in: New object files included.
	* cgraph.c (cgraph_node::dump): New cgraph_node flag icf_merged
	is printed.
	(verify_edge_corresponds_to_fndecl): More sensitive verification
	of nodes that are merged by IPA ICF.
	* cgraph.h (cgraph_node::num_references): New function.
	* cgraphunit.c (cgraph_node::expand_thunk): White space fixed.
	* common.opt: New options ipa-icf, ipa-icf-functions and
	ipa-icf-variables introduced.
	* doc/invoke.texi: Documentation of new options introduced.
	* ipa-icf-gimple.c: New file.
	* ipa-icf-gimple.h: New file.
	* ipa-icf.c: New file.
	* ipa-icf.h: New file.
	* lto-cgraph.c (lto_output_node): Streaming of icf_merged flag added.
	(input_overwrite_node): Likewise.
	* lto-section-in.c: New icf section added.
	* lto-streamer.h (enum lto_section_type): Likewise.
	* opts.c (common_handle_option): New option added.
	* passes.def: New pass included.
	* timevar.def: Time variable for IPA ICF added.
	* tree-pass.h: New IPA ICF pass entry point added.


Co-Authored-By: Jan Hubicka <hubicka@ucw.cz>

From-SVN: r216305
2014-10-16 10:47:55 +00:00