Commit Graph

93 Commits

Author SHA1 Message Date
Jakub Jelinek e1201dff2f re PR c++/80297 (Compiler time crash: type mismatch in binary expression)
PR c++/80297
	* genmatch.c (capture::gen_transform): For GENERIC unshare_expr
	captures used multiple times, except for the last use.
	* generic-match-head.c: Include gimplify.h.

	* g++.dg/torture/pr80297.C: New test.

Co-Authored-By: Richard Biener <rguenther@suse.de>

From-SVN: r246693
2017-04-04 21:14:47 +02:00
Richard Biener d59b72533f re PR other/80050 (gcc/genmatch.c: PVS-Studio: V590)
2017-03-17  Richard Biener  <rguenther@suse.de>

	PR middle-end/80050
	* genmatch.c (parser::next): Remove pointless check for CPP_EOF.
	(parser::peek): Likewise.

From-SVN: r246218
2017-03-17 11:04:00 +00:00
Richard Biener c265c2dd6f re PR bootstrap/79567 (Compiler-warning "unknown escape sequence '\x'" about genmatch-generated C-files on mingw-host)
2017-02-17  Richard Biener  <rguenther@suse.de>

	PR bootstrap/79567
	* genmatch.c (output_line_directive): Handle DIR_SEPARATOR_2.

From-SVN: r245527
2017-02-17 10:19:21 +00:00
Jakub Jelinek d003cf5ef6 genmatch.c (dt_node::gen_kids_1): If generic_exprs include SSA_NAME and exprs_len || fns_len...
* genmatch.c (dt_node::gen_kids_1): If generic_exprs include SSA_NAME
	and exprs_len || fns_len, emit the code for SSA_NAME next to the exprs
	and fns handling, rather than in a separate case SSA_NAME.

From-SVN: r244012
2017-01-03 08:17:38 +01:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Richard Biener 14e7281244 fold-const.c (tree_swap_operands_p): Remove unused arg.
2016-11-09  Richard Biener  <rguenther@suse.de>

	* fold-const.c (tree_swap_operands_p): Remove unused arg.
	* fold-const.c (tree_swap_operands_p): Likewise.
	(fold_binary_loc): Adjust.
	(fold_ternary_loc): Likewise.
	* genmatch.c (dt_operand::gen_gimple_exp): Likewise.
	* gimple-fold.c (fold_stmt_1): Likewise.
	* gimple-match-head.c (gimple_resimplify2): Likewise.
	(gimple_resimplify3): Likewise.
	(gimple_simplify): Likewise.
	* tree-ssa-dom.c (record_equality): Likewise.
	* tree-ssa-reassoc.c (optimize_range_tests_var_bound): Likewise.
	* tree-ssa-sccvn.c (vn_nary_op_compute_hash): Likewise.
	* tree-ssa-threadedge.c (simplify_control_stmt_condition_1): Likewise.

From-SVN: r242004
2016-11-09 15:15:28 +00:00
Richard Biener 699acd5b64 genmatch.c (dt_operand::gen_gimple_expr): Use get_name to get at the operand to look at with TREE_OPERAND for generic...
2016-10-18  Richard Biener  <rguenther@suse.de>

	* genmatch.c (dt_operand::gen_gimple_expr): Use get_name to
	get at the operand to look at with TREE_OPERAND for generic
	sub-nodes.

From-SVN: r241295
2016-10-18 07:25:40 +00:00
Richard Biener 2eef1fc113 re PR target/77826 (ICE in decompose, at wide-int.h:928 w/ -m64 -O2 and above)
2016-10-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/77826
	* genmatch.c (struct capture): Add value_match member.
	(commutate): Preserve value_match.
	(lower_opt_convert): Likewise.
	(lower_cond): Likewise.
	(replace_id): Likewise.
	(struct dt_operand): Add value_match member.
	(decision_tree::cmp_node): Compare it.
	(decision_tree::insert_operand): Honor it when finding and
	when appending a DT_MATCH.
	(dt_operand::gen_match_op): Generate a type check after
	operand_equal_p if ! value_match for both GENERIC and GIMPLE.
	(parser::get_internal_capture_id): New helper.
	(parser::finish_match_operand): New function lowering @@<id>.
	(parser::parse_capture): Parse @@<id> as value-match.
	(parser::parse_expr): Use get_internal_capture_id.
	(parser::parse_simplify): Call finish_match_operand.
	(walk_captures): New helper.
	* match.pd (X - (X / Y) * Y -> X % Y): Use value-matching instead
	of operand_equal_p.
	((X /[ex] A) * A -> X): Likewise.
	((X | Y) ^ X -> Y & ~ X): Handle constants properly by using
	convert[12] and value-matching.
	((A | B) & (A | C) ->  A | (B & C)): Likewise.
	((X | Y) | Y -> X | Y): Likewise.
	((X ^ Y) ^ Y -> X): Likewise.
	(A - (A & B) -> ~B & A): Likewise.
	((T)(P + A) - (T)P -> (T) A): Likewise.
	((T)P - (T)(P + A) -> -(T) A): Likewise.
	((T)(P + A) - (T)(P + B) -> (T)A - (T)B): Likewise.
	* doc/match-and-simplify.texi: Amend capture section.

From-SVN: r241108
2016-10-13 12:15:38 +00:00
Richard Biener 496326bcc1 re PR middle-end/77863 (genmatch segfault on a wrong usage of an for operator)
2016-10-05  Richard Biener  <rguenther@suse.de>

	PR middle-end/77863
	* genmatch.c (capture_info::walk_c_expr): Diagnose unknown
	capture ids in c-exprs.

From-SVN: r240777
2016-10-05 11:58:25 +00:00
Richard Biener 39bb7d0152 re PR target/77826 (ICE in decompose, at wide-int.h:928 w/ -m64 -O2 and above)
2016-10-05  Richard Biener  <rguenther@suse.de>

	PR middle-end/77826
	* genmatch.c (dt_operand::gen_match_op): Amend operand_equal_p
	with types_match for GIMPLE code gen to handle type mismatched
	constants properly.
	(dt_operand::gen): Adjust.
	* match.pd ((X /[ex] A) * A -> X): Properly handle converted
	and constant A.

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

From-SVN: r240776
2016-10-05 11:38:59 +00:00
Richard Biener a5382f1c6b re PR middle-end/77842 (genmatch segfault on a missing brace)
2016-10-05  Richard Biener  <rguenther@suse.de>

	PR middle-end/77842
	* genmatch.c (parser::parse_c_expr): Handle premature EOF.

From-SVN: r240774
2016-10-05 09:36:27 +00:00
Richard Biener f00b6283fb re PR middle-end/77798 (465.tonto ICE with trunk with -O2)
2016-10-01  Richard Biener  <rguenther@suse.de>

	PR middle-end/77798
	* genmatch.c (get_operand_type): Add operand position arg
	and handle COND_EXPR comparison operand with fixed boolean_type_node.
	(expr::gen_transform): Adjust.
	(dt_simplify::gen_1): Likewise.

	* gfortran.fortran-torture/compile/pr77798.f90: New testcase.

From-SVN: r240696
2016-10-01 14:34:18 +00:00
Martin Sebor 3d7b83b671 c-ada-spec.c (dump_ada_function_declaration): Increase buffer size to guarantee it fits the output of the formatted function...
gcc/c-family/ChangeLog:

	* c-ada-spec.c (dump_ada_function_declaration): Increase buffer
	size to guarantee it fits the output of the formatted function
	regardless of its arguments.

gcc/cp/ChangeLog:

	* mangle.c: Increase buffer size to guarantee it fits the output
	of the formatted function regardless of its arguments.

gcc/go/ChangeLog:

	* gofrontend/expressions.cc: Increase buffer size to guarantee
	it fits the output of the formatted function regardless of its
	arguments.

gcc/java/ChangeLog:

	* decl.c (give_name_to_locals): Increase buffer size to guarantee
	it fits the output of the formatted function regardless of its
	arguments.
	* mangle_name.c (append_unicode_mangled_name): Same.

gcc/ChangeLog:

	* genmatch.c (parser::parse_expr): Increase buffer size to guarantee
	it fits the output of the formatted function regardless of its
	arguments.
	* gcc/genmodes.c (parser::parse_expr): Same.
	* gimplify.c (gimplify_asm_expr): Same.
	* passes.c (pass_manager::register_one_dump_file): Same.
	* print-tree.c (print_node): Same.

From-SVN: r239949
2016-09-01 16:47:49 -06:00
Trevor Saunders 8c6812476a use auto_vec for more local variables
gcc/c/ChangeLog:

2016-07-12  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* c-parser.c (c_parser_generic_selection): Make type of variable
	auto_vec.
	(c_parser_omp_declare_simd): Likewise.

gcc/ChangeLog:

2016-07-12  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* cfgexpand.c (expand_used_vars): Make the type of a local variable auto_vec.
	* genmatch.c (lower_for): Likewise.
	* haifa-sched.c (haifa_sched_init): Likewise.
	(add_to_speculative_block): Likewise.
	(create_check_block_twin): Likewise.
	* predict.c (handle_missing_profiles): Likewise.
	* tree-data-ref.c (loop_nest_has_data_refs): Likewise.
	* tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Likewise.
	* tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk): Likewise.
	(maybe_lower_iteration_bound): Likewise.
	* tree-ssa-sccvn.c (DFS): Likewise.
	* tree-stdarg.c (reachable_at_most_once): Likewise.
	* tree-vect-stmts.c (vectorizable_conversion): Likewise.
	(vectorizable_store): Likewise.

From-SVN: r238285
2016-07-13 02:44:52 +00:00
Richard Biener 30934c5da5 re PR middle-end/71526 (ICE: verify_gimple failed)
2016-06-14  Richard Biener  <rguenther@suse.de>

	PR middle-end/71526
	* genmatch.c (expr::gen_transform): Use in_type for comparisons
	if available.

	* gfortran.dg/pr71526.f90: New testcase.

From-SVN: r237441
2016-06-14 13:47:01 +00:00
Richard Biener e04d2a35c8 genmatch.c (comparison_code_p): New predicate.
2016-06-01  Richard Biener  <rguenther@suse.de>

	* genmatch.c (comparison_code_p): New predicate.
	(swap_tree_comparison): New function.
	(commutate): Add for_vec parameter to append new for entries.
	Support commutating relational operators by swapping it alongside
	operands.
	(lower_commutative): Adjust.
	(dt_simplify::gen): Do not pass artificial operators to gen
	functions.
	(decision_tree::gen): Do not add artificial operators as parameters.
	(parser::parse_expr): Verify operator commutativity when :c is
	applied.  Allow :C to override this.
	* match.pd: Adjust patterns to use :C instead of :c where required.

From-SVN: r236977
2016-06-01 09:00:57 +00:00
Marc Glisse 6b6aa8d388 match.pd: X + X --> X * 2 for integers
2016-04-26  Marc Glisse  <marc.glisse@inria.fr>

gcc/
	* genmatch.c (write_predicate): Add ATTRIBUTE_UNUSED.
	* fold-const.c (fold_binary_loc): Remove 2 transformations
	superseded by match.pd.
	* match.pd (x+x -> x*2): Generalize to integers.

gcc/testsuite/
	* gcc.dg/fold-plusmult.c: Adjust.
	* gcc.dg/no-strict-overflow-6.c: Adjust.
	* gcc.dg/gomp/loop-1.c: Xfail some tests.

From-SVN: r235444
2016-04-26 14:02:09 +00:00
Szabolcs Nagy e4ccecd5d0 [PATCH 1/2] (header usage fix) remove unused system header includes
2016-04-22  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* auto-profile.c: Remove <string.h> include.
	* ipa-icf-gimple.c: Remove <list> include.
	* diagnostic.c: Remove <new> include.
	* genmatch.c: Likewise.
	* pretty-print.c: Likewise.
	* toplev.c: Likewise
	* c/c-objc-common.c: Likewise.
	* cp/error.c: Likewise.
	* fortran/error.c: Likewise.

From-SVN: r235361
2016-04-22 10:57:56 +00:00
Richard Biener a3ca1bc5bd re PR tree-optimization/70251 (Wrong code with -O3 -march=skylake-avx512.)
2016-03-22  Richard Biener  <rguenther@suse.de>

	PR middle-end/70251
	* genmatch.c (gen_transform): Adjust last parameter to a three-state
	int...
	(capture::gen_transform): ... to change behavior when substituting
	a condition into cond or not-cond expr context.
	(dt_simplify::gen_1): Adjust.
	* gimple-match-head.c: Include gimplify.h for unshare_expr.
	* match.pd (A + (B vcmp C ? 1 : 0) -> A - (B vcmp C)): Revert
	last change and instead change to
	A + (B vcmp C ? 1 : 0) -> A - (B vcmp C ? -1 : 0).
	(A - (B vcmp C ? 1 : 0) -> A + (B vcmp C)): Likewise.

	* g++.dg/torture/pr70251.C: New testcase.

From-SVN: r234405
2016-03-22 14:38:42 +00:00
Richard Biener c954de7f5c genmatch.c (dt_node::gen_kids): Fix match code-gen for embedded GENERIC expressions in GIMPLE.
2016-03-02  Richard Biener  <rguenther@suse.de>

	* genmatch.c (dt_node::gen_kids): Fix match code-gen for embedded
	GENERIC expressions in GIMPLE.

From-SVN: r233902
2016-03-02 12:44:15 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Richard Biener 7b2eca0029 tree.h (tree_invariant_p): Declare.
2015-12-02  Richard Biener  <rguenther@suse.de>

	* tree.h (tree_invariant_p): Declare.
	* tree.c (tree_invariant_p): Export.
	* genmatch.c (dt_simplify::gen_1): For GENERIC code-gen never
	create SAVE_EXPRs but reject patterns if we would need to.

From-SVN: r231178
2015-12-02 14:50:32 +00:00
Richard Biener 2d3f4bf73c re PR ada/68590 (FAIL: gnat.dg/loop_optimization19.adb scan-tree-dump-not optimized "Index_Check")
2015-12-01  Richard Biener  <rguenther@suse.de>

	PR middle-end/68590
	* genmatch.c (struct capture_info): Add match_use_count.
	(capture_info::walk_match): Increment match_use_count.
	(dt_simplify::gen_1): For GENERIC, only wrap multi-use
	replacements in a save_expr if they occur more often than
	in the original expression.

From-SVN: r231110
2015-12-01 14:22:40 +00:00
Richard Biener 6be52f624e genmatch.c (dt_simplify::gen_1): For generic wrap all multi-result-use captures in a SAVE_EXPR.
2015-11-26  Richard Biener  <rguenther@suse.de>

	* genmatch.c (dt_simplify::gen_1): For generic wrap all
	multi-result-use captures in a SAVE_EXPR.

From-SVN: r230955
2015-11-26 13:45:45 +00:00
Trevor Saunders 76b6ddbfe2 destroy values as well as keys when removing them from hash maps
gcc/ChangeLog:

2015-11-24  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* hash-map-traits.h (simple_hashmap_traits ::remove): call
	destructors on values that are being removed.
	* mem-stats.h (hash_map): Pass type of values to
	simple_hashmap_traits.
	* tree-sra.c (sra_deinitialize): Remove work around for hash
	maps not destructing values.
	* genmatch.c (sinfo_hashmap_traits): Adjust.
	* tree-ssa-uncprop.c (val_ssa_equiv_hash_traits): Likewise.

From-SVN: r230801
2015-11-24 11:46:10 +00:00
Richard Sandiford b1dc4a20a7 Replace match.pd DEFINE_MATH_FNs with auto-generated lists
This patch autogenerates the operator lists for maths functions
like SQRT, adding an additional entry for internal functions.
E.g.:

        (define_operator_list SQRT
            BUILT_IN_SQRTF
            BUILT_IN_SQRT
            BUILT_IN_SQRTL
            IFN_SQRT)

and:

        (define_operator_list CABS
            BUILT_IN_CABSF
            BUILT_IN_CABS
            BUILT_IN_CABSL
            null)

(since there's no internal function for CABS).

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

gcc/
	* Makefile.in (MOSTLYCLEANFILES): Add cfn-operators.pd.
	(generated_files): Likewise.
	(s-cfn-operators, cfn-operators.pd): New rules.
	(s-match): Depend on cfn-operators.pd.
	* gencfn-macros.c: Expand comment to describe -o behavior.
	(print_define_operator_list): New function.
	(main): Accept -o.  Call print_define_operator_list.
	* genmatch.c (main): Add the current directory to the include path.
	* match.pd (DEFINE_MATH_FN): Delete.  Include cfn-operators.pd
	instead.

From-SVN: r230486
2015-11-17 18:49:10 +00:00
Richard Sandiford fa74b47a8c Add null identifiers to genmatch
This patch adds a null identifier that can never match anything and
can never be generated.  It is only valid in operator lists and fors.
Later patches will add uses of it.

The idea is to allow operator lists for maths functions that have
four entries:

- float built-in
- double built-in
- long double built-in
- internal function

Not all maths functions have an associated internal function,
and for those the final operator will be "null".  Any simplification
that tries to use a null substitution will be skipped.

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

gcc/
	* doc/match-and-simplify.texi: Document the "null" identifier.
	* genmatch.c (id_base::NULL_ID): New kind.
	(null_id): New variable.
	(get_operator): Add a parameter that says whether null identifiers
	are allowed.
	(contains_id): New function.
	(lower_for): Skip substitutions that would have a null_id in
	either the match or the result.
	(parser::parse_for): Allow the null identifier to be used.
	(parser::parse_operator_list): Likewise.
	(main): Initialize null_id.

From-SVN: r230485
2015-11-17 18:48:23 +00:00
Richard Sandiford c9e926ce2b Add genmatch support for internal functions
This patch makes genmatch match calls based on combined_fn rather
than built_in_function and extends the matching to internal functions.
It also uses fold_const_call to fold the calls to a constant, rather
than going through fold_builtin_n.

In order to slightly simplify the code and remove potential
ambiguity, the patch enforces lower case for tree codes
(foo->FOO_EXPR), caps for functions (no built_in_hypot->BUILT_IN_HYPOT)
and requires an exact match for user-defined identifiers.  The first two
were already met in practice but there were a couple of cases where
operator lists were defined in one case and used in another.

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

gcc/
	* match.pd: Use HYPOT and COS rather than hypot and cos.
	Use CASE_CFN_* macros.  Guard log/exp folds with
	SCALAR_FLOAT_TYPE_P.
	* genmatch.c (internal_fn): New enum.
	(fn_id::fn): Change to an unsigned int.
	(fn_id::fn_id): Accept internal_fn too.
	(add_builtin): Rename to...
	(add_function): ...this and turn into a template.
	(get_operator): Only try one variation if the original name fails.
	Only add _EXPR if the original name was all lower case.
	Try converting internal and built-in function names to their
	CFN equivalents.
	(expr::gen_transform): Use maybe_build_call_expr_loc for generic.
	(dt_simplify::gen_1): Likewise.
	(dt_node::gen_kids_1): Use gimple_call_combined_fn for gimple
	and get_call_combined_fn for generic.
	(dt_simplify::gen): Use combined_fn as the type of fn_ids.
	(decision_tree::gen): Likewise.
	(main): Use lower case in the strings for {VIEW_,}CONVERT[012].
	Use add_function rather than add_builtin.  Register internal
	functions too.
	* generic-match-head.c: Include case-cfn-macros.h.
	* gimple-fold.c (replace_stmt_with_simplification): Use
	gimple_call_combined_fn to test whether we can keep an
	existing call.
	* gimple-match.h (code_helper): Replace built_in_function
	with combined_fn.
	* gimple-match-head.c: Include fold-const-call.h, internal-fn.h
	and case-fn-macros.h.
	(gimple_resimplify1): Use fold_const_call.
	(gimple_resimplify2, gimple_resimplify3): Likewise.
	(build_call_internal, build_call): New functions.
	(maybe_push_res_to_seq): Use them.
	(gimple_simplify): Use fold_const_call.  Set *rcode to a combined_fn
	rather than a built-in function.
	* tree.h (build_call_expr_internal_loc): Declare.
	(maybe_build_call_expr_loc): Likewise.
	* tree.c (build_call_expr_internal_loc_array): New function.
	(maybe_build_call_expr_loc): Likewise.

From-SVN: r230484
2015-11-17 18:47:44 +00:00
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
Richard Sandiford 0aad019857 Move #undef DEF_BUILTIN* to builtins.def
I was confused at first why tree-core.h was undefining DEF_BUILTIN_CHKP
before defining it, then undefining it again after including builtins.def.
This is because builtins.def provides a default definition of
DEF_BUILTIN_CHKP, but leaves it up to the caller to undefine it where
necessary.  Similarly to the previous internal-fn.def patch, it seems
more obvious for builtins.def to #undef things unconditionally.

One argument might have been that keeping preprocessor stuff
out of the .def files makes it easier for non-cpp parsers.  In practice
though we already have #ifs and multiline #defines, so single-line #undefs
should be easy in comparison.

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

gcc/ada/
	* gcc-interface/utils.c: Don't undef DEF_BUILTIN.

gcc/c-family/
	* c-common.c: Don't undef DEF_BUILTIN.

gcc/jit/
	* jit-builtins.c: Don't undef DEF_BUILTIN.

gcc/lto/
	* lto-lang.c: Don't undef DEF_BUILTIN.

gcc/
	* builtins.def: #undef DEF_BUILTIN and DEF_BUILTIN_CHKP
	* builtins.c, genmatch.c, tree-core.h: Don't undef them here.

From-SVN: r229924
2015-11-07 10:18:38 +00:00
David Malcolm 8a64515099 Reimplement diagnostic_show_locus, introducing rich_location classes
gcc/ChangeLog:
	* diagnostic-color.c (color_dict): Eliminate "caret"; add "range1"
	and "range2".
	(parse_gcc_colors): Update comment to describe default GCC_COLORS.
	* diagnostic-core.h (warning_at_rich_loc): New declaration.
	(error_at_rich_loc): New declaration.
	(permerror_at_rich_loc): New declaration.
	(inform_at_rich_loc): New declaration.
	* diagnostic-show-locus.c (adjust_line): Delete.
	(struct point_state): New struct.
	(class colorizer): New class.
	(class layout_point): New class.
	(class layout_range): New class.
	(struct line_bounds): New.
	(class layout): New class.
	(colorizer::colorizer): New ctor.
	(colorizer::~colorizer): New dtor.
	(layout::layout): New ctor.
	(layout::print_source_line): New method.
	(layout::print_annotation_line): New method.
	(layout::get_state_at_point): New method.
	(layout::get_x_bound_for_row): New method.
	(diagnostic_show_locus): Reimplement in terms of class layout.
	(diagnostic_print_caret_line): Delete.
	* diagnostic.c (diagnostic_initialize): Replace
	MAX_LOCATIONS_PER_MESSAGE with rich_location::MAX_RANGES.
	(diagnostic_set_info_translated): Convert param from location_t
	to rich_location *.  Eliminate calls to set_location on the
	message in favor of storing the rich_location ptr there.
	(diagnostic_set_info): Convert param from location_t to
	rich_location *.
	(diagnostic_build_prefix): Break out array into...
	(diagnostic_kind_color): New variable.
	(diagnostic_get_color_for_kind): New function.
	(diagnostic_report_diagnostic): Colorize the option_text
	using the color for the severity.
	(diagnostic_append_note): Update for change in signature of
	diagnostic_set_info.
	(diagnostic_append_note_at_rich_loc): New function.
	(emit_diagnostic): Update for change in signature of
	diagnostic_set_info.
	(inform): Likewise.
	(inform_at_rich_loc): New function.
	(inform_n): Update for change in signature of diagnostic_set_info.
	(warning): Likewise.
	(warning_at): Likewise.
	(warning_at_rich_loc): New function.
	(warning_n): Update for change in signature of diagnostic_set_info.
	(pedwarn): Likewise.
	(permerror): Likewise.
	(permerror_at_rich_loc): New function.
	(error): Update for change in signature of diagnostic_set_info.
	(error_n): Likewise.
	(error_at): Likewise.
	(error_at_rich_loc): New function.
	(sorry): Update for change in signature of diagnostic_set_info.
	(fatal_error): Likewise.
	(internal_error): Likewise.
	(internal_error_no_backtrace): Likewise.
	(source_range::debug): New function.
	* diagnostic.h (struct diagnostic_info): Eliminate field
	"override_column".  Add field "richloc".
	(struct diagnostic_context): Add field "colorize_source_p".
	(diagnostic_override_column): Delete.
	(diagnostic_set_info): Convert param from location_t to
	rich_location *.
	(diagnostic_set_info_translated): Likewise.
	(diagnostic_append_note_at_rich_loc): New function.
	(diagnostic_num_locations): New function.
	(diagnostic_expand_location): Get the location from the
	rich_location.
	(diagnostic_print_caret_line): Delete.
	(diagnostic_get_color_for_kind): New declaration.
	* genmatch.c (linemap_client_expand_location_to_spelling_point): New.
	(error_cb): Update for change in signature of "error" callback.
	(fatal_at): Likewise.
	(warning_at): Likewise.
	* input.c (linemap_client_expand_location_to_spelling_point): New.
	* pretty-print.c (text_info::set_range): New method.
	(text_info::get_location): New method.
	* pretty-print.h (MAX_LOCATIONS_PER_MESSAGE): Eliminate this macro.
	(struct text_info): Eliminate "locations" array in favor of
	"m_richloc", a rich_location *.
	(textinfo::set_location): Add a "caret_p" param, and reimplement
	in terms of a call to set_range.
	(textinfo::get_location): Eliminate inline implementation in favor of
	an out-of-line reimplementation.
	(textinfo::set_range): New method.
	* rtl-error.c (diagnostic_for_asm): Update for change in signature
	of diagnostic_set_info.
	* tree-diagnostic.c (default_tree_printer): Update for new
	"caret_p" param for textinfo::set_location.
	* tree-pretty-print.c (percent_K_format): Likewise.

gcc/c-family/ChangeLog:
	* c-common.c (c_cpp_error): Convert parameter from location_t to
	rich_location *.  Eliminate the "column_override" parameter and
	the call to diagnostic_override_column.
	Update the "done_lexing" clause to set range 0
	on the rich_location, rather than overwriting a location_t.
	* c-common.h (c_cpp_error): Convert parameter from location_t to
	rich_location *.  Eliminate the "column_override" parameter.

gcc/c/ChangeLog:
	* c-decl.c (warn_defaults_to): Update for change in signature
	of diagnostic_set_info.
	* c-errors.c (pedwarn_c99): Likewise.
	(pedwarn_c90): Likewise.
	* c-objc-common.c (c_tree_printer): Update for new "caret_p" param
	for textinfo::set_location.

gcc/cp/ChangeLog:
	* error.c (cp_printer): Update for new "caret_p" param for
	textinfo::set_location.
	(pedwarn_cxx98): Update for change in signature of
	diagnostic_set_info.

gcc/fortran/ChangeLog:
	* cpp.c (cb_cpp_error): Convert parameter from location_t to
	rich_location *.  Eliminate the "column_override" parameter.
	* error.c (gfc_warning): Update for change in signature of
	diagnostic_set_info.
	(gfc_format_decoder): Update handling of %C/%L for changes
	to struct text_info.
	(gfc_diagnostic_starter): Use richloc when determining whether to
	print one locus or two.  When handling a location that will
	involve a call to diagnostic_show_locus, only attempt to print the
	locus for the primary location, and don't call into
	diagnostic_print_caret_line.
	(gfc_warning_now_at): Update for change in signature of
	diagnostic_set_info.
	(gfc_warning_now): Likewise.
	(gfc_error_now): Likewise.
	(gfc_fatal_error): Likewise.
	(gfc_error): Likewise.
	(gfc_internal_error): Likewise.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/diagnostic-test-show-locus-bw.c: New file.
	* gcc.dg/plugin/diagnostic-test-show-locus-color.c: New file.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: New file.
	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add the above.
	* lib/gcc-dg.exp: Load multiline.exp.

libcpp/ChangeLog:
	* errors.c (cpp_diagnostic): Update for change in signature
	of "error" callback.
	(cpp_diagnostic_with_line): Likewise, calling override_column
	on the rich_location.
	* include/cpplib.h (struct cpp_callbacks): Within "error"
	callback, convert param from source_location to rich_location *,
	and drop column_override param.
	* include/line-map.h (struct source_range): New struct.
	(struct location_range): New struct.
	(class rich_location): New class.
	(linemap_client_expand_location_to_spelling_point): New declaration.
	* line-map.c (rich_location::rich_location): New ctors.
	(rich_location::lazily_expand_location): New method.
	(rich_location::override_column): New method.
	(rich_location::add_range): New methods.
	(rich_location::set_range): New method.

From-SVN: r229884
2015-11-06 19:50:50 +00:00
Richard Sandiford 96285749d8 Move cexp simplifications to match.pd
This required reinstating support for captures in the result
of a simplification.  That part (genmatch.c) is by Richard B.

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

gcc/
2015-10-20  Richard Sandiford  <richard.sandiford@arm.com>
	    Richard Biener  <rguenther@suse.de>

	* genmatch.c (dt_simplify::gen): Skip captures that are
	part of the result.
	(parser::parse_expr): Allow captures in results too.
	* builtins.c (fold_builtin_cexp): Delete.
	(fold_builtin_1): Handle constant cexp arguments here.
	* match.pd: Fold cexp(x+yi) to exp(x) * cexpi(y).

Co-Authored-By: Richard Biener <rguenther@suse.de>

From-SVN: r229308
2015-10-26 09:18:30 +00:00
Richard Biener eee7b6c4a2 genmatch.c (print_operand): Fix formatting.
2015-10-09  Richard Biener  <rguenther@suse.de>

	* genmatch.c (print_operand): Fix formatting.
	(dt_node::append_simplify): Warn for multiple simplifiers
	that match the same pattern.
	* match.pd (log (exp @0)): Remove duplicates.

From-SVN: r228648
2015-10-09 11:47:31 +00:00
Trevor Saunders 355fe0884b switch from gimple to gimple*
This renames the gimple_statement_base struct to gimple removes the
typedef of gimple_statement_base * to gimple, and then adjusts all of
the places that use the type.

gcc/ChangeLog:

2015-09-19  Trevor Saunders  <tbsaunde@tbsaunde.org>

	* coretypes.h (gimple): Change typedef to be a forward
	declaration.
	* gimple.h (gimple_statement_base): rename to gimple.
	* (all functions and types using gimple): Adjust.
	* *.[ch]: Likewise.

gcc/cp/ChangeLog:

2015-09-19  Trevor Saunders  <tbsaunde@tbsaunde.org>

	* cp-gimplify.c (gimplify_must_not_throw_expr): Adjust.

From-SVN: r227941
2015-09-20 00:52:59 +00:00
Richard Biener 2e96ac06b2 genmatch.c (parser::parse_expr): Improve error message for mis-placed flags.
2015-09-17  Richard Biener  <rguenther@suse.de>

	* genmatch.c (parser::parse_expr): Improve error message
	for mis-placed flags.

From-SVN: r227859
2015-09-17 11:02:11 +00:00
Richard Biener 6974662928 re PR tree-optimization/67381 (genmatch does not honor the order of patterns)
2015-08-31  Richard Biener  <rguenther@suse.de>

	PR middle-end/67381
	* genmatch.c (dt_node::gen_kids): Also treat matches as barrier.

From-SVN: r227344
2015-08-31 14:00:16 +00:00
Richard Biener e4cdf6a8c5 re PR tree-optimization/67306 (Patterns ICEs when moved using "simplify and match")
2015-08-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/67306
	* genmatch.c (expr::gen_transform): Verify the result of
	builtin_decl_implicit.
	(dt_simplify::gen_1): Likewise.

From-SVN: r227163
2015-08-25 10:29:09 +00:00
Richard Biener c8136c3648 genmatch.c (dt_node::gen_kids_1): Use gassign and gcall in generated code.
2015-08-04  Richard Biener  <rguenther@suse.de>

	* genmatch.c (dt_node::gen_kids_1): Use gassign and gcall in
	generated code.
	(dt_operand::gen_gimple_expr): Adjust.

From-SVN: r226577
2015-08-04 13:55:26 +00:00
Richard Biener d4b71b95fe genmatch.c (simplify::for_subst_vec): New member.
2015-08-03  Richard Biener  <rguenther@suse.de>

	* genmatch.c (simplify::for_subst_vec): New member.
	(binary_ok): New helper for for lowering.
	(lower_for): Delay substituting operators into result expressions
	if we can merge the results eventually again.
	(capture_info::walk_result): Adjust for user_id appearing as
	result expression operator.
	(expr::gen_transform): Likewise.
	(dt_simplify::gen_1): Likewise.
	(dt_simplify::gen): Pass not substituted operators to tail
	functions or initialize local variable with it.
	(decision_tree::gen): Adjust function signature.
	* match.pd: Fix tests against global code and add default
	cases to switch stmts.

From-SVN: r226504
2015-08-03 13:28:46 +00:00
Richard Biener 1d2fdec6bc genmatch.c (dt_simplify::gen): Create captures array with an initializer.
2015-08-03  Richard Biener  <rguenther@suse.de>

	* genmatch.c (dt_simplify::gen): Create captures array
	with an initializer.

From-SVN: r226503
2015-08-03 13:20:22 +00:00
Richard Biener 03038b8b7a genmatch.c (struct sinfo, [...]): New hash-map to record equivalent transforms.
2015-08-03  Richard Biener  <rguenther@suse.de>

	* genmatch.c (struct sinfo, struct sinfo_hashmap_traits, sinfo_map_t):
	New hash-map to record equivalent transforms.
	(dt_node::analyze): Populate the equivalent transforms hash-map.
	(dt_simplify::info): Add reference to hash-map entry.
	(dt_simplify::gen): If we have split out a function for the
	transform, generate a call to it.
	(sinfo_hashmap_traits::hash): New function.
	(compare_op): New helper function for ...
	(sinfo_hashmap_traits::equal_keys): ... this new function.
	(decision_tree::gen): Split out common equivalent transforms
	into functions.

From-SVN: r226490
2015-08-03 07:39:12 +00:00
Richard Biener b21ce9ce3b genmatch.c (decision_tree::gen_gimple): Merge with ...
2015-07-30  Richard Biener  <rguenther@suse.de>

	* genmatch.c (decision_tree::gen_gimple): Merge with ...
	(decision_tree::gen_generic): ... this into ...
	(decision_tree::gen): ... this.
	(main): Adjust callers.

From-SVN: r226396
2015-07-30 11:20:21 +00:00
Richard Biener 53a19317f4 genmatch.c (verbose): New global.
2015-07-30  Richard Biener  <rguenther@suse.de>

	* genmatch.c (verbose): New global.
	(warning_at): Add overload with source_location.
	(capture_info::capture_info): Add bool whether generating gimple
	or generic.  Add gimple member.
	(capture_info::cinfo): Add capture member.
	(capture_info::walk_match): Record capture.  Warn on
	non-captured leafs.
	(capture_info::walk_c_expr): Add more fragments captures cannot
	escape through.  Warn on escaped captures.
	(dt_simplify::gen_1): Warn on operands we force to have no
	side-effects.
	(main): Initialize verbose.
	* match.pd: Add integer_nonzerop and HONOR_NANS predicates.

From-SVN: r226386
2015-07-30 07:56:23 +00:00
Richard Biener c56f494f74 genmatch.c (c_expr::gen_transform): Error on unknown captures.
2015-07-29  Richard Biener  <rguenther@suse.de>

	* genmatch.c (c_expr::gen_transform): Error on unknown captures.
	(parser::parse_capture): Add bool argument on whether to reject
	unknown captures.
	(parser::parse_expr): Adjust.
	(parser::parse_op): Likewise.
	(parser::parse_pattern): Likewise.

From-SVN: r226344
2015-07-29 12:06:14 +00:00
Richard Biener 0fd357f27d genmatch.c (decision_tree::gen_gimple): Split out large subtrees into separate functions.
2015-07-27  Richard Biener  <rguenther@suse.de>

	* genmatch.c (decision_tree::gen_gimple): Split out large
	subtrees into separate functions.
	(decision_tree::gen_generic): Likewise.

From-SVN: r226241
2015-07-27 10:59:18 +00:00
Richard Biener 803835ded7 genmatch.c (struct dt_node): Add statistic fields.
2015-07-24  Richard Biener  <rguenther@suse.de>

	* genmatch.c (struct dt_node): Add statistic fields.
	(dt_node::analyze): New method.
	(decision_tree::gen_gimple): Call analyze on the root node
	and print statistics to stderr.
	(decision_tree::gen_generic): Likewise.

From-SVN: r226154
2015-07-24 12:39:08 +00:00
Richard Biener fa138f6efd genmatch.c (struct capture_info): Add same_as field.
2015-07-24  Richard Biener  <rguenther@suse.de>

	* genmatch.c (struct capture_info): Add same_as field.
	(capture_info::capture_info): Initialize same_as.
	(capture_info::walk_match): Compute same_as.
	(capture_info::walk_result): Compute stuff for the leader.
	(capture_info::walk_c_expr): Likewise.
	(dt_simplify::gen_1): Only look at leaders when deciding
	to force no side-effects or emit side-effects of omitted operands.

From-SVN: r226152
2015-07-24 12:35:22 +00:00
Richard Biener 96a111a3df genmatch.c (add_operator): Allow SSA_NAME as predicate.
2015-07-24  Richard Biener  <rguenther@suse.de>

	* genmatch.c (add_operator): Allow SSA_NAME as predicate.
	* fold-const.c (fold_comparison): Move parameter does not
	alias &local simplification ...
	* match.pd: ... as a pattern here.

From-SVN: r226140
2015-07-24 08:31:07 +00:00
Richard Biener 38b52b2fdd genmatch.c (expr::gen_transform): Clarify error message and display location.
2015-07-22  Richard Biener  <rguenther@suse.de>

	* genmatch.c (expr::gen_transform): Clarify error message
	and display location.

From-SVN: r226068
2015-07-22 13:18:47 +00:00
Richard Biener 0889c52f15 genmatch.c (struct operand): Add location member.
2015-07-22  Richard Biener  <rguenther@suse.de>

	* genmatch.c (struct operand): Add location member.
	(predicate, expr, c_expr, capture, if_expr, with_expr): Adjust
	constructors.
	(struct simplify): Remove match_location and result_location
	members.
	(elsehwere): Adjust.

From-SVN: r226067
2015-07-22 13:16:50 +00:00