GCC Middle and Back End API Reference
sese.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "cfghooks.h"
#include "tree-pass.h"
#include "ssa.h"
#include "tree-pretty-print.h"
#include "fold-const.h"
#include "gimplify.h"
#include "gimple-iterator.h"
#include "gimple-pretty-print.h"
#include "gimplify-me.h"
#include "tree-cfg.h"
#include "tree-ssa-loop.h"
#include "tree-into-ssa.h"
#include "cfgloop.h"
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
#include "tree-ssa-propagate.h"
#include "cfganal.h"
#include "sese.h"
Include dependency graph for sese.cc:


static void sese_build_liveouts_use (sese_info_p region, bitmap liveouts, basic_block bb, tree use)
static void sese_build_liveouts_bb (sese_info_p region, basic_block bb)
static void sese_reset_debug_liveouts (sese_info_p region)
void sese_build_liveouts (sese_info_p region)
sese_info_p new_sese_info (edge entry, edge exit)
void free_sese_info (sese_info_p region)
static void sese_add_exit_phis_edge (basic_block exit, tree use, edge false_e, edge true_e)
void sese_insert_phis_for_liveouts (sese_info_p region, basic_block bb, edge false_e, edge true_e)
class loopoutermost_loop_in_sese_1 (sese_l &region, basic_block bb)
loop_p outermost_loop_in_sese (sese_l &region, basic_block bb)
edge get_true_edge_from_guard_bb (basic_block bb)
edge get_false_edge_from_guard_bb (basic_block bb)
ifsese move_sese_in_condition (sese_info_p region)
void set_ifsese_condition (ifsese if_region, tree condition)
bool invariant_in_sese_p_rec (tree t, const sese_l &region, bool *has_vdefs)
bool scev_analyzable_p (tree def, sese_l &region)
tree scalar_evolution_in_region (const sese_l &region, loop_p loop, tree t)
bool sese_trivially_empty_bb_p (basic_block bb)
void print_edge (FILE *file, const_edge e)
void print_sese (FILE *file, const sese_l &s)
DEBUG_FUNCTION void debug_edge (const_edge e)
DEBUG_FUNCTION void debug_sese (const sese_l &s)

Function Documentation

◆ debug_edge()

DEBUG_FUNCTION void debug_edge ( const_edge e)
Pretty print edge E to STDERR.   

References ggc_alloc(), and print_edge().

◆ debug_sese()

DEBUG_FUNCTION void debug_sese ( const sese_l & s)
Pretty print sese S to STDERR.   

References ggc_alloc(), and print_sese().

◆ free_sese_info()

void free_sese_info ( sese_info_p region)
Deletes REGION.   

References BITMAP_FREE, ggc_alloc(), and NULL.

◆ get_false_edge_from_guard_bb()

edge get_false_edge_from_guard_bb ( basic_block bb)
Returns the first successor edge of BB with EDGE_TRUE_VALUE flag cleared.   

References FOR_EACH_EDGE, gcc_unreachable, ggc_alloc(), NULL, and basic_block_def::succs.

◆ get_true_edge_from_guard_bb()

edge get_true_edge_from_guard_bb ( basic_block bb)
Returns the first successor edge of BB with EDGE_TRUE_VALUE flag set.   

References FOR_EACH_EDGE, gcc_unreachable, ggc_alloc(), NULL, and basic_block_def::succs.

◆ invariant_in_sese_p_rec()

bool invariant_in_sese_p_rec ( tree t,
const sese_l & region,
bool * has_vdefs )
Return true when T is defined outside REGION or when no definitions are
variant in REGION.  When HAS_VDEFS is a valid pointer, sets HAS_VDEFS to true
when T depends on memory that may change in REGION.   

References defined_in_sese_p(), FOR_EACH_SSA_USE_OPERAND, ggc_alloc(), gimple_vdef(), gimple_vuse(), invariant_in_sese_p_rec(), SSA_NAME_DEF_STMT, SSA_OP_USE, and USE_FROM_PTR.

Referenced by invariant_in_sese_p_rec().

◆ move_sese_in_condition()

◆ new_sese_info()

sese_info_p new_sese_info ( edge entry,
edge exit )
Builds a new SESE region from edges ENTRY and EXIT.   

References ggc_alloc(), and NULL.

◆ outermost_loop_in_sese()

loop_p outermost_loop_in_sese ( sese_l & region,
basic_block bb )
Same as outermost_loop_in_sese_1, returns the outermost loop
containing BB in REGION, but makes sure that the returned loop
belongs to the REGION, and so this returns the first loop in the
REGION when the loop containing BB does not belong to REGION.   

References gcc_assert, ggc_alloc(), loop_in_sese_p(), and outermost_loop_in_sese_1().

◆ outermost_loop_in_sese_1()

class loop * outermost_loop_in_sese_1 ( sese_l & region,
basic_block bb )
Returns the outermost loop in SCOP that contains BB.   

References ggc_alloc(), basic_block_def::loop_father, loop_in_sese_p(), and loop_outer().

Referenced by outermost_loop_in_sese().

◆ print_edge()

void print_edge ( FILE * file,
const_edge e )
Pretty print edge E to FILE.   

References ggc_alloc().

Referenced by debug_edge(), and print_sese().

◆ print_sese()

void print_sese ( FILE * file,
const sese_l & s )
Pretty print sese S to FILE.   

References sese_l::entry, sese_l::exit, ggc_alloc(), and print_edge().

Referenced by debug_sese().

◆ scalar_evolution_in_region()

tree scalar_evolution_in_region ( const sese_l & region,
loop_p loop,
tree t )
Returns the scalar evolution of T in REGION.  Every variable that
is not defined in the REGION is considered a parameter.   

References analyze_scalar_evolution(), defined_in_sese_p(), sese_l::entry, instantiate_scev(), loop_in_sese_p(), NULL, and TREE_CODE.

Referenced by scev_analyzable_p().

◆ scev_analyzable_p()

◆ sese_add_exit_phis_edge()

static void sese_add_exit_phis_edge ( basic_block exit,
tree use,
edge false_e,
edge true_e )

◆ sese_build_liveouts()

void sese_build_liveouts ( sese_info_p region)
Build the LIVEOUTS of REGION: the set of variables defined inside
and used outside the REGION.   

References bb_in_sese_p(), BITMAP_ALLOC, cfun, FOR_EACH_BB_FN, gcc_assert, NULL, and sese_build_liveouts_bb().

◆ sese_build_liveouts_bb()

static void sese_build_liveouts_bb ( sese_info_p region,
basic_block bb )
Marks for rewrite all the SSA_NAMES defined in REGION and that are
used in BB that is outside of the REGION.   

References FOR_EACH_PHI_ARG, FOR_EACH_SSA_USE_OPERAND, ggc_alloc(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), is_gimple_debug(), sese_build_liveouts_use(), SSA_OP_USE, and USE_FROM_PTR.

Referenced by sese_build_liveouts().

◆ sese_build_liveouts_use()

static void sese_build_liveouts_use ( sese_info_p region,
bitmap liveouts,
basic_block bb,
tree use )
Single entry single exit control flow regions.
   Copyright (C) 2008-2024 Free Software Foundation, Inc.
   Contributed by Jan Sjodin <jan.sjodin@amd.com> and
   Sebastian Pop <sebastian.pop@amd.com>.

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
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
For a USE in BB, if BB is outside REGION, mark the USE in the
LIVEOUTS set.   

References bb_in_sese_p(), bitmap_set_bit, gcc_assert, ggc_alloc(), gimple_bb(), SSA_NAME_DEF_STMT, SSA_NAME_VERSION, and TREE_CODE.

Referenced by sese_build_liveouts_bb().

◆ sese_insert_phis_for_liveouts()

void sese_insert_phis_for_liveouts ( sese_info_p region,
basic_block bb,
edge false_e,
edge true_e )
Insert in the block BB phi nodes for variables defined in REGION
  and used outside the REGION.  The code generation moves REGION in
  the else clause of an "if (1)" and generates code in the then
  clause that is at this point empty:

  | if (1)
  |   empty;
  | else
  |   REGION;

References EXECUTE_IF_SET_IN_BITMAP, ggc_alloc(), i, MAY_HAVE_DEBUG_BIND_STMTS, sese_add_exit_phis_edge(), sese_reset_debug_liveouts(), ssa_name, and virtual_operand_p().

◆ sese_reset_debug_liveouts()

static void sese_reset_debug_liveouts ( sese_info_p region)
Reset debug stmts that reference SSA_NAMES defined in REGION that
are not marked as liveouts.   

References bb_in_sese_p(), EXECUTE_IF_AND_COMPL_IN_BITMAP, FOR_EACH_IMM_USE_STMT, ggc_alloc(), gimple_bb(), gimple_debug_bind_reset_value(), i, is_gimple_debug(), ssa_name, and update_stmt().

Referenced by sese_insert_phis_for_liveouts().

◆ sese_trivially_empty_bb_p()

bool sese_trivially_empty_bb_p ( basic_block bb)
Return true if BB is empty, contains only DEBUG_INSNs.   

References ggc_alloc(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), and is_gimple_debug().

◆ set_ifsese_condition()

void set_ifsese_condition ( ifsese if_region,
tree condition )
Replaces the condition of the IF_REGION with CONDITION:
  | if (CONDITION)
  |   true_region;
  | else
  |   false_region;

References force_gimple_operand_gsi_1(), gcc_assert, ggc_alloc(), gimple_build_cond_from_tree(), gsi_insert_before(), gsi_last_bb(), gsi_remove(), GSI_SAME_STMT, is_gimple_condexpr_for_cond(), NULL_TREE, and ifsese_s::region.