GCC Middle and Back End API Reference
tree_loop_interchange Class Reference
Collaboration diagram for tree_loop_interchange:

Public Member Functions

 tree_loop_interchange (vec< class loop * > loop_nest)
 
 ~tree_loop_interchange ()
 
bool interchange (vec< data_reference_p >, vec< ddr_p >)
 

Private Member Functions

void update_data_info (unsigned, unsigned, vec< data_reference_p >, vec< ddr_p >)
 
bool valid_data_dependences (unsigned, unsigned, vec< ddr_p >)
 
void interchange_loops (loop_cand &, loop_cand &)
 
void map_inductions_to_loop (loop_cand &, loop_cand &)
 
void move_code_to_inner_loop (class loop *, class loop *, basic_block *)
 

Private Attributes

vec< class loop * > m_loop_nest
 
tree m_niters_iv_var
 
bitmap m_dce_seeds
 

Detailed Description

Class for loop interchange transformation.   

Constructor & Destructor Documentation

◆ tree_loop_interchange()

tree_loop_interchange::tree_loop_interchange ( vec< class loop * > loop_nest)
inline

◆ ~tree_loop_interchange()

tree_loop_interchange::~tree_loop_interchange ( )
inline

References BITMAP_FREE, and m_dce_seeds.

Member Function Documentation

◆ interchange()

◆ interchange_loops()

◆ map_inductions_to_loop()

void tree_loop_interchange::map_inductions_to_loop ( loop_cand & src,
loop_cand & tgt )
private
Map induction variables of SRC loop to TGT loop.  The function firstly
creates the same IV of SRC loop in TGT loop, then deletes the original
IV and re-initialize it using the newly created IV.  For example, loop
nest:

  for (i = 0; i < N; i++)
    for (j = 0; j < M; j++)
      {
        //use of i;
        //use of j;
      }

will be transformed into:

  for (jj = 0; jj < M; jj++)
    for (ii = 0; ii < N; ii++)
      {
        //use of ii;
        //use of jj;
      }

after loop interchange.   

References bitmap_set_bit, create_iv(), FOR_EACH_IMM_USE_ON_STMT, FOR_EACH_IMM_USE_STMT, FOR_EACH_PHI_OR_STMT_USE, gcc_assert, gsi_for_stmt(), gsi_last_bb(), i, is_a(), m_dce_seeds, loop_cand::m_exit, loop_cand::m_inductions, loop_cand::m_loop, m_niters_iv_var, remove_phi_node(), SET_USE, SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, SSA_NAME_VERSION, SSA_OP_USE, iv::step, TREE_CODE, unshare_expr(), update_stmt(), and USE_FROM_PTR.

Referenced by interchange_loops().

◆ move_code_to_inner_loop()

void tree_loop_interchange::move_code_to_inner_loop ( class loop * outer,
class loop * inner,
basic_block * outer_bbs )
private

◆ update_data_info()

void tree_loop_interchange::update_data_info ( unsigned i_idx,
unsigned o_idx,
vec< data_reference_p > datarefs,
vec< ddr_p > ddrs )
private
Update data refs' access stride and dependence information after loop
interchange.  I_IDX/O_IDX gives indices of interchanged loops in loop
nest.  DATAREFS are data references.  DDRS are data dependences.   

References chrec_known, DDR_ARE_DEPENDENT, DDR_DIST_VECT, DDR_NUM_DIST_VECTS, DR_ACCESS_STRIDE, gcc_assert, and i.

Referenced by interchange().

◆ valid_data_dependences()

bool tree_loop_interchange::valid_data_dependences ( unsigned i_idx,
unsigned o_idx,
vec< ddr_p > ddrs )
private
Check data dependence relations, return TRUE if it's valid to interchange
two loops specified by I_IDX/O_IDX.  Theoretically, interchanging the two
loops is valid only if dist vector, after interchanging, doesn't have '>'
as the leftmost non-'=' direction.  Practically, this function have been
conservative here by not checking some valid cases.   

References chrec_known, DDR_ARE_DEPENDENT, DDR_DIST_VECT, DDR_NUM_DIST_VECTS, DDR_REVERSED_P, dependence_level(), i, and m_loop_nest.

Referenced by interchange().

Field Documentation

◆ m_dce_seeds

bitmap tree_loop_interchange::m_dce_seeds
private

◆ m_loop_nest

vec<class loop *> tree_loop_interchange::m_loop_nest
private

◆ m_niters_iv_var

tree tree_loop_interchange::m_niters_iv_var
private

The documentation for this class was generated from the following file: