aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-match.h
AgeCommit message (Collapse)AuthorFilesLines
2016-04-20gimple-match.h (maybe_build_generic_op): Adjust prototype.Richard Biener1-1/+1
2016-04-20 Richard Biener <rguenther@suse.de> * gimple-match.h (maybe_build_generic_op): Adjust prototype. * gimple-match-head.c (maybe_build_generic_op): Pass all ops by reference, clear op1 and op2 when GENERICizing BIT_FIELD_REF. (maybe_push_res_to_seq): Adjust. * gimple-fold.c (maybe_build_generic_op): Likewise. From-SVN: r235274
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-11-17Add genmatch support for internal functionsRichard Sandiford1-2/+2
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-10-09re PR middle-end/67891 (FAIL: gcc.dg/pr43300.c (internal compiler error) on ↵Richard Biener1-0/+18
alpha-linux-gnu) 2015-10-09 Richard Biener <rguenther@suse.de> PR tree-optimization/67891 * gimple-match.h (gimple_simplified_result_is_gimple_val): New helper. (gimple_resimplify1): Declare. (gimple_resimplify2): Likewise. (gimple_resimplify3): Likewise. * gimple-match-head.c (gimple_resimplify1): Export. (gimple_resimplify2): Likewise. (gimple_resimplify3): Likewise. (maybe_push_res_to_seq): Use gimple_simplified_result_is_gimple_val. * gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise. * tree-ssa-sccvn.c (visit_reference_op_load): Use gimple_resimplify1 to avoid creating stmts without VN info. * gcc.dg/tree-ssa/pr67891.c: New testcase. From-SVN: r228635
2015-10-01gimple-match.h (mprts_hook): Declare.Richard Biener1-0/+2
2015-10-01 Richard Biener <rguenther@suse.de> * gimple-match.h (mprts_hook): Declare. * gimple-match.head.c (mprts_hook): Define. (maybe_push_res_to_seq): Use new hook. * gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise. * tree-ssa-sccvn.h (vn_ssa_aux::expr): Change to a gimple_seq. (vn_ssa_aux::has_constants): Remove. * tree-ssa-sccvn.c: Include gimple-match.h. (VN_INFO_GET): Assert we don't re-use SSA names. (vn_get_expr_for): Remove. (expr_has_constants): Likewise. (stmt_has_constants): Likewise. (simplify_binary_expression): Likewise. (simplify_unary_expression): Likewise. (vn_lookup_simplify_result): New hook. (visit_copy): Adjust. (visit_reference_op_call): Likewise. (visit_phi): Likewise. (visit_use): Likewise. (process_scc): Likewise. (init_scc_vn): Likewise. (visit_reference_op_load): Likewise. Use match-and-simplify and a gimple seq for inserted expressions. (try_to_simplify): Remove GENERIC stmt combining code. (sccvn_dom_walker::before_dom_children): Use match-and-simplify. * tree-ssa-pre.c (eliminate_insert): Adjust. (eliminate_dom_walker::before_dom_children): Likewise. * gcc.dg/tree-ssa/ssa-fre-7.c: Adjust. * gcc.dg/tree-ssa/ssa-fre-8.c: Likewise. From-SVN: r228320
2015-09-20switch from gimple to gimple*Trevor Saunders1-1/+1
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-04-21re PR tree-optimization/65650 (CCP does not propgate copies)Richard Biener1-1/+1
2015-04-21 Richard Biener <rguenther@suse.de> PR tree-optimization/65650 * tree-ssa-ccp.c (valid_lattice_transition): Allow lattice transitions involving copies. (set_lattice_value): Adjust for copy lattice state. (ccp_lattice_meet): Do not merge UNDEFINED and a copy to the copy if that doesn't dominate the merge point. (bit_value_unop): Adjust what we treat as varying mask. (bit_value_binop): Likewise. (bit_value_assume_aligned): Likewise. (evaluate_stmt): When we simplified to a SSA name record a copy instead of dropping to varying. (visit_assignment): Simplify. * gimple-match.h (gimple_simplify): Add another callback. * gimple-fold.c (fold_stmt_1): Adjust caller. (gimple_fold_stmt_to_constant_1): Likewise - pass valueize for the 2nd callback. * gimple-match-head.c (gimple_simplify): Add a callback that is used to valueize the stmt operands and use it that way. * gcc.dg/tree-ssa/ssa-ccp-37.c: New testcase. * gcc.dg/tree-ssa/forwprop-11.c: Adjust. * gcc.dg/tree-ssa/ssa-fre-3.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-4.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-5.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-32.c: Likewise. From-SVN: r222267
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219188
2014-10-22Makefile.in (OBJS): Add gimple-match.o and generic-match.o.Richard Biener1-0/+50
2014-10-22 Richard Biener <rguenther@suse.de> Prathamesh Kulkarni <bilbotheelffriend@gmail.com> * Makefile.in (OBJS): Add gimple-match.o and generic-match.o. (MOSTLYCLEANFILES): Add gimple-match.c and generic-match.c. (gimple-match.c): Generate by triggering s-match. (generic-match.c): Likewise. (s-match): Rule to build gimple-match.c and generic-match.c by running the genmatch generator program. (build/hash-table.o): Dependencies to build hash-table.c for the host. (build/genmatch.o): Dependencies to build genmatch. (genprog): Add match. (build/genmatch): Likewise. (TEXI_GCCINT_FILES): Add match-and-simplify.texi. * generic-match-head.c: New file. * gimple-match-head.c: Likewise. * gimple-match.h: Likewise. * genmatch.c: Likewise. * match.pd: Likewise. * builtins.h (fold_builtin_n): Export. * builtins.c (fold_builtin_n): Likewise. * gimple-fold.h (gimple_build): Declare various overloads. (gimple_simplify): Likewise. (gimple_convert): Re-implement in terms of gimple_build. * gimple-fold.c (gimple_convert): Remove. (gimple_build): New functions. * doc/match-and-simplify.texi: New file. * doc/gccint.texi: Add menu item Match and Simplify and include match-and-simplify.texi. Co-Authored-By: Prathamesh Kulkarni <bilbotheelffriend@gmail.com> From-SVN: r216542