GCC Middle and Back End API Reference
sese.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "hash-table.h"
#include "tree.h"
#include "tree-pretty-print.h"
#include "gimple.h"
#include "gimple-ssa.h"
#include "tree-cfg.h"
#include "tree-phinodes.h"
#include "ssa-iterators.h"
#include "tree-ssanames.h"
#include "tree-ssa-loop.h"
#include "tree-into-ssa.h"
#include "cfgloop.h"
#include "tree-chrec.h"
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
#include "tree-pass.h"
#include "value-prof.h"
#include "sese.h"
#include "tree-ssa-propagate.h"
Include dependency graph for sese.c:

Data Structures

struct  rename_map_hasher

Typedefs

typedef hash_table
< rename_map_hasher
rename_map_type

Functions

static void debug_rename_elt ()
int debug_rename_map_1 ()
DEBUG_FUNCTION void debug_rename_map ()
hashval_t rename_map_elt_info ()
int eq_rename_map_elts ()
static void sese_record_loop ()
void build_sese_loop_nests ()
static void sese_build_liveouts_use (sese region, bitmap liveouts, basic_block bb, tree use)
static void sese_build_liveouts_bb ()
static bool sese_bad_liveouts_use (sese region, bitmap liveouts, basic_block bb, tree use)
static void sese_reset_debug_liveouts_bb ()
static void sese_build_liveouts ()
sese new_sese ()
void free_sese ()
static void sese_add_exit_phis_edge ()
void sese_insert_phis_for_liveouts (sese region, basic_block bb, edge false_e, edge true_e)
edge get_true_edge_from_guard_bb ()
edge get_false_edge_from_guard_bb ()
static tree get_rename ()
static void set_rename ()
static bool rename_uses (gimple copy, rename_map_type rename_map, gimple_stmt_iterator *gsi_tgt, sese region, loop_p loop, vec< tree > iv_map, bool *gloog_error)
static void graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb, rename_map_type rename_map, vec< tree > iv_map, sese region, bool *gloog_error)
edge copy_bb_and_scalar_dependences (basic_block bb, sese region, edge next_e, vec< tree > iv_map, bool *gloog_error)
struct loopoutermost_loop_in_sese ()
void if_region_set_false_region ()
static ifsese create_if_region_on_edge ()
ifsese move_sese_in_condition ()
void set_ifsese_condition ()
tree scalar_evolution_in_region ()

Typedef Documentation


Function Documentation

void build_sese_loop_nests ( )

Build the loop nests contained in REGION. Returns true when the operation was successful.

  Only add loops if they are completely contained in the SCoP.   

Make sure that the loops in the SESE_LOOP_NEST are ordered. It can be the case that an inner loop is inserted before an outer loop. To avoid this, semi-sort once.

edge copy_bb_and_scalar_dependences ( basic_block  bb,
sese  region,
edge  next_e,
vec< tree iv_map,
bool gloog_error 
)

Copies BB and includes in the copied BB all the statements that can be reached following the use-def chains from the memory accesses, and returns the next edge following this new block. GLOOG_ERROR is set when the code generation cannot continue.

static ifsese create_if_region_on_edge ( )
static

Creates an IFSESE with CONDITION on edge ENTRY.

References if_region_set_false_region(), integer_one_node, SESE_ENTRY, single_pred_edge(), single_succ_edge(), and split_edge().

static void debug_rename_elt ( )
static

Single entry single exit control flow regions. Copyright (C) 2008-2013 Free Software Foundation, Inc. Contributed by Jan Sjodin jan.s.nosp@m.jodi.nosp@m.n@amd.nosp@m..com and Sebastian Pop sebas.nosp@m.tian.nosp@m..pop@.nosp@m.amd..nosp@m.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 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/. Print to stderr the element ELT.

DEBUG_FUNCTION void debug_rename_map ( )

Print to stderr all the elements of RENAME_MAP.

References SSA_NAME_VERSION.

int debug_rename_map_1 ( )

Helper function for debug_rename_map.

int eq_rename_map_elts ( )

Compares database elements E1 and E2.

References bitmap_set_bit, loop::num, sese_contains_loop(), SESE_LOOP_NEST, and SESE_LOOPS.

void free_sese ( )

Deletes REGION.

edge get_false_edge_from_guard_bb ( )

Returns the first successor edge of BB with EDGE_TRUE_VALUE flag cleared.

static tree get_rename ( )
static

Returns the expression associated to OLD_NAME in RENAME_MAP.

edge get_true_edge_from_guard_bb ( )

Returns the first successor edge of BB with EDGE_TRUE_VALUE flag set.

static void graphite_copy_stmts_from_block ( basic_block  bb,
basic_block  new_bb,
rename_map_type  rename_map,
vec< tree iv_map,
sese  region,
bool gloog_error 
)
static

Duplicates the statements of basic block BB into basic block NEW_BB and compute the new induction variables according to the IV_MAP. GLOOG_ERROR is set when the code generation cannot continue.

     Do not copy labels or conditions.   
     Do not copy induction variables.   
     Create a new copy of STMT and duplicate STMT's virtual
     operands.   
     Create new names for all the definitions created by COPY and
     add replacement mappings for each new name.   
void if_region_set_false_region ( )

Sets the false region of an IF_REGION to REGION.

Referenced by create_if_region_on_edge().

ifsese move_sese_in_condition ( )

Moves REGION in a condition expression: | if (1) | ; | else | REGION;

References analyze_scalar_evolution(), block_before_sese(), defined_in_sese_p(), instantiate_scev(), loop_containing_stmt(), loop_in_sese_p(), SSA_NAME_DEF_STMT, and TREE_CODE.

sese new_sese ( )

Builds a new SESE region from edges ENTRY and EXIT.

struct loop* outermost_loop_in_sese ( )
read

Returns the outermost loop in SCOP that contains BB.

hashval_t rename_map_elt_info ( )

Computes a hash function for database element ELT.

References rename_map_elt_s::old_name.

static bool rename_uses ( gimple  copy,
rename_map_type  rename_map,
gimple_stmt_iterator gsi_tgt,
sese  region,
loop_p  loop,
vec< tree iv_map,
bool gloog_error 
)
static

Renames the scalar uses of the statement COPY, using the substitution map RENAME_MAP, inserting the gimplification code at GSI_TGT, for the translation REGION, with the original copied statement in LOOP, and using the induction variable renaming map IV_MAP. Returns true when something has been renamed. GLOOG_ERROR is set when the code generation cannot continue.

     At this point we should know the exact scev for each
     scalar SSA_NAME used in the scop: all the other scalar
     SSA_NAMEs should have been translated out of SSA using
     arrays with one element.   
     The apply should produce an expression tree containing
     the uses of the new induction variables.  We should be
     able to use new_expr instead of the old_name in the newly
     generated loop nest.   
       Replace the old_name with the new_expr.   
tree scalar_evolution_in_region ( )

Returns the scalar evolution of T in REGION. Every variable that is not defined in the REGION is considered a parameter.

SCOP parameters.

static void sese_add_exit_phis_edge ( )
static
static bool sese_bad_liveouts_use ( sese  region,
bitmap  liveouts,
basic_block  bb,
tree  use 
)
static

For a USE in BB, return true if BB is outside REGION and it's not in the LIVEOUTS set.

If it's in liveouts, the variable will get a new PHI node, and the debug use will be properly adjusted.

static void sese_build_liveouts ( )
static

Build the LIVEOUTS of REGION: the set of variables defined inside and used outside the REGION.

Referenced by sese_add_exit_phis_edge().

static void sese_build_liveouts_bb ( )
static

Marks for rewrite all the SSA_NAMES defined in REGION and that are used in BB that is outside of the REGION.

static void sese_build_liveouts_use ( sese  region,
bitmap  liveouts,
basic_block  bb,
tree  use 
)
static

For a USE in BB, if BB is outside REGION, mark the USE in the LIVEOUTS set.

void sese_insert_phis_for_liveouts ( sese  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 edge_def::flags, and FOR_EACH_EDGE.

static void sese_record_loop ( )
static

Record LOOP as occurring in REGION.

References bb_in_sese_p(), FOR_EACH_BB, and basic_block_def::loop_father.

static void sese_reset_debug_liveouts_bb ( )
static

Reset debug stmts that reference SSA_NAMES defined in REGION that are not marked as liveouts.

void set_ifsese_condition ( )

Replaces the condition of the IF_REGION with CONDITION: | if (CONDITION) | true_region; | else | false_region;

References analyze_scalar_evolution(), compute_overall_effect_of_inner_loop(), loop_depth(), and superloop_at_depth().

static void set_rename ( )
static