Commit Graph

3147 Commits

Author SHA1 Message Date
David Malcolm ebedc9a341 Source range tracking in libcpp and C FE, with bit-packing optimization
This patch combines:
  [PATCH 05/10] Add ranges to libcpp tokens (via ad-hoc data, unoptimized)
  [PATCH 06/10] Track expression ranges in C frontend
  [PATCH 07/10] Add plugin to recursively dump the source-ranges in a tree (v2)
  [PATCH 08/10] Wire things up so that libcpp users get token underlines
  [PATCH 09/10] Delay some resolution of ad-hoc locations, preserving ranges
  [PATCH 10/10] Compress short ranges into source_location
  [PATCH] libcpp: add examples to source_location description
along with fixes for the nits identified during review.

gcc/ChangeLog:
	* Makefile.in (OBJS): Add gcc-rich-location.o.
	* diagnostic.c (diagnostic_append_note): Pass line_table to
	rich_location ctor.
	(emit_diagnostic): Likewise.
	(inform): Likewise.
	(inform_n): Likewise.
	(warning): Likewise.
	(warning_at): Likewise.
	(warning_n): Likewise.
	(pedwarn): Likewise.
	(permerror): Likewise.
	(error): Likewise.
	(error_n): Likewise.
	(error_at): Likewise.
	(sorry): Likewise.
	(fatal_error): Likewise.
	(internal_error): Likewise.
	(internal_error_no_backtrace): Likewise.
	(source_range::debug): Likewise.
	* gcc-rich-location.c: New file.
	* gcc-rich-location.h: New file.
	* genmatch.c (fatal_at): Pass line_table to rich_location ctor.
	(warning_at): Likewise.
	* gimple.h (gimple_set_block): Use set_block function.
	* input.c (dump_line_table_statistics): Dump stats on how many
	ranges were optimized vs how many needed ad-hoc table.
	(write_digit_row): Add "map" param; use its range_bits
	to calculate the per-character offset.
	(dump_location_info): Print the range and column bits for each
	ordinary map.  Use the range bits to calculate the per-character
	offset.  Pass the map as a new param to the various calls to
	write_digit_row.  Eliminate uses of
	ORDINARY_MAP_NUMBER_OF_COLUMN_BITS.
	* print-tree.c (print_node): Print any source range information.
	* rtl-error.c (diagnostic_for_asm): Likewise.
	* toplev.c (general_init): Initialize line_table's
	default_range_bits.
	* tree-cfg.c (move_block_to_fn): Likewise.
	(move_block_to_fn): Likewise.
	* tree-inline.c (copy_phis_for_bb): Likewise.
	* tree.c (tree_set_block): Likewise.
	(get_pure_location): New function.
	(set_source_range): New functions.
	(set_block): New function.
	(set_source_range): New functions.
	* tree.h (CAN_HAVE_RANGE_P): New.
	(EXPR_LOCATION_RANGE): New.
	(EXPR_HAS_RANGE): New.
	(get_expr_source_range): New inline function.
	(DECL_LOCATION_RANGE): New.
	(set_source_range): New decls.
	(get_decl_source_range): New inline function.

gcc/ada/ChangeLog:
	* gcc-interface/trans.c (Sloc_to_locus): Add line_table param when
	calling linemap_position_for_line_and_column.

gcc/c-family/ChangeLog:
	* c-common.c (c_fully_fold_internal): Capture existing souce_range,
	and store it on the result.
	* c-opts.c (c_common_init_options): Set
	global_dc->colorize_source_p.

gcc/c/ChangeLog:
	* c-decl.c (warn_defaults_to): Pass line_table to
	rich_location ctor.
	* c-errors.c (pedwarn_c99): Likewise.
	(pedwarn_c90): Likewise.
	* c-parser.c (set_c_expr_source_range): New functions.
	(c_token::get_range): New method.
	(c_token::get_finish): New method.
	(c_parser_expr_no_commas): Call set_c_expr_source_range on the ret
	based on the range from the start of the LHS to the end of the
	RHS.
	(c_parser_conditional_expression): Likewise, based on the range
	from the start of the cond.value to the end of exp2.value.
	(c_parser_binary_expression): Call set_c_expr_source_range on
	the stack values for TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR.
	(c_parser_cast_expression): Call set_c_expr_source_range on ret
	based on the cast_loc through to the end of the expr.
	(c_parser_unary_expression): Likewise, based on the
	op_loc through to the end of op.
	(c_parser_sizeof_expression) Likewise, based on the start of the
	sizeof token through to either the closing paren or the end of
	expr.
	(c_parser_postfix_expression): Likewise, using the token range,
	or from the open paren through to the close paren for
	parenthesized expressions.
	(c_parser_postfix_expression_after_primary): Likewise, for
	various kinds of expression.
	* c-tree.h (struct c_expr): Add field "src_range".
	(c_expr::get_start): New method.
	(c_expr::get_finish): New method.
	(set_c_expr_source_range): New decls.
	* c-typeck.c (parser_build_unary_op): Call set_c_expr_source_range
	on ret for prefix unary ops.
	(parser_build_binary_op): Likewise, running from the start of
	arg1.value through to the end of arg2.value.

gcc/cp/ChangeLog:
	* error.c (pedwarn_cxx98): Pass line_table to rich_location ctor.

gcc/fortran/ChangeLog:
	* error.c (gfc_warning): Pass line_table to rich_location ctor.
	(gfc_warning_now_at): Likewise.
	(gfc_warning_now): Likewise.
	(gfc_error_now): Likewise.
	(gfc_fatal_error): Likewise.
	(gfc_error): Likewise.
	(gfc_internal_error): Likewise.

gcc/testsuite/ChangeLog:
	* gcc.dg/diagnostic-token-ranges.c: New file.
	* gcc.dg/diagnostic-tree-expr-ranges-2.c: New file.
	* gcc.dg/plugin/diagnostic-test-expressions-1.c: New file.
	* gcc.dg/plugin/diagnostic-test-show-trees-1.c: New file.
	* gcc.dg/plugin/diagnostic_plugin_show_trees.c: New file.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (get_loc): Add
	line_table param when calling
	linemap_position_for_line_and_column.
	(test_show_locus): Pass line_table to rich_location ctors.
	(plugin_init): Remove setting of global_dc->colorize_source_p.
	* gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c:
	New file.
	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add
	diagnostic_plugin_test_tree_expression_range.c,
	diagnostic-test-expressions-1.c, diagnostic_plugin_show_trees.c,
	and diagnostic-test-show-trees-1.c.

libcpp/ChangeLog:
	* errors.c (cpp_diagnostic): Pass pfile->line_table to
	rich_location ctor.
	(cpp_diagnostic_with_line): Likewise.
	* include/cpplib.h (struct cpp_token): Update comment for src_loc
	to indicate that the range of the token is "baked into" the
	source_location.
	* include/line-map.h (source_location): Update the descriptive
	comment to reflect the packing scheme for short ranges, adding
	worked examples of location encoding.
	(struct line_map_ordinary): Drop field "column_bits" in favor
	of field "m_column_and_range_bits"; add field "m_range_bits".
	(ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Delete.
	(location_adhoc_data): Add source_range field.
	(struct line_maps): Add fields "default_range_bits",
	"num_optimized_ranges" and "num_unoptimized_ranges".
	(get_combined_adhoc_loc): Add source_range param.
	(get_range_from_loc): New declaration.
	(pure_location_p): New prototype.
	(COMBINE_LOCATION_DATA):  Add source_range param.
	(SOURCE_LINE): Update for renaming of column_bits.
	(SOURCE_COLUMN): Likewise.  Shift the column right by the map's
	range_bits.
	(LAST_SOURCE_LINE_LOCATION): Update for renaming of column_bits.
	(linemap_position_for_line_and_column): Add line_maps * params.
	(rich_location::rich_location): Likewise.
	* lex.c (_cpp_lex_direct): Capture the range of the token, baking
	it into token->src_loc via a call to COMBINE_LOCATION_DATA.
	* line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): Reduce from 1U << 17 to
	1U << 12.
	(location_adhoc_data_hash): Add the src_range into
	the hash value.
	(location_adhoc_data_eq): Require equality of the src_range
	values.
	(can_be_stored_compactly_p): New function.
	(get_combined_adhoc_loc): Add src_range param, and store it,
	via a bit-packing scheme for short ranges, otherwise within the
	lookaside table.  Remove the requirement that data is non-NULL.
	(get_range_from_adhoc_loc): New function.
	(get_range_from_loc): New function.
	(pure_location_p): New function.
	(linemap_add): Ensure that start_location has zero for the
	range_bits, unless we're past LINE_MAP_MAX_LOCATION_WITH_COLS.
	Initialize range_bits to zero.  Assert that the start_location
	is "pure".
	(linemap_line_start): Assert that the
	column_and_range_bits >= range_bits.
	Update determinination of whether we need to start a new map
	using the effective column bits, without the range bits.
	Use the set's default_range_bits in new maps, apart from
	those with column_bits == 0, which should also have 0 range_bits.
	Increase the column bits for new maps by the range bits.
	When adding lines to an existing map, use set->highest_line
	directly rather than offsetting highest by SOURCE_COLUMN.
	Add assertions to sanity-check the return value.
	(linemap_position_for_column): Offset to_column by range_bits.
	Update set->highest_location if necessary.
	(linemap_position_for_line_and_column): Add line_maps * param.
	Update the calculation to offset the column by range_bits, and
	conditionalize it on being <= LINE_MAP_MAX_LOCATION_WITH_COLS.
	Bound it by LINEMAPS_MACRO_LOWEST_LOCATION.  Update
	set->highest_location if necessary.
	(linemap_position_for_loc_and_offset): Handle ad-hoc locations;
	pass "set" to linemap_position_for_line_and_column.
	(linemap_macro_map_loc_unwind_toward_spelling): Add line_maps
	param.  Handle ad-hoc locations.
	(linemap_location_in_system_header_p): Pass on "set" to call to
	linemap_macro_map_loc_unwind_toward_spelling.
	(linemap_macro_loc_to_spelling_point): Retain ad-hoc locations.
	Pass on "set" to call to
	linemap_macro_map_loc_unwind_toward_spelling.
	(linemap_resolve_location): Retain ad-hoc locations.  Pass on
	"set" to call to linemap_macro_map_loc_unwind_toward_spelling.
	(linemap_unwind_toward_expansion):  Pass on "set" to call to
	linemap_macro_map_loc_unwind_toward_spelling.
	(linemap_expand_location): Extract the data pointer before
	extracting the location.
	(rich_location::rich_location): Add line_maps param; use it to
	extract the range from the source_location.
	* location-example.txt: Regenerate, showing new representation.

From-SVN: r230331
2015-11-13 16:29:59 +00:00
David Malcolm 93ebf1fdbe PR driver/67613 - spell suggestions for misspelled command line options
gcc/ChangeLog:
	PR driver/67613
	* Makefile.in (GCC_OBJS): Add spellcheck.o.
	(OBJS): Add spellcheck-tree.o.
	* gcc.c: Include "spellcheck.h".
	(suggest_option): New function.
	(driver::handle_unrecognized_options): Call suggest_option to
	provide a hint about misspelled options.
	* spellcheck.c: Update file comment.
	(levenshtein_distance): Convert 4-param implementation from static
	to extern scope.  Remove note about unit tests from leading
	comment for const char * implementation.  Move tree
	implementation to...
	* spellcheck-tree.c: New file.
	* spellcheck.h (levenshtein_distance):  Add 4-param decl.

gcc/testsuite/ChangeLog:
	PR driver/67613
	* gcc/testsuite/gcc.dg/spellcheck-options-1.c: New file.
	* gcc/testsuite/gcc.dg/spellcheck-options-2.c: New file.

From-SVN: r230285
2015-11-13 01:59:03 +00:00
David Malcolm 277fe61691 Implement Levenshtein distance; use in C FE for misspelled field names
This is the combination of:
  [PATCH 1/2] Implement Levenshtein distance
  [PATCH 2/2] C FE: suggest corrections for misspelled field names
plus some nit fixes in spellcheck.c.

gcc/ChangeLog:
	* Makefile.in (OBJS): Add spellcheck.o.
	* spellcheck.c: New file.
	* spellcheck.h: New file.

gcc/c/ChangeLog:
	* c-typeck.c: Include spellcheck.h.
	(lookup_field_fuzzy_find_candidates): New function.
	(lookup_field_fuzzy): New function.
	(build_component_ref): If the field was not found, try using
	lookup_field_fuzzy and potentially offer a suggestion.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/levenshtein-test-1.c: New file.
	* gcc.dg/plugin/levenshtein_plugin.c: New file.
	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add
	levenshtein_plugin.c.
	* gcc.dg/spellcheck-fields.c: New file.

From-SVN: r230284
2015-11-13 01:54:41 +00:00
Richard Sandiford 5c1a2e639a Move constant folds for maths functions to new file
The new routines operate on the built-in enum rather than on tree decls.
The idea is to extend this to handle internal functions too, with a
combined enum for both.

The patch also moves fold_fma too, with the same prototype.  The long-term
plan is to replace FMA_EXPR with an internal function, for consistency
with the way that things like SQRT will be handled.

Tested on x86_64-linux-gnu, arm-linux-gnueabi and aarch64-linux-gnu.

gcc/
	* builtins.h (fold_fma): Move to fold-const-call.h.
	* builtins.c: Include fold-const-call.h.
	(mathfn_built_in_2): New function, split out from...
	(mathfn_built_in_1): ...here.
	(do_real_to_int_conversion, fold_const_builtin_pow)
	(fold_const_builtin_logb, fold_const_builtin_significand)
	(fold_const_builtin_load_exponent, do_mpfr_arg1, do_mpfr_arg2)
	(do_mpfr_arg3, do_mpfr_sincos, do_mpfr_bessel_n, do_mpc_arg1): Delete.
	(fold_builtin_sincos): Use fold_const_call to handle constants.
	(fold_builtin_1, fold_builtin_2, fold_builtin_3): Add explicit
	checks for ERROR_MARK.  Use fold_const_call to handle constant
	folds for math functions.
	(fold_fma): Move to fold-const-call.c.
	* fold-const.c: Include fold-const-call.h.
	* Makefile.in (OBJS): Add fold-const-call.o.
	(PLUGIN_HEADERS): Add fold-const-call.h.
	* realmpfr.h (real_from_mpfr): Allow the format to be specified
	directly.
	* realmpfr.c (real_from_mpfr): Likewise.
	* fold-const-call.h, fold-const-call.c: New files.

From-SVN: r229669
2015-11-02 16:34:16 +00:00
Evgeny Stupachenko 3b1661a9b9 Makefile.in (OBJS): Add multiple_target.o.
2015-10-30  Evgeny Stupachenko  <evstupac@gmail.com>

gcc/
	* Makefile.in (OBJS): Add multiple_target.o.
	* attrib.c (make_attribute): Moved from config/i386/i386.c
	* config/i386/i386.c (make_attribute): Deleted.
	* multiple_target.c (create_dispatcher_calls): New.
	(get_attr_len): Ditto.
	(get_attr_str): Ditto.
	(separate_attrs): Ditto.
	(is_valid_asm_symbol): Ditto.
	(create_new_asm_name): Ditto.
	(create_target_clone): Ditto.
	(expand_target_clones): Ditto.
	(ipa_target_clone): Ditto.
	(ipa_dispatcher_calls): Ditto.
	* passes.def (pass_target_clone): Two new ipa passes.
	* tree-pass.h (make_pass_target_clone): Ditto.
	* doc/extend.texi (target_clones): New attribute description.
gcc/c-family/
	* c-common.c (handle_target_clones_attribute): New.
	(c_common_attribute_table): Add handle_target_clones_attribute.
	(handle_always_inline_attribute): Add check on target_clones attribute.
	(handle_target_attribute): Ditto.
gcc/testsuite/
	* gcc.dg/mvc1.c: New test for multiple targets cloning.
	* gcc.dg/mvc2.c: Ditto.
	* gcc.dg/mvc3.c: Ditto.
	* gcc.dg/mvc4.c: Ditto.
	* gcc.dg/mvc5.c: Ditto.
	* gcc.dg/mvc6.c: Ditto.
	* gcc.dg/mvc7.c: Ditto.
	* g++.dg/ext/mvc1.C: Ditto.
	* g++.dg/ext/mvc2.C: Ditto.
	* g++.dg/ext/mvc3.C: Ditto.
	* g++.dg/ext/mvc4.C: Ditto.

From-SVN: r229595
2015-10-30 18:17:43 +00:00
H.J. Lu 5148d2e38f Add BUILD_NO_PIE_CFLAGS and BUILD_NO_PIE_FLAG
We shouldn't use NO_PIE_CFLAGS and NO_PIE_FLAG with CXX_FOR_BUILD
when CXX_FOR_BUILD != CXX.  This patch adds BUILD_NO_PIE_CFLAGS
and BUILD_NO_PIE_FLAG to use with CXX_FOR_BUILD.  They are set to
NO_PIE_CFLAGS and NO_PIE_FLAG when build machine == host machine.
Otherwise, they are set to NO_PIE_CFLAGS_FOR_BUILD and
NO_PIE_FLAG_FOR_BUILD.

	* Makefile.in (NO_PIE_CFLAGS): New.
	(NO_PIE_FLAG): Likewise.
	(NO_PIE_CFLAGS_FOR_BUILD): Likewise.
	(NO_PIE_FLAG_FOR_BUILD): Likewise.
	(BUILD_NO_PIE_CFLAGS): Likewise.
	(BUILD_NO_PIE_FLAG): Likewise.
	(COMPILER): Replace @NO_PIE_CFLAGS@ with $(NO_PIE_CFLAGS).
	(LINKER): Replace @NO_PIE_FLAG@ with $(NO_PIE_FLAG).
	(BUILD_CFLAGS): Replace @NO_PIE_CFLAGS@ with
	$(BUILD_NO_PIE_CFLAGS).
	(BUILD_CXXFLAGS): Likewise.
	(BUILD_LDFLAGS ): Replace @NO_PIE_FLAG@ with
	$(BUILD_NO_PIE_FLAG).
	* configure.ac (BUILD_NO_PIE_CFLAGS): New.  AC_SUBST.
	(BUILD_NO_PIE_FLAG): Likewise.
	(NO_PIE_CFLAGS_FOR_BUILD): Likewise.
	(NO_PIE_FLAG_FOR_BUILD): Likewise.
	* configure: Regenerated.

From-SVN: r229522
2015-10-29 05:29:43 -07:00
Jason Merrill 08585fba89 Make-lang.in (c.tags): Also include libcpp TAGS.
gcc/c/
	* Make-lang.in (c.tags): Also include libcpp TAGS.
gcc/cp/
	* Make-lang.in (c++.tags): Also include libcpp TAGS.

From-SVN: r229504
2015-10-28 15:45:33 -04:00
Richard Biener ed4403c692 Makefile.in (build/genmatch.o): Properly depend on is-a.h, tree.def and builtins.def.
2015-10-23  Richard Biener  <rguenther@suse.de>

	* Makefile.in (build/genmatch.o): Properly depend on is-a.h, tree.def
	and builtins.def.

From-SVN: r229235
2015-10-23 11:08:10 +00:00
Richard Sandiford 6a75d560c8 Add a pass to back-propagate use information
This patch adds a pass that collects information that is common to
all uses of an SSA name X and back-propagates that information up
the statements that generate X.  The general idea is to use the
information to simplify instructions (rather than a pure DCE) so
I've simply called it gimple-ssa-backprop.c, to go with
tree-ssa-forwprop.c.

At the moment the only use of the pass is to remove unnecessary
sign operations, so that it's effectively a global version of
fold_strip_sign_ops.  I'm hoping it could be extended in future
to record which bits of an integer are significant.  There are
probably other potential uses too.

A later patch gets rid of fold_strip_sign_ops.

Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.

gcc/
	* doc/invoke.texi (-fdump-tree-backprop, -fssa-backprop): Document.
	* Makefile.in (OBJS): Add gimple-ssa-backprop.o.
	* common.opt (fssa-backprop): New option.
	* fold-const.h (negate_mathfn_p): Declare.
	* fold-const.c (negate_mathfn_p): Make public.
	* timevar.def (TV_TREE_BACKPROP): New.
	* tree-pass.h (make_pass_backprop): Declare.
	* passes.def (pass_backprop): Add.
	* gimple-ssa-backprop.c: New file.

gcc/testsuite/
	* gcc.dg/tree-ssa/backprop-1.c, gcc.dg/tree-ssa/backprop-2.c,
	gcc.dg/tree-ssa/backprop-3.c, gcc.dg/tree-ssa/backprop-4.c,
	gcc.dg/tree-ssa/backprop-5.c, gcc.dg/tree-ssa/backprop-6.c: New tests.

From-SVN: r229139
2015-10-21 20:11:33 +00:00
Jeff Law 013a8899f5 [PATCH] Move RTL printing code from sched-vis.c into print-rtl.c
* Makefile.in (OBJS): Remove sched-vis.c
	* sched-vis.c: Removed.  Code moved into...
	* print-rtl.c: Here.  Include cfg.h, pretty-print.h and print-rtl.h.
	* rtl.h: Remove prototypes for functions now living in print-rtl.c
	* print-rtl.h Add prototypes for new functions in print-rtl.c.
	* auto-inc-dec.c: Include print-rtl.h
	* cfgrtl.c, combine.c, final.c haifa-sched.c: Likewise.
	* ira.c, lra-constraints.c, lra.c, sel-sched-dump.c: Likewise.

From-SVN: r229110
2015-10-20 23:56:37 -06: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
Jeff Law 0732f75fce [PATCH] Refactoring FSM bits into their own file
[PATCH] Refactoring FSM bits into their own file
	* tree-ssa-threadedge.c (fsm_find_thread_path): Moved from here into
	tree-ssa-threadbackward.c.
	(fsm_find_control_statement_thread_paths): Likewise.
	(thread_through_normal_block): Break out FSM bits and move them
	into a new function in tree-ssa-threadbackward.c.  Call new function
	instead.
	Minimize header file usage.
	* tree-ssa-threadbackward.h: New file.
	* tree-ssa-threadbackward.c: Likewise.
	* Makefile.in (OBJS): Add tree-ssa-threadbackward.o

From-SVN: r228700
2015-10-11 19:17:51 -06:00
Marek Polacek 62cf8b4cdd Makefile.in (insn-latencytab.o): Remove -Wno-duplicated-cond.
* Makefile.in (insn-latencytab.o): Remove -Wno-duplicated-cond.
	(insn-dfatab.o): Likewise.

From-SVN: r228451
2015-10-03 17:02:12 +00:00
Marek Polacek 3e3b8d63e5 re PR c/64249 (Missing warning for if (A) else if (A))
PR c/64249
	* c-common.c (warn_duplicated_cond_add_or_warn): New function.
	* c-common.h (warn_duplicated_cond_add_or_warn): Declare.
	* c.opt (Wduplicated-cond): New option.

	* c-parser.c (c_parser_statement_after_labels): Add CHAIN parameter
	and pass it down to c_parser_if_statement.
	(c_parser_else_body): Add CHAIN parameter and pass it down to
	c_parser_statement_after_labels.
	(c_parser_if_statement): Add CHAIN parameter.  Add code to warn about
	duplicated if-else-if conditions.

	* parser.c (cp_parser_statement): Add CHAIN parameter and pass it
	down to cp_parser_selection_statement.
	(cp_parser_selection_statement): Add CHAIN parameter.  Add code to
	warn about duplicated if-else-if conditions.
	(cp_parser_implicitly_scoped_statement): Add CHAIN parameter and pass
	it down to cp_parser_statement.

	* doc/invoke.texi: Document -Wduplicated-cond.
	* Makefile.in (insn-latencytab.o): Use -Wno-duplicated-cond.
	(insn-dfatab.o): Likewise.
	* genemit.c (gen_exp): Rewrite condition to avoid -Wduplicated-cond
	warning.

	* c-c++-common/Wduplicated-cond-1.c: New test.
	* c-c++-common/Wduplicated-cond-2.c: New test.
	* c-c++-common/Wduplicated-cond-3.c: New test.
	* c-c++-common/Wduplicated-cond-4.c: New test.
	* c-c++-common/Wmisleading-indentation.c (fn_37): Avoid
	-Wduplicated-cond warning.

From-SVN: r228388
2015-10-02 12:56:17 +00:00
David Malcolm 57eb2d70a6 Move diagnostic_show_locus and friends out into a new source file
gcc/ChangeLog:
	* Makefile.in (OBJS-libcommon): Add diagnostic-show-locus.o.
	* diagnostic.c (adjust_line): Move to diagnostic-show-locus.c.
	(diagnostic_show_locus): Likewise.
	(diagnostic_print_caret_line): Likewise.
	* diagnostic-show-locus.c: New file.

From-SVN: r227915
2015-09-18 18:27:44 +00:00
Jeff Law a502f7b6e4 [PATCH] Break out phi-only cprop into its own file
PR tree-optimization/47679
	* Makefile.in (OBJS): Add tree-ssa-phionlycprop.o
	* tree-ssa-dom.c: Remove unnecessary header includes.
	(remove_stmt_or_phi): Moved from here into tree-ssa-phionlycprop.c
	(get_rhs_or_phi_arg, get_lhs_or_phi_result): Likewise.
	(propagate_rhs_into_lhs, eliminate_const_or_copy): Likewise.
	(eliminate_degenerate_phis_1, pass_phi_only_cprop): Likewise.
	(pass_phi_only_cprop::execute): Likewise.
	(make_pass_phi_only_cprop): Likewise.
	* tree-ssa-phionlycprop.c: New file with moved code.  Eliminate
	uses of file scoped statics by passing the required objects
	as parameters wherever needed.

From-SVN: r227908
2015-09-18 09:29:01 -06:00
Richard Sandiford 385399a875 Split up optabs.[hc]
optabs.[hc] is a bit of a behemoth.  It includes basic functions for querying
what a target can do, related tree- and gimple-level query functions,
related rtl-level query functions, and the functions that actually
generate code.  Some gimple optimisations therefore need:

#include "insn-config.h"
#include "expmed.h"
#include "dojump.h"
#include "explow.h"
#include "emit-rtl.h"
#include "varasm.h"
#include "stmt.h"
#include "expr.h"

purely to query whether the target has support for a particular operation.

This patch splits optabs up as follows:

      - optabs-query.[hc]: IL-independent functions for querying what a target
          can do natively.
      - optabs-tree.[hc]: tree and gimple query functions (an extension of
          optabs-query.[hc]).
      - optabs-libfuncs.[hc]: optabs-specific libfuncs (an extension of
          libfuncs.h)
      - optabs.h: For now includes optabs-query.h and optabs-libfuncs.h.

Only two files outside optabs need to include both optabs.h and
optabs-tree.h: expr.c and function.c.  I think that's expected given
that both are related to expand.

It might be good to split optabs.h further, but this is already quite
a big patch.

I changed can_conditionally_move_p from returning an int to returning
a bool and fixed a few formatting glitches.  There should be no other
changes to the functions themselves.

gcc/
	* Makefile.in (OBJS): Add optabs-libfuncs.o, optabs-query.o
	and optabs-tree.o.
	(GTFILES): Replace optabs.c with optabs-libfunc.c.
	* genopinit.c (main): Add an include guard to insn-opinit.h.
	Protect the rtx_code parts with NUM_RTX_CODE.
	* optabs.h: Split parts out to...
	* optabs-libfuncs.h, optabs-query.h, optabs-tree.h: ...these
	new files.
	* optabs.c: Split parts out to...
	* optabs-libfuncs.c, optabs-query.c, optabs-tree.c: ...these
	new files.
	* cilk-common.c: Include optabs-query.h rather than optabs.h.
	* fold-const.c: Likewise.
	* target-globals.c: Likewise.
	* tree-if-conv.c: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-ssa-math-opts.c: Include optabs-tree.h rather than
	optabs.h.  Remove unncessary include files.
	* tree-ssa-phiopt.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-generic.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-slp.c: Likewise.
	* tree-vect-stmts.c: Likewise.
	* tree-vrp.c: Likewise.
	* toplev.c: Include optabs-query.h and optabs-libfuncs.h
	rather than optabs.h.
	* expr.c: Include optabs-tree.h.
	* function.c: Likewise.

From-SVN: r227865
2015-09-17 14:28:59 +00:00
Mikhail Maltsev fcb87c50b0 Share memory blocks between pool allocators
gcc/
	* Makefile.in: Add memory-block.cc
	(pool_allocator::initialize): Use fixed block size.
	(pool_allocator::release): Use memory_block_pool.
	(pool_allocator::allocate): Likewise.
	* asan.c (asan_mem_ref_pool): Adjust to use common block size in all
	object pools.
	* cfg.c (initialize_original_copy_tables): Likewise.
	* cselib.c (elt_list_pool, elt_loc_list_pool,
	cselib_val_pool): Likewise.
	* df-problems.c (df_chain_alloc): Likewise.
	* df-scan.c (df_scan_alloc): Likewise.
	* dse.c (cse_store_info_pool, rtx_store_info_pool,
	read_info_type_pool, insn_info_type_pool, bb_info_pool,
	group_info_pool, deferred_change_pool): Likewise.
	* et-forest.c (et_nodes, et_occurrences): Likewise.
	* ipa-cp.c (ipcp_cst_values_pool, ipcp_sources_pool,
	ipcp_agg_lattice_pool): Likewise.
	* ipa-inline-analysis.c (edge_predicate_pool): Likewise.
	* ipa-profile.c (histogram_pool): Likewise.
	* ipa-prop.c (ipa_refdesc_pool): Likewise.
	* ira-build.c (live_range_pool, allocno_pool, object_pool,
	initiate_cost_vectors, pref_pool, copy_pool): Likewise.
	* ira-color.c (update_cost_record_pool): Likewise.
	* lra-lives.c (lra_live_range_pool): Likewise.
	* lra.c (lra_insn_reg_pool, lra_copy_pool): Likewise.
	* memory-block.cc: New file.
	* memory-block.h: New file.
	* regcprop.c (queued_debug_insn_change_pool): Use common block size.
	* sched-deps.c (sched_deps_init): Likewise.
	* sel-sched-ir.c (sched_lists_pool): Likewise.
	* stmt.c (expand_case, expand_sjlj_dispatch_table): Likewise.
	* tree-sra.c (access_pool): Likewise.
	* tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise.
	* tree-ssa-pre.c (pre_expr_pool, bitmap_set_pool): Likewise.
	* tree-ssa-reassoc.c (operand_entry_pool): Likewise.
	* tree-ssa-sccvn.c (allocate_vn_table): Likewise.
	* tree-ssa-strlen.c (strinfo_pool): Likewise.
	* tree-ssa-structalias.c (variable_info_pool): Likewise.
	* var-tracking.c (attrs_def_pool, var_pool, valvar_pool,
	location_chain_pool, shared_hash_pool, loc_exp_dep_pool): Likewise.

gcc/c-family/
	* c-format.c (check_format_arg): Adjust to use common block size in all
	object pools.

From-SVN: r227817
2015-09-16 00:56:54 +00:00
Tom de Vries b71a678232 Prevent unnecessary recompilation for trivial params.def changes
2015-09-08  Tom de Vries  <tom@codesourcery.com>

	* Makefile.in (generated_files): Add params.list.
	(params.list, s-params.list): Add rule.
	* params.h (enum compiler_param): Include params-list.h.  Move define
	DEFPARAM, include params.def and undef DEFPARAM ...
	* params-list.h: ... here.  New file.

From-SVN: r227566
2015-09-08 21:20:51 +00:00
Sebastian Pop d6bb5ccfeb remove -floop-* flags
2015-08-27  Sebastian Pop  <s.pop@samsung.com>

	* Makefile.in (OBJS): Remove graphite-blocking.o and
	graphite-interchange.o.
	* common.opt (floop-strip-mine, floop-interchange, floop-block):
	Alias of floop-nest-optimize.
	* doc/invoke.texi (floop-strip-mine, floop-interchange, floop-block):
	Document as alias of -floop-nest-optimize.
	* graphite-blocking.c: Remove.
	* graphite-interchange.c: Remove.
	* graphite-optimize-isl.c: Include dumpfile.h.
	(getScheduleForBand): Add dump for tiled loops.  Use
	PARAM_LOOP_BLOCK_TILE_SIZE instead of hard coded constant.
	* graphite-poly.c (scop_max_loop_depth): Remove.
	(print_scattering_function_1): Remove.
	(print_scattering_function): Remove.
	(print_scattering_functions): Remove.
	(debug_scattering_function): Remove.
	(debug_scattering_functions): Remove.
	(apply_poly_transforms): Remove use of flag_loop_block,
	flag_loop_strip_mine, and flag_loop_interchange.
	(new_poly_bb): Remove use of PBB_TRANSFORMED, PBB_SAVED, and
	PBB_ORIGINAL.
	(print_pdr_access_layout): Remove.
	(print_pdr): Print ISL representation.
	(new_scop): Remove use of SCOP_ORIGINAL_SCHEDULE,
	SCOP_TRANSFORMED_SCHEDULE, and SCOP_SAVED_SCHEDULE.
	(free_scop): Same.
	(openscop_print_pbb_domain): Remove.
	(print_pbb): Remove call to print_scattering_function.
	(openscop_print_scop_context): Remove.
	(print_scop_context): Do not print matrices anymore.
	(print_scop): Do not print SCOP_ORIGINAL_SCHEDULE and
	SCOP_TRANSFORMED_SCHEDULE.
	(print_isl_set): Add printing of a new line.
	(print_isl_map): Same.
	(print_isl_aff): Same.
	(print_isl_constraint): Same.
	(loop_to_lst): Remove.
	(scop_to_lst): Remove.
	(lst_indent_to): Remove.
	(print_lst): Remove.
	(debug_lst): Remove.
	(dot_lst_1): Remove.
	(dot_lst): Remove.
	(reverse_loop_at_level): Remove.
	(reverse_loop_for_pbbs): Remove.
	* graphite-poly.h (pdr_dim_iter_domain): Remove.
	(pdr_nb_params): Remove.
	(pdr_alias_set_dim): Remove.
	(pdr_subscript_dim): Remove.
	(pdr_iterator_dim): Remove.
	(pdr_parameter_dim): Remove.
	(same_pdr_p): Remove.
	(struct poly_scattering): Remove.
	(struct poly_bb): Remove _original, _transformed, _saved.
	(PBB_DOMAIN, PBB_ORIGINAL, PBB_ORIGINAL_SCATTERING): Remove.
	(PBB_TRANSFORMED, PBB_TRANSFORMED_SCATTERING, PBB_SAVED): Remove.
	(PBB_NB_LOCAL_VARIABLES): Remove.
	(PBB_NB_SCATTERING_TRANSFORM): Remove.
	(schedule_to_scattering): Remove.
	(number_of_write_pdrs): Remove.
	(pbb_dim_iter_domain): Remove.
	(pbb_nb_params): Remove.
	(pbb_nb_scattering_orig): Remove.
	(pbb_nb_scattering_transform): Remove.
	(pbb_nb_dynamic_scattering_transform): Remove.
	(pbb_nb_local_vars): Remove.
	(pbb_iterator_dim): Remove.
	(pbb_parameter_dim): Remove.
	(psco_scattering_dim): Remove.
	(psct_scattering_dim): Remove.
	(psct_local_var_dim): Remove.
	(psco_iterator_dim): Remove.
	(psct_iterator_dim): Remove.
	(psco_parameter_dim): Remove.
	(psct_parameter_dim): Remove.
	(psct_dynamic_dim): Remove.
	(psct_static_dim): Remove.
	(psct_add_local_variable): Remove.
	(new_lst_loop): Remove.
	(new_lst_stmt): Remove.
	(free_lst): Remove.
	(copy_lst): Remove.
	(lst_add_loop_under_loop): Remove.
	(lst_depth): Remove.
	(lst_dewey_number): Remove.
	(lst_dewey_number_at_depth): Remove.
	(lst_pred): Remove.
	(lst_succ): Remove.
	(lst_find_pbb): Remove.
	(find_lst_loop): Remove.
	(lst_find_first_pbb): Remove.
	(lst_empty_p): Remove.
	(lst_find_last_pbb): Remove.
	(lst_contains_p): Remove.
	(lst_contains_pbb): Remove.
	(lst_create_nest): Remove.
	(lst_remove_from_sequence): Remove.
	(lst_remove_loop_and_inline_stmts_in_loop_father): Remove.
	(lst_niter_for_loop): Remove.
	(pbb_update_scattering): Remove.
	(lst_update_scattering_under): Remove.
	(lst_update_scattering): Remove.
	(lst_insert_in_sequence): Remove.
	(lst_replace): Remove.
	(lst_substitute_3): Remove.
	(lst_distribute_lst): Remove.
	(lst_remove_all_before_including_pbb): Remove.
	(lst_remove_all_before_excluding_pbb): Remove.
	(struct scop): Remove original_schedule, transformed_schedule, and
	saved_schedule.
	(SCOP_ORIGINAL_SCHEDULE, SCOP_TRANSFORMED_SCHEDULE): Remove.
	(SCOP_SAVED_SCHEDULE): Remove.
	(poly_scattering_new): Remove.
	(poly_scattering_free): Remove.
	(poly_scattering_copy): Remove.
	(store_scattering_pbb): Remove.
	(store_lst_schedule): Remove.
	(restore_lst_schedule): Remove.
	(store_scattering): Remove.
	(restore_scattering_pbb): Remove.
	(restore_scattering): Remove.
	* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons):
	Remove scattering_dimensions.  Do not use pbb_dim_iter_domain:
	compute the scattering polyhedron dimension from the dimension of
	pbb->domain.
	(build_scop_scattering): Update call to
	build_pbb_scattering_polyhedrons.
	(build_poly_scop): Remove call to scop_to_lst.
	* graphite.c (graphite_transform_loops): Add call to print_scop.
	(gate_graphite_transforms): Remove use of flag_loop_block,
	flag_loop_interchange, and flag_loop_strip_mine.

testsuite/

	* gcc.dg/graphite/graphite.exp (interchange_files, block_files):
	Replaced by opt_files, compile with -floop-nest-optimize.
	* g++.dg/graphite/graphite.exp: Same.
	* gfortran.dg/graphite/graphite.exp: Same.
	* gcc.dg/graphite/block-0.c: Adjust pattern.
	* gcc.dg/graphite/block-1.c: Same.
	* gcc.dg/graphite/block-3.c: Same.
	* gcc.dg/graphite/block-4.c: Same.
	* gcc.dg/graphite/block-5.c: Same.
	* gcc.dg/graphite/block-6.c: Same.
	* gcc.dg/graphite/block-7.c: Same.
	* gcc.dg/graphite/block-8.c: Same.
	* gcc.dg/graphite/block-pr47654.c: Same.
	* gcc.dg/graphite/interchange-0.c: Same.
	* gcc.dg/graphite/interchange-1.c: Same.
	* gcc.dg/graphite/interchange-10.c: Same.
	* gcc.dg/graphite/interchange-11.c: Same.
	* gcc.dg/graphite/interchange-12.c: Same.
	* gcc.dg/graphite/interchange-13.c: Same.
	* gcc.dg/graphite/interchange-14.c: Same.
	* gcc.dg/graphite/interchange-15.c: Same.
	* gcc.dg/graphite/interchange-3.c: Same.
	* gcc.dg/graphite/interchange-4.c: Same.
	* gcc.dg/graphite/interchange-5.c: Same.
	* gcc.dg/graphite/interchange-6.c: Same.
	* gcc.dg/graphite/interchange-7.c: Same.
	* gcc.dg/graphite/interchange-8.c: Same.
	* gcc.dg/graphite/interchange-9.c: Same.
	* gcc.dg/graphite/interchange-mvt.c: Same.
	* gcc.dg/graphite/pr37485.c: Same.
	* gcc.dg/graphite/uns-block-1.c: Same.
	* gcc.dg/graphite/uns-interchange-12.c: Same.
	* gcc.dg/graphite/uns-interchange-14.c: Same.
	* gcc.dg/graphite/uns-interchange-15.c: Same.
	* gcc.dg/graphite/uns-interchange-9.c: Same.
	* gcc.dg/graphite/uns-interchange-mvt.c: Same.
	* gfortran.dg/graphite/interchange-3.f90: Same.

From-SVN: r227277
2015-08-27 19:07:04 +00: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
Uros Bizjak 27f40df410 Makefile.in (.INTERMEDIATE): Add gpl.pod.
* Makefile.in (.INTERMEDIATE): Add gpl.pod.

From-SVN: r226720
2015-08-07 14:12:41 +02:00
Segher Boessenkool 0027ed3d7a * Makefile.in (OBJS): Put gimple-match.o and generic-match.o first.
From-SVN: r226514
2015-08-03 17:33:45 +02:00
Ulrich Weigand 4c0cca1801 configure.ac: Set aliasing_flags to -fno-strict-aliasing if...
gcc/ChangeLog:

	* configure.ac: Set aliasing_flags to -fno-strict-aliasing if
	the host compiler is affected by placement new aliasing bug.
	* configure: Regenerate.
	* Makefile.in (ALIASING_FLAGS): New variable.
	(ALL_CXXFLAGS): Add $(ALIASING_FLAGS).

From-SVN: r226499
2015-08-03 11:48:57 +00:00
Sebastian Pop 8d2ccbd266 remove tree-browser
* Makefile.in: Remove use of TREEBROWSER.
	* config.in: Regenerated.
	* configure: Regenerated.
	* configure.ac: Remove definition of TREEBROWSER.
	* tree-browser.c: Removed.
	* tree-browser.def: Removed.

From-SVN: r226214
2015-07-25 09:29:11 +00: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
Sebastian Pop 49b8fe6c1a fix pr46851 and pr60340: remove unmaintained omega dependence test
Regstrapped on amd64-linux.

2015-07-18  Sebastian Pop  <s.pop@samsung.com>

	PR middle-end/46851
	PR middle-end/60340
	* Makefile.in: Removed omega.o.
	* common.opt: Remove flag fcheck-data-deps.
	* doc/invoke.texi: Remove documentation for fcheck-data-deps and
	its associated params: omega-max-vars, omega-max-geqs,
	omega-max-eqs, omega-max-wild-cards, omega-hash-table-size,
	omega-max-keys, omega-eliminate-redundant-constraints.
	* doc/loop.texi: Remove all the section on Omega.
	* graphite-blocking.c: Include missing params.h: it used to be
	included through tree-data-ref.h and omega.h.
	* graphite-isl-ast-to-gimple.c: Same.
	* graphite-optimize-isl.c: Same.
	* graphite-sese-to-poly.c: Same.
	* graphite.c: Same.
	* omega.c: Remove.
	* omega.h: Remove.
	* params.def: Removed PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
	PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
	PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS, and
	PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS.
	* passes.def: Remove pass_check_data_deps.
	* tree-data-ref.c (dump_affine_function): Declare DEBUG_FUNCTION.
	(dump_conflict_function): Same.
	(dump_subscript): Same.
	(print_direction_vector): Same.
	(print_dir_vectors): Same.
	(print_lambda_vector): Same.
	(print_dist_vectors): Same.
	(dump_data_dependence_relation): Same.
	(dump_data_dependence_relations): Same.
	(dump_dist_dir_vectors): Same.
	(dump_ddrs): Same.
	(init_omega_eq_with_af): Removed.
	(omega_extract_distance_vectors): Removed.
	(omega_setup_subscript): Removed.
	(init_omega_for_ddr_1): Removed.
	(init_omega_for_ddr): Removed.
	(ddr_consistent_p): Removed.
	(compute_affine_dependence): Do not use omega to check data
	dependences.
	(compute_data_dependences_for_bb): Removed.
	(analyze_all_data_dependences): Removed.
	(tree_check_data_deps): Removed.
	* tree-data-ref.h: Do not include omega.h.
	(compute_data_dependences_for_bb): Removed.
	(tree_check_data_deps): Removed.
	* tree-ssa-loop.c (pass_check_data_deps): Removed.
	(make_pass_check_data_deps): Removed.
	* tree-ssa-phiopt.c: Include params.h.
	* tree-vect-data-refs.c: Same.
	* tree-vect-slp.c: Same.

testsuite/
	* gcc.dg/tree-ssa/pr42327.c: Removed.
	* g++.dg/other/pr35011.C: Removed.

From-SVN: r225979
2015-07-18 01:11:05 +00:00
H.J. Lu 96a58590dd This patch syncs zlib.m4 with binutils-gdb and uses AM_ZLIB from zlib.m4
in gcc/configure.ac.

config/

	* zlib.m4: Sync with binutils-gdb.

gcc/

	* Makefile.in (top_srcdir): New.
	* configure.ac: Use AM_ZLIB.
	* configure: Regeneated.

From-SVN: r225774
2015-07-14 07:25:35 -07:00
Marek Polacek ca87c493f7 re PR tree-optimization/66718 (Non-invariant ADDR_EXPR not vectorized)
PR tree-optimization/66718
	* Makefile.in (OBJS): Add gimple-laddress.o. 
	* passes.def: Schedule pass_laddress.
	* timevar.def (DEFTIMEVAR): Add TV_GIMPLE_LADDRESS.
	* tree-pass.h (make_pass_laddress): Declare.
	* gimple-laddress.c: New file.

	* gcc.dg/vect/vect-126.c: New test.

From-SVN: r225604
2015-07-09 09:01:51 +00:00
Richard Sandiford 4bccb39eba Makefile.in (TARGET_DEF): Add target-insns.def.
gcc/
	* Makefile.in (TARGET_DEF): Add target-insns.def.
	(.PRECIOUS, simple_rtl_generated_h): Add insn-target-def.h.
	(build/gentarget-def.o): New rule.
	(genprogrtl): Add target-def.
	* target-insns.def, gentarget-def.c: New files.
	* target.def: Add targetm.have_* and targetm.gen_* hooks,
	based on the contents of target-insns.def.
	* defaults.h (HAVE_simple_return, gen_simple_return): Delete.
	(HAVE_return, gen_return): Delete.
	* target-def.h: Include insn-target-def.h.
	* cfgrtl.c (force_nonfallthru_and_redirect): Use targetm interface
	instead of direct calls.  Rely on them to do the appropriate assertions.
	* function.c (gen_return_pattern): Likewise.  Return an rtx_insn *.
	(convert_jumps_to_returns): Use targetm interface instead of
	direct calls.
	(thread_prologue_and_epilogue_insns): Likewise.
	* reorg.c (find_end_label, dbr_schedule): Likewise.
	* shrink-wrap.h (SHRINK_WRAPPING_ENABLED): Likewise.
	* shrink-wrap.c (convert_to_simple_return): Likewise.
	(try_shrink_wrapping): Use SHRINK_WRAPPING_ENABLED.

From-SVN: r224979
2015-06-25 17:18:12 +00:00
Andrew MacLeod 2bb8cb5896 function.h (struct rtl_data): Remove struct and accessor macros.
2015-06-17  Andrew MacLeod  <amacleod@redhat.com>

	* function.h (struct rtl_data): Remove struct and accessor macros.
	* emit-rtl.h (struct rtl_data): Relocate to here.
	* Makefile.in (GTFILES): Add emit-rtl.h.
	* df-core.c: Include emit-rtl.h.
	* genattrtab.c: Likewise.
	* genconditions.c: Likewise.
	* genpreds.c: Likewise.
	* genrecog.c: Likewise.
	* regcprop.c: Likewise.
	* resource.c: Likewise.
	* sched-rgn.c: Likewise.
	* config/aarch64/cortex-a57-fma-steering.c: Likewise.
	* config/i386/winnt.c: Likewise.

From-SVN: r224573
2015-06-17 18:53:03 +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
Vidya Praveen f17339ceb3 Makefile.in: Pick up gcov-dump dependencies from gcc/ directory rather than from gcc/build...
2015-06-01  Vidya Praveen  <vidyapraveen@arm.com>

	* Makefile.in: Pick up gcov-dump dependencies from gcc/ directory
	rather than from gcc/build directory.

From-SVN: r223992
2015-06-01 17:42:30 +01:00
Vidya Praveen 003f2d3463 Fix Makefile dependencies.
* Makefile.in: Fix gcov dependencies that should
	not point to a build folder.

From-SVN: r223981
2015-06-01 14:09:19 +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 2d44c7dea7 New memory allocation statistics infrastructure.
* Makefile.in: Add additional dependencies related to memory report
	enhancement.
	* alloc-pool.c (allocate_pool_descriptor): Use new ctor.
	* bitmap.c (struct bitmap_descriptor_d): Remove.
	(struct loc): Likewise.
	(struct bitmap_desc_hasher): Likewise.
	(bitmap_desc_hasher::hash): Likewise.
	(bitmap_desc_hasher::equal): Likewise.
	(get_bitmap_descriptor): Likewise.
	(bitmap_register): User new memory descriptor API.
	(register_overhead): Likewise.
	(bitmap_find_bit): Register nsearches and search_iter statistics.
	(struct bitmap_output_info): Remove.
	(print_statistics): Likewise.
	(dump_bitmap_statistics): Use new memory descriptor.
	* bitmap.h (struct bitmap_usage): New class.
	* genmatch.c: Extend header file inclusion.
	* genpreds.c: Likewise.
	* ggc-common.c (struct ggc_usage): New class.
	(struct ggc_loc_desc_hasher): Remove.
	(ggc_loc_desc_hasher::hash): Likewise.
	(ggc_loc_desc_hasher::equal): Likewise.
	(struct ggc_ptr_hash_entry): Likewise.
	(struct ptr_hash_hasher): Likewise.
	(ptr_hash_hasher::hash): Likewise.
	(ptr_hash_hasher::equal): Likewise.
	(make_loc_descriptor): Likewise.
	(ggc_prune_ptr): Likewise.
	(dump_ggc_loc_statistics): Use new memory descriptor.
	(ggc_record_overhead): Likewise.
	(ggc_free_overhead): Likewise.
	(final_cmp_statistic): Remove.
	(cmp_statistic): Likewise.
	(ggc_add_statistics): Liekwise.
	(ggc_prune_overhead_list): Likewise.
	* hash-map-traits.h: New file.
	* hash-map.h (struct default_hashmap_traits): Move the traits to a
	separate header file.
	* hash-set.h: Pass memory statistics info to ctor.
	* hash-table.c (void dump_hash_table_loc_statistics): New function.
	* hash-table.h (hash_table::hash_table): Add new ctor arguments.
	(hash_table::~hash_table): Register memory release operation.
	(hash_table::alloc_entries): Handle memory allocation operation.
	(hash_table::expand): Likewise.
	* inchash.c (iterative_hash_hashval_t): Move implementation to header
	file.
	(iterative_hash_host_wide_int): Likewise.
	* inchash.h (class hash): Likewise.
	* mem-stats-traits.h: New file.
	* mem-stats.h: New file.
	(mem_location): Add new class.
	(mem_usage): Likewise.
	(mem_alloc_description): Likewise.
	* sese.c: Add new header file inclusision.
	* toplev.c (dump_memory_report): Add report for hash_table, hash_map
	and hash_set.
	* tree-sra.c: Add new header file inclusision.
	* vec.c (struct vec_descriptor): Remove.
	(hash_descriptor): Likewise.
	(struct vec_usage): Likewise.
	(struct ptr_hash_entry): Likewise.
	(hash_ptr): Likewise.
	(eq_ptr): Likewise.
	(vec_prefix::register_overhead): Use new memory descriptor API.
	(vec_prefix::release_overhead): Likewise.
	(add_statistics): Remove.
	(dump_vec_loc_statistics): Use new memory descriptor API.
	* vec.h (struct vec_prefix): Likewise.
	(va_heap::reserve): Likewise.
	(va_heap::release): Likewise.
	* emit-rtl.c (gen_raw_REG): Fix passing MEM_STAT.

From-SVN: r223748
2015-05-27 12:47:22 +00:00
Jim Wilson a95492ab85 Makefile.in (check_gcc_parallelize): Delete.
gcc/
	* Makefile.in (check_gcc_parallelize): Delete.
	(lang_checks_parallelized): Update comment.
gcc/c
	* Make-lang.in (check_gcc_pallelize): Define.
gcc/cp
	* Make-lang.in (check_g++_parallelize): Update comment.
gcc/fortran
	* Make-lang.in (check_gfortran_parallelize): Update comment.

From-SVN: r223597
2015-05-22 16:39:06 -07:00
Jason Merrill 703245d706 revert: Makefile.in (GCC_WARN_CXXFLAGS): Add -std=c++98.
Revert:
	* Makefile.in (GCC_WARN_CXXFLAGS): Add -std=c++98.

From-SVN: r223314
2015-05-18 16:22:14 -04:00
Jason Merrill 87734648c9 * Makefile.in (GCC_WARN_CXXFLAGS): Add -std=c++98.
From-SVN: r223312
2015-05-18 15:21:54 -04:00
Richard Biener 2ae1d1b8b2 re PR middle-end/66110 (uint8_t memory access not optimized)
2015-05-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/66110
	* alias.c (alias_sets_conflict_p): Do not treat has_zero_child
	specially.
	* Makefile.in (dfp.o-warn): Add -Wno-strict-aliasing.

	* gcc.dg/alias-2.c: Adjust.
	* gcc.dg/tree-ssa/ssa-dse-17.c: New testcase.

From-SVN: r223126
2015-05-13 10:53:42 +00:00
David Malcolm c3388e6249 Implement -Wmisleading-indentation
gcc/ChangeLog:
	* doc/invoke.texi (Warning Options): Add -Wmisleading-indentation.
	(-Wmisleading-indentation): New option.
	* Makefile.in (C_COMMON_OBJS): Add c-family/c-indentation.o.

gcc/c-family/ChangeLog:
	* c-common.h (warn_for_misleading_indentation): New prototype.
	* c-indentation.c: New file.
	* c.opt (Wmisleading-indentation): New option.

gcc/c/ChangeLog:
	* c-parser.c (c_parser_if_body): Add param "if_loc", use it
	to add a call to warn_for_misleading_indentation.
	(c_parser_else_body): Likewise, adding param "else_loc".
	(c_parser_if_statement): Check for misleading indentation.
	(c_parser_while_statement): Likewise.
	(c_parser_for_statement): Likewise.

gcc/cp/ChangeLog:
	* parser.c (cp_parser_selection_statement): Add location and
	guard_kind arguments to calls to
	cp_parser_implicitly_scoped_statement.
	(cp_parser_iteration_statement): Likewise for calls to
	cp_parser_already_scoped_statement.
	(cp_parser_implicitly_scoped_statement): Add "guard_loc" and
	"guard_kind" params; use them to warn for misleading
	indentation.
	(cp_parser_already_scoped_statement): Likewise.

gcc/testsuite/ChangeLog:
	* c-c++-common/Wmisleading-indentation.c: New testcase.
	* c-c++-common/Wmisleading-indentation-2.c: New testcase.
	* c-c++-common/Wmisleading-indentation-2.md: New file.

libcpp/ChangeLog:
	* directives.c (do_line): Set seen_line_directive on line_table.
	(do_linemarker): Likewise.
	* include/line-map.h (struct line_maps): Add new field
	"seen_line_directive".

From-SVN: r223098
2015-05-12 20:57:38 +00:00
Jakub Jelinek a6c014db50 Makefile.in (PATCHLEVEL_c): New variable.
* Makefile.in (PATCHLEVEL_c): New variable.
	(DATESTAMP_s, REVISION_s): If PATCHLEVEL_c is not 0,
	expand the same way as if DEVPHASE_c was non-empty.

From-SVN: r222762
2015-05-04 12:39:16 +02:00
Richard Sandiford 72d33bd3d2 Makefile.in (build/genrecog.o): Depend on inchash.h.
gcc/
	* Makefile.in (build/genrecog.o): Depend on inchash.h.
	(build/genrecog$(build_exeext): Depend on build/hash-table.o and
	build/inchash.o
	* genrecog.c: Rewrite most of the code except for the third page.

From-SVN: r222575
2015-04-29 13:32:59 +00:00
Richard Sandiford 34ba5affde inchash.h, inchash.c: Include bconfig.h for build objects.
gcc/
	* inchash.h, inchash.c: Include bconfig.h for build objects.
	* Makefile.in (build/inchash.o): New rule.

From-SVN: r222574
2015-04-29 13:32:34 +00:00
Jeff Law f6c72af46f re PR tree-optimization/47679 (Strange uninitialized warning after SRA)
PR tree-optimization/47679
	* Makefile.in (OBJS); Add tree-ssa-scopedtables.o.
	* tree-ssa-scopedtables.c: New file.
	* tree-ssa-scopedtables.h: New file.
	* tree-ssa-dom.c: Include tree-ssa-scopedtables.h.
	(const_and_copies): Change name/type.
	(record_const_or_copy): Move into tree-ssa-scopedtables.c
	(record_const_or_copy_1): Similarly.
	(restore_vars_to_original_value): Similarly.
	(pass_dominator::execute): Create and destroy const_and_copies table.
	(thread_across_edge): Update passing of const_and_copies.
	(record_temporary_equivalence): Use method calls rather than
	manipulating const_and_copies directly.
	(record_equality, cprop_into_successor_phis): Similarly.
	(dom_opt_dom_walker::before_dom_children): Similarly.
	(dom_opt_dom_walker::after_dom_children): Similarly.
	(eliminate_redundant_computations): Similarly.
	* tree-ssa-threadedge.c (remove_temporary_equivalences): Delete.
	(record_temporary_equivalence): Likewise.
	(invalidate_equivalences): Likewise.
	(record_temporary_equivalences_from_phis): Update due to type
	change of const_and_copies.  Use method calls rather than
	manipulating the stack directly.
	(record_temporary_equivalences_from_stmts_at_dest): Likewise.
	(thread_through_normal_block, thread_across_edge): Likewise.
	(thread_across_edge): Likewise.
	* tree-ssa-threadedge.h (thread_across_edge): Update prototype.
	* tree-vrp.c: Include tree-ssa-scopedtables.h.  Change type
	of equiv_stack.
	(identify_jump_threads): Update due to type change of equiv_stack.
	(finalize_jump_threads): Delete the equiv_stack when complete.

From-SVN: r222195
2015-04-17 13:24:17 -06:00
Jakub Jelinek b626318e12 re PR plugins/61176 (plugin builds including gimple.h not building)
PR plugins/61176
	* Makefile.in (install-plugin): Add all gcc/*.{h,def} files
	automatically to $headers.

From-SVN: r221786
2015-03-31 07:31:57 +02:00
Jeff Law af3eb11068 re PR rtl-optimization/64317 (Ineffective allocation of PIC base register)
PR rtl-optimization/64317
        * Makefile.in (OBJS): Add gcse-common.c
        * gcse.c: Include gcse-common.h
        (struct modify_pair_s): Move structure definition to gcse-common.h
        (compute_transp): Move function to gcse-common.c.
        (canon_list_insert): Similarly.
        (record_last_mem_set_info): Break out some code and put it into
        gcse-common.c.  Call into the new common code.
        (compute_local_properties): Pass additional arguments to compute_transp.
        * postreload-gcse.c: Include gcse-common.h and df.h
        (modify_mem_list_set, blocks_with_calls): New variables.
        (modify_mem_list, canon_modify_mem_list, transp): Likewise.
        (get_bb_avail_insn): Pass in the expression index too.
        (alloc_mem): Allocate memory for the new bitmaps and lists.
        (free_mem): Free memory for the new bitmaps and lists.
        (insert_expr_in_table): Record a bitmap index for each entry we
        add to the table.
        (record_last_mem_set_info): Call into common code in gcse-common.c.
        (get_bb_avail_insn): If no available insn was found in the requested
        BB.  If BB has a single predecessor, see if the expression is
        transparent in BB and available in that single predecessor.
        (compute_expr_transp): New wrapper for compute_transp.
        (eliminate_partially_redundant_load): Pass expression's bitmap_index
        to get_bb_avail_insn.  Compute next_pred_bb_end a bit later.
        (gcse_after_reload_main): If there are elements in the hash table,
        then compute transparency for all the elements in the hash table.
        * gcse-common.h: New file.
        * gcse-common.c: New file.

From-SVN: r221585
2015-03-22 23:21:04 -06:00
Tom de Vries a79b7ec516 Mark omp thread functions as parallelized
2015-03-21  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/65458
	* cgraph.c (cgraph_node::dump): Handle parallelized_function field.
	* cgraph.h (cgraph_node): Add parallelized_function field.
	* lto-cgraph.c (lto_output_node): Write parallelized_function field.
	(input_overwrite_node): Read parallelized_function field.
	* omp-low.c (expand_omp_taskreg, finalize_task_copyfn): Set
	parallelized_function on cgraph_node for child_fn.
	* tree-parloops.c: Add include of plugin-api.h, ipa-ref.h and cgraph.h.
	Remove include of gt-tree-parloops.h.
	(parallelized_functions): Remove static variable.
	(parallelized_function_p): Rewrite using parallelized_function field of
	cgraph_node.
	(create_loop_fn): Remove adding to parallelized_functions.
	* Makefile.in (GTFILES): Remove tree-parloops.c

From-SVN: r221551
2015-03-21 10:14:10 +00:00