GCC Middle and Back End API Reference
gimple-match-head.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "ssa.h"
#include "cgraph.h"
#include "vec-perm-indices.h"
#include "fold-const.h"
#include "fold-const-call.h"
#include "stor-layout.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "calls.h"
#include "tree-dfa.h"
#include "builtins.h"
#include "gimple-match.h"
#include "tree-pass.h"
#include "internal-fn.h"
#include "case-cfn-macros.h"
#include "gimplify.h"
#include "optabs-tree.h"
#include "tree-eh.h"
#include "dbgcnt.h"
#include "tm.h"
#include "gimple-range.h"
#include "langhooks.h"
#include "attribs.h"
#include "asan.h"
Include dependency graph for gimple-match-head.cc:

Macros

#define bitwise_equal_p(expr1, expr2)
 
#define bitwise_inverted_equal_p(expr1, expr2, wascmp)
 

Functions

tree do_valueize (tree, tree(*)(tree), bool &)
 
tree do_valueize (tree(*)(tree), tree)
 
gimpleget_def (tree(*valueize)(tree), tree name)
 
static bool types_match (tree t1, tree t2)
 
static bool types_match (tree t1, tree t2, tree t3)
 
static bool single_use (const_tree) ATTRIBUTE_PURE
 
static bool canonicalize_math_p ()
 
static bool canonicalize_math_after_vectorization_p ()
 
static bool optimize_vectors_before_lowering_p ()
 
static bool expr_no_side_effects_p (tree t)
 
static bool optimize_pow_to_exp (tree arg0, tree arg1)
 
static bool optimize_successive_divisions_p (tree divisor, tree inner_div)
 
bool gimple_nop_convert (tree, tree *, tree(*)(tree))
 
bool gimple_maybe_truncate (tree, tree *, tree(*)(tree))
 
static bool gimple_bitwise_equal_p (tree expr1, tree expr2, tree(*valueize)(tree))
 
bool gimple_bit_not_with_nop (tree, tree *, tree(*)(tree))
 
bool gimple_maybe_cmp (tree, tree *, tree(*)(tree))
 
bool gimple_bit_xor_cst (tree, tree *, tree(*)(tree))
 
static bool gimple_bitwise_inverted_equal_p (tree expr1, tree expr2, bool &wascmp, tree(*valueize)(tree))
 
static gcondmatch_cond_with_binary_phi (gphi *phi, tree *true_arg, tree *false_arg)
 

Macro Definition Documentation

◆ bitwise_equal_p

#define bitwise_equal_p ( expr1,
expr2 )
Value:
gimple_bitwise_equal_p (expr1, expr2, valueize)
static bool gimple_bitwise_equal_p(tree expr1, tree expr2, tree(*valueize)(tree))
Definition gimple-match-head.cc:261
Return true if EXPR1 and EXPR2 have the same value, but not necessarily
same type.  The types can differ through nop conversions.   

Referenced by bitwise_inverted_equal_p().

◆ bitwise_inverted_equal_p

#define bitwise_inverted_equal_p ( expr1,
expr2,
wascmp )
Value:
gimple_bitwise_inverted_equal_p (expr1, expr2, wascmp, valueize)
static bool gimple_bitwise_inverted_equal_p(tree expr1, tree expr2, bool &wascmp, tree(*valueize)(tree))
Definition gimple-match-head.cc:306
Return true if EXPR1 and EXPR2 have the bitwise opposite value,
but not necessarily same type.
The types can differ through nop conversions.   

Function Documentation

◆ canonicalize_math_after_vectorization_p()

static bool canonicalize_math_after_vectorization_p ( )
inlinestatic
Return true if math operations that are beneficial only after
vectorization should be canonicalized.   

References cfun, and PROP_gimple_lvec.

◆ canonicalize_math_p()

static bool canonicalize_math_p ( )
inlinestatic
Return true if math operations should be canonicalized,
e.g. sqrt(sqrt(x)) -> pow(x, 0.25).   

References cfun, and PROP_gimple_opt_math.

◆ do_valueize() [1/2]

tree do_valueize ( tree(* valueize )(tree),
tree op )
Helper for the autogenerated code, valueize OP.   

References TREE_CODE.

◆ do_valueize() [2/2]

tree do_valueize ( tree op,
tree(* valueize )(tree),
bool & valueized )
inline
Preamble and helpers for the autogenerated gimple-match.cc file.
   Copyright (C) 2014-2024 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/>.   
Helper for gimple_simplify valueizing OP using VALUEIZE and setting
VALUEIZED to true if valueization changed OP.   

References TREE_CODE.

Referenced by gimple_bitwise_inverted_equal_p(), and gimple_simplify().

◆ expr_no_side_effects_p()

static bool expr_no_side_effects_p ( tree t)
inlinestatic
Returns true if the expression T has no side effects
including not trapping.  

References gcc_assert, and is_gimple_val().

◆ get_def()

gimple * get_def ( tree(* valueize )(tree),
tree name )
inline
Helper for the autogenerated code, get at the definition of NAME when
VALUEIZE allows that.   

References NULL, and SSA_NAME_DEF_STMT.

Referenced by gimple_bitwise_inverted_equal_p().

◆ gimple_bit_not_with_nop()

bool gimple_bit_not_with_nop ( tree ,
tree * ,
tree(*  )(tree) )

◆ gimple_bit_xor_cst()

bool gimple_bit_xor_cst ( tree ,
tree * ,
tree(*  )(tree) )

◆ gimple_bitwise_equal_p()

static bool gimple_bitwise_equal_p ( tree expr1,
tree expr2,
tree(* valueize )(tree) )
inlinestatic

◆ gimple_bitwise_inverted_equal_p()

◆ gimple_maybe_cmp()

bool gimple_maybe_cmp ( tree ,
tree * ,
tree(*  )(tree) )

◆ gimple_maybe_truncate()

bool gimple_maybe_truncate ( tree ,
tree * ,
tree(*  )(tree) )

Referenced by gimple_bitwise_equal_p().

◆ gimple_nop_convert()

bool gimple_nop_convert ( tree ,
tree * ,
tree(*  )(tree) )

Referenced by gimple_bitwise_equal_p().

◆ match_cond_with_binary_phi()

static gcond * match_cond_with_binary_phi ( gphi * phi,
tree * true_arg,
tree * false_arg )
inlinestatic

◆ optimize_pow_to_exp()

static bool optimize_pow_to_exp ( tree arg0,
tree arg1 )
static
Return true if pow(cst, x) should be optimized into exp(log(cst) * x).
As a workaround for SPEC CPU2017 628.pop2_s, don't do it if arg0
is an exact integer, arg1 = phi_res +/- cst1 and phi_res = PHI <cst2, ...>
where cst2 +/- cst1 is an exact integer, because then pow (arg0, arg1)
will likely be exact, while exp (log (arg0) * arg1) might be not.
Also don't do it if arg1 is phi_res above and cst2 is an exact integer.   

References const_binop(), dyn_cast(), gcc_assert, gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_phi_num_args(), i, is_gimple_assign(), NULL_TREE, operand_equal_p(), PHI_ARG_DEF, real_isinteger(), SSA_NAME_DEF_STMT, TREE_CODE, TREE_REAL_CST_PTR, TREE_TYPE, and TYPE_MODE.

◆ optimize_successive_divisions_p()

static bool optimize_successive_divisions_p ( tree divisor,
tree inner_div )
static
Return true if a division INNER_DIV / DIVISOR where INNER_DIV
is another division can be optimized.  Don't optimize if INNER_DIV
is used in a TRUNC_MOD_EXPR with DIVISOR as second operand.   

References cfun, FOR_EACH_IMM_USE_FAST, gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_in_ssa_p(), is_gimple_assign(), operand_equal_p(), and USE_STMT.

◆ optimize_vectors_before_lowering_p()

static bool optimize_vectors_before_lowering_p ( )
inlinestatic
Return true if we can still perform transformations that may introduce
vector operations that are not supported by the target. Vector lowering
normally handles those, but after that pass, it becomes unsafe.   

References cfun, and PROP_gimple_lvec.

◆ single_use()

static bool single_use ( const_tree t)
static
Return if T has a single use.  For GIMPLE, we also allow any
non-SSA_NAME (ie constants) and zero uses to cope with uses
that aren't linked up yet.   

References is_gimple_debug(), ssa_use_operand_t::next, SSA_NAME_IMM_USE_NODE, TREE_CODE, and USE_STMT.

◆ types_match() [1/2]

static bool types_match ( tree t1,
tree t2 )
inlinestatic
Routine to determine if the types T1 and T2 are effectively
the same for GIMPLE.  If T1 or T2 is not a type, the test
applies to their TREE_TYPE.   

References TREE_TYPE, TYPE_P, and types_compatible_p().

Referenced by types_match().

◆ types_match() [2/2]

static bool types_match ( tree t1,
tree t2,
tree t3 )
inlinestatic
Routine to determine if the types T1, T2 and T3 are effectively
the same for GIMPLE.  If T1, T2 or T2 is not a type, the test
applies to their TREE_TYPE.   

References types_match().