GCC Middle and Back End API Reference
gimple-match.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  gimple_match_cond
class  gimple_match_op

Functions

bool gimple_simplified_result_is_gimple_val (const gimple_match_op *op)
bool gimple_extract_op (gimple *, gimple_match_op *)
bool gimple_simplify (gimple *, gimple_match_op *, gimple_seq *, tree(*)(tree), tree(*)(tree))
tree maybe_push_res_to_seq (gimple_match_op *, gimple_seq *, tree res=NULL_TREE)
void maybe_build_generic_op (gimple_match_op *)
bool commutative_binary_op_p (code_helper, tree)
bool commutative_ternary_op_p (code_helper, tree)
int first_commutative_argument (code_helper, tree)
bool associative_binary_op_p (code_helper, tree)
code_helper canonicalize_code (code_helper, tree)
internal_fn get_conditional_internal_fn (code_helper, tree)
int find_different_opnum (const gimple_match_op &arg0_op, const gimple_match_op &arg1_op, tree *new_arg0, tree *new_arg1)
bool factor_operation_ok (code_helper code, int opnum, tree *args, location_t *locs, size_t numargs, bool divconstok, bool ptrplusconstok)

Variables

tree(*) mprts_hook (gimple_match_op *)

Function Documentation

◆ associative_binary_op_p()

bool associative_binary_op_p ( code_helper code,
tree type )
Return true if CODE is a binary operation that is associative when
operating on type TYPE.   

References associated_internal_fn(), associative_binary_fn_p(), associative_binary_op_p(), and associative_tree_code().

Referenced by associative_binary_op_p(), and vectorizable_reduction().

◆ canonicalize_code()

code_helper canonicalize_code ( code_helper code,
tree type )
Return a canonical form for CODE when operating on TYPE.  The idea
is to remove redundant ways of representing the same operation so
that code_helpers can be hashed and compared for equality.

The only current canonicalization is to replace built-in functions
with internal functions, in cases where internal-fn.def defines
such an internal function.

Note that the new code_helper cannot necessarily be used in place of
the original code_helper.  For example, the new code_helper might be
an internal function that the target does not support.   

References associated_internal_fn(), and canonicalize_code().

Referenced by canonicalize_code(), check_reduction_path(), and vect_transform_reduction().

◆ commutative_binary_op_p()

bool commutative_binary_op_p ( code_helper code,
tree type )
Return true if CODE is a binary operation and if CODE is commutative when
operating on type TYPE.   

References associated_internal_fn(), commutative_binary_fn_p(), commutative_binary_op_p(), and commutative_tree_code().

Referenced by commutative_binary_op_p(), gimple_resimplify2(), and vectorizable_reduction().

◆ commutative_ternary_op_p()

bool commutative_ternary_op_p ( code_helper code,
tree type )
Return true if CODE represents a ternary operation and if the first two
operands are commutative when CODE is operating on TYPE.   

References associated_internal_fn(), commutative_ternary_fn_p(), commutative_ternary_op_p(), and commutative_ternary_tree_code().

Referenced by commutative_ternary_op_p().

◆ factor_operation_ok()

bool factor_operation_ok ( code_helper code,
int opnum,
tree * args,
location_t * locs,
size_t num_args,
bool divconstok,
bool ptrplusconstok )
Some factoring of operations including some builtins need
to be stop from happening in some cases.  factor_operation_ok
returns true when the factoring is ok for CODE where OPNUM is
operand was and the ARGS are the operands of the
original operation.  DIVCONSTOK says if an integer division with
a constant is ok to be factored out.  PTRPLUSCONSTOK says if a
POINTER_PLUS_EXPR can be factored out. When opnum < 0, args
is allowed to be null.   

References all_ssa_names_p(), factor_operation_ok(), fn_arg_must_be_const_p(), i, int_divide_or_mod_p(), TREE_TYPE, true, and types_compatible_p().

Referenced by factor_operation_ok(), factor_out_conditional_operation(), factor_out_operators(), and merge_stmts_p().

◆ find_different_opnum()

int find_different_opnum ( const gimple_match_op & arg0_op,
const gimple_match_op & arg1_op,
tree * new_arg0,
tree * new_arg1 )
Find the operand which is different between ARG0_OP and ARG1_OP.
Returns the operand num where the difference is.
Set NEWARG0 and NEWARG1 from the different argument.
Returns -1 if none is found.
If ARG0_OP/ARG1_OP is commutative also try swapping the
two commutative operands and return the operand number where
the difference happens in ARG0_OP.  
Handle commutative operations.  

References gimple_match_op::code, find_different_opnum(), first_commutative_argument(), gcc_assert, i, gimple_match_op::num_ops, operand_equal_for_phi_arg_p(), gimple_match_op::ops, and gimple_match_op::type.

Referenced by factor_out_conditional_operation(), factor_out_operators(), and find_different_opnum().

◆ first_commutative_argument()

◆ get_conditional_internal_fn()

◆ gimple_extract_op()

bool gimple_extract_op ( gimple * stmt,
gimple_match_op * res_op )
Try to describe STMT in RES_OP, returning true on success.
For GIMPLE_CONDs, describe the condition that is being tested.
For GIMPLE_ASSIGNs, describe the rhs of the assignment.
For GIMPLE_CALLs, describe the call.   

References gimple_extract(), and gimple_extract_op().

Referenced by check_reduction_path(), factor_out_conditional_operation(), factor_out_operators(), gimple_extract_op(), vect_analyze_slp_reduc_chain(), vect_is_simple_reduction(), vect_mark_pattern_stmts(), vect_model_reduction_cost(), vect_transform_reduction(), and vectorizable_reduction().

◆ gimple_simplified_result_is_gimple_val()

◆ gimple_simplify()

bool gimple_simplify ( gimple * stmt,
gimple_match_op * res_op,
gimple_seq * seq,
tree(* valueize )(tree),
tree(* top_valueize )(tree) )
The main STMT based simplification entry.  It is used by the fold_stmt
and the fold_stmt_to_constant APIs.   

References gimple_match_op::code, do_valueize(), gimple_extract(), gimple_simplify(), code_helper::is_internal_fn(), gimple_match_op::num_ops, gimple_match_op::resimplify(), gimple_match_op::reverse, and try_conditional_simplification().

◆ maybe_build_generic_op()

void maybe_build_generic_op ( gimple_match_op * res_op)
If in GIMPLE the operation described by RES_OP should be single-rhs,
build a GENERIC tree for that expression and update RES_OP accordingly.   

References build1(), build3(), gimple_match_op::code, maybe_build_generic_op(), gimple_match_op::ops, REF_REVERSE_STORAGE_ORDER, gimple_match_op::reverse, gimple_match_op::set_value(), and gimple_match_op::type.

Referenced by maybe_build_generic_op(), maybe_push_res_to_seq(), and replace_stmt_with_simplification().

◆ maybe_push_res_to_seq()

Variable Documentation

◆ mprts_hook

tree(*) mprts_hook(gimple_match_op *) ( gimple_match_op * )
extern
Helpers for the autogenerated gimple-match.cc file.
   Copyright (C) 2023-2026 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   

Referenced by gimple_fold_stmt_to_constant_1(), maybe_push_res_to_seq(), try_to_simplify(), vn_lookup_simplify_result(), and vn_nary_build_or_lookup_1().