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

Go to the source code of this file.

Functions

tree canonicalize_constructor_val (tree, tree)
tree get_symbol_constant_value (tree)
void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree)
tree gimple_fold_builtin (gimple)
tree gimple_extract_devirt_binfo_from_cst (tree, tree)
bool fold_stmt (gimple_stmt_iterator *)
bool fold_stmt_inplace (gimple_stmt_iterator *)
tree maybe_fold_and_comparisons (enum tree_code, tree, tree, enum tree_code, tree, tree)
tree maybe_fold_or_comparisons (enum tree_code, tree, tree, enum tree_code, tree, tree)
tree gimple_fold_stmt_to_constant_1 (gimple, tree(*)(tree))
tree gimple_fold_stmt_to_constant (gimple, tree(*)(tree))
tree fold_const_aggregate_ref_1 (tree, tree(*)(tree))
tree fold_const_aggregate_ref (tree)
tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree)
bool gimple_val_nonnegative_real_p (tree)
tree gimple_fold_indirect_ref (tree)

Function Documentation

tree canonicalize_constructor_val ( tree  ,
tree   
)

Gimple folding definitions.

Copyright (C) 2011-2013 Free Software Foundation, Inc. Contributed by Richard Guenther rguen.nosp@m.ther.nosp@m.@suse.nosp@m..de

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/.

tree fold_const_aggregate_ref ( tree  )
tree fold_const_aggregate_ref_1 ( tree  t,
tree(*)(tree valueize 
)

Return the tree representing the element referenced by T if T is an ARRAY_REF or COMPONENT_REF into constant aggregates valuezing SSA names using VALUEIZE. Return NULL_TREE otherwise.

     Constant indexes are handled well by get_base_constructor.
     Only special case variable offsets.
     FIXME: This code can't handle nested references with variable indexes
     (they will be handled only by iteration of ccp).  Perhaps we can bring
     get_ref_base_and_extent here and make it use a valueize callback.   
         If the resulting bit-offset is constant, track it.   
             Empty constructor.  Always fold to 0.   
             Out of bound array access.  Value is undefined,
             but don't fold.   
             We can not determine ctor.   
     Fallthru.   
     Empty constructor.  Always fold to 0.   
     We do not know precise address.   
     We can not determine ctor.   
     Out of bound array access.  Value is undefined, but don't fold.   
bool fold_stmt ( gimple_stmt_iterator )
bool fold_stmt_inplace ( gimple_stmt_iterator )
tree get_symbol_constant_value ( tree  )
tree gimple_extract_devirt_binfo_from_cst ( tree  ,
tree   
)
tree gimple_fold_builtin ( gimple  )
tree gimple_fold_indirect_ref ( tree  )
tree gimple_fold_stmt_to_constant ( gimple  stmt,
tree(*)(tree valueize 
)

Fold STMT to a constant using VALUEIZE to valueize SSA names. Returns NULL_TREE if folding to a constant is not possible, otherwise returns a constant according to is_gimple_min_invariant.

Referenced by check_array_ref().

tree gimple_fold_stmt_to_constant_1 ( gimple  stmt,
tree(*)(tree valueize 
)

Fold STMT to a constant using VALUEIZE to valueize SSA names.

Either NULL_TREE, a simplified but non-constant or a constant is returned.

??? This should go into a gimple-fold-inline.h file to be eventually privatized with the single valueize function used in the various TUs to avoid the indirect function call overhead.

If the RHS is an SSA_NAME, return its known constant value,
if any.   
             Handle propagating invariant addresses into address
             operations.   


             Handle unary operators that can appear in GIMPLE form.
             Note that we know the single operand must be a constant,
             so this should almost always return a simplified RHS.   
             Conversions are useless for CCP purposes if they are
             value-preserving.  Thus the restrictions that
             useless_type_conversion_p places for restrict qualification
             of pointer types should not apply here.
             Substitution later will only substitute to allowed places.   
             Handle binary operators that can appear in GIMPLE form.   
             Translate &x + CST into an invariant form suitable for
             further propagation.   
             Handle ternary operators that can appear in GIMPLE form.   
             Fold embedded expressions in ternary codes.   
         No folding yet for these functions.   
             fold_call_expr wraps the result inside a NOP_EXPR.   
tree gimple_get_virt_method_for_binfo ( HOST_WIDE_INT  ,
tree   
)
bool gimple_val_nonnegative_real_p ( tree  )
void gimplify_and_update_call_from_tree ( gimple_stmt_iterator ,
tree   
)
tree maybe_fold_and_comparisons ( enum tree_code  code1,
tree  op1a,
tree  op1b,
enum tree_code  code2,
tree  op2a,
tree  op2b 
)

Try to simplify the AND of two comparisons, specified by (OP1A CODE1 OP1B) and (OP2B CODE2 OP2B), respectively. If this can be simplified to a single expression (without requiring introducing more SSA variables to hold intermediate values), return the resulting tree. Otherwise return NULL_TREE. If the result expression is non-null, it has boolean type.

tree maybe_fold_or_comparisons ( enum tree_code  code1,
tree  op1a,
tree  op1b,
enum tree_code  code2,
tree  op2a,
tree  op2b 
)

Try to simplify the OR of two comparisons, specified by (OP1A CODE1 OP1B) and (OP2B CODE2 OP2B), respectively. If this can be simplified to a single expression (without requiring introducing more SSA variables to hold intermediate values), return the resulting tree. Otherwise return NULL_TREE. If the result expression is non-null, it has boolean type.