GCC Middle and Back End API Reference
tree-affine.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  aff_comb_elt
class  aff_tree


#define MAX_AFF_ELTS   8


void aff_combination_const (aff_tree *, tree, const poly_widest_int &)
void aff_combination_elt (aff_tree *, tree, tree)
void aff_combination_scale (aff_tree *, const widest_int &)
void aff_combination_mult (aff_tree *, aff_tree *, aff_tree *)
void aff_combination_add (aff_tree *, aff_tree *)
void aff_combination_add_elt (aff_tree *, tree, const widest_int &)
void aff_combination_remove_elt (aff_tree *, unsigned)
void aff_combination_convert (aff_tree *, tree)
void tree_to_aff_combination (tree, tree, aff_tree *)
tree aff_combination_to_tree (aff_tree *)
void unshare_aff_combination (aff_tree *)
bool aff_combination_constant_multiple_p (aff_tree *, aff_tree *, poly_widest_int *)
void aff_combination_expand (aff_tree *, hash_map< tree, name_expansion * > **)
void tree_to_aff_combination_expand (tree, tree, aff_tree *, hash_map< tree, name_expansion * > **)
tree get_inner_reference_aff (tree, aff_tree *, poly_widest_int *)
void free_affine_expand_cache (hash_map< tree, name_expansion * > **)
bool aff_comb_cannot_overlap_p (aff_tree *, const poly_widest_int &, const poly_widest_int &)
void debug_aff (aff_tree *)
tree aff_combination_type (aff_tree *aff)
bool aff_combination_zero_p (aff_tree *aff)
bool aff_combination_const_p (aff_tree *aff)
bool aff_combination_singleton_var_p (aff_tree *aff)

Macro Definition Documentation


#define MAX_AFF_ELTS   8
Operations with affine combinations of trees.
   Copyright (C) 2005-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
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
Affine combination of trees.  We keep track of at most MAX_AFF_ELTS elements
to make things simpler; this is sufficient in most cases.   

Referenced by aff_combination_add_elt(), aff_combination_convert(), aff_combination_scale(), aff_combination_to_tree(), and aff_combination_zero().

Function Documentation

◆ aff_comb_cannot_overlap_p()

bool aff_comb_cannot_overlap_p ( aff_tree * diff,
const poly_widest_int & size1,
const poly_widest_int & size2 )
Returns true if a region of size SIZE1 at position 0 and a region of
size SIZE2 at position DIFF cannot overlap.   

References ggc_alloc(), and known_le.

Referenced by dr_may_alias_p(), generate_memcpy_builtin(), and mem_refs_may_alias_p().

◆ aff_combination_add()

◆ aff_combination_add_elt()

◆ aff_combination_const()

◆ aff_combination_const_p()

bool aff_combination_const_p ( aff_tree * aff)
Return true if AFF is actually const.   

References ggc_alloc(), and NULL.

Referenced by get_address_cost(), and get_computation_cost().

◆ aff_combination_constant_multiple_p()

bool aff_combination_constant_multiple_p ( aff_tree * val,
aff_tree * div,
poly_widest_int * mult )

◆ aff_combination_convert()

◆ aff_combination_elt()

void aff_combination_elt ( aff_tree * comb,
tree type,
tree elt )
Sets COMB to single element ELT.   

References aff_combination_zero(), and ggc_alloc().

Referenced by aff_combination_expand(), and tree_to_aff_combination().

◆ aff_combination_expand()

◆ aff_combination_mult()

void aff_combination_mult ( aff_tree * c1,
aff_tree * c2,
aff_tree * r )
Multiplies C1 by C2, storing the result to R   

References aff_combination_add_product(), aff_combination_zero(), gcc_assert, ggc_alloc(), i, NULL, offset, r, TYPE_PRECISION, and wide_int_to_tree().

Referenced by cand_value_at().

◆ aff_combination_remove_elt()

void aff_combination_remove_elt ( aff_tree * comb,
unsigned m )
Remove M-th element from COMB.   

References ggc_alloc(), and NULL_TREE.

Referenced by move_fixed_address_to_symbol(), move_hint_to_base(), move_pointer_to_base(), and move_variant_to_index().

◆ aff_combination_scale()

◆ aff_combination_singleton_var_p()

bool aff_combination_singleton_var_p ( aff_tree * aff)
Return true iff AFF contains one (negated) singleton variable.  Users need
to make sure AFF points to a valid combination.   

References ggc_alloc(), and known_eq.

Referenced by get_address_cost(), and get_computation_cost().

◆ aff_combination_to_tree()

◆ aff_combination_type()

tree aff_combination_type ( aff_tree * aff)
Return AFF's type.   

References ggc_alloc().

Referenced by get_computation_cost().

◆ aff_combination_zero_p()

bool aff_combination_zero_p ( aff_tree * aff)
Return true if AFF is actually ZERO.   

References ggc_alloc(), and known_eq.

Referenced by difference_cannot_overflow_p(), get_address_cost(), get_computation_cost(), and simplify_peeled_chrec().

◆ debug_aff()

void debug_aff ( aff_tree * val)
Debugging functions.   
Prints the affine VAL to the standard error, used for debugging.   

References ggc_alloc(), print_aff(), and aff_comb_elt::val.

◆ free_affine_expand_cache()

void free_affine_expand_cache ( hash_map< tree, name_expansion * > ** cache)
Frees memory allocated for the CACHE used by

References cache, free_name_expansion(), and NULL.

Referenced by simplify_peeled_chrec(), tree_ssa_iv_optimize_finalize(), tree_ssa_lim_finalize(), and pcom_worker::~pcom_worker().

◆ get_inner_reference_aff()

tree get_inner_reference_aff ( tree ref,
aff_tree * addr,
poly_widest_int * size )
Computes address of the reference REF in ADDR.  The size of the accessed
location is stored to SIZE.  Returns the ultimate containing object to
which REF refers.   

References aff_combination_add(), aff_combination_const(), bits_to_bytes_round_down, bits_to_bytes_round_up, build_fold_addr_expr, get_inner_reference(), ggc_alloc(), sizetype, and tree_to_aff_combination().

Referenced by dr_may_alias_p(), and mem_refs_may_alias_p().

◆ tree_to_aff_combination()

◆ tree_to_aff_combination_expand()

void tree_to_aff_combination_expand ( tree expr,
tree type,
aff_tree * comb,
hash_map< tree, name_expansion * > ** cache )
Similar to tree_to_aff_combination, but follows SSA name definitions
and expands them recursively.  CACHE is used to cache the expansions
of the ssa names, to avoid exponential time complexity for cases

a1 = a0 + a0;
a2 = a1 + a1;
a3 = a2 + a2;

References aff_combination_expand(), cache, ggc_alloc(), and tree_to_aff_combination().

Referenced by pcom_worker::aff_combination_dr_offset(), pcom_worker::determine_offset(), difference_cannot_overflow_p(), get_alternative_base(), simplify_peeled_chrec(), and pcom_worker::valid_initializer_p().

◆ unshare_aff_combination()

void unshare_aff_combination ( aff_tree * comb)
Copies the tree elements of COMB to ensure that they are not shared.   

References ggc_alloc(), i, and unshare_expr().

Referenced by get_computation_at(), rewrite_use_address(), and rewrite_use_nonlinear_expr().