GCC Middle and Back End API Reference
|
Data Structures | |
class | sese_dom_walker |
|
static |
Add conditional statement STMT to pbb. CODE is used as the comparison operator. This allows us to invert the condition or to handle inequalities.
References gimple_cond_code(), and invert_tree_comparison().
|
static |
Traverses all the GBBs of the SCOP and add their constraints to the iteration domains.
|
static |
Add conditions to the domain of PBB.
The conditions for ELSE-branches are inverted.
Switch statements are not supported right now - fall through.
|
static |
Add constraints on the possible values of parameter P from the type of P.
References scop_nb_params().
|
static |
Returns true if all predecessors of BB, that are not dominated by BB, are marked in MAP. The predecessors dominated by BB are loop latches and will be handled after BB.
References d1, d2, loop_depth(), and basic_block_def::loop_father.
Referenced by build_scop_bbs_1().
|
static |
Analyze all the data references of STMTS and add them to the GBB_DATA_REFS vector of BB.
|
static |
Uses DFS component number as representative of alias-sets. Also tests for optimality by verifying if every connected component is a clique. Returns true (1) if the above test is true, and false (0) otherwise.
Verify if the DFS numbering results in optimal solution.
Get all vertices whose DFS component number is the same as i.
Now test if the vertices in 'vertices' form a clique, by testing for edges among each pair.
Check if the two vertices are connected by iterating through all the edges which have one of these are source.
Referenced by build_base_obj_set_for_drs().
|
static |
Group each data reference in DRS with its base object set num.
References data_reference::aux, build_alias_set_optimal_p(), free_gimple_bb(), and free_poly_bb().
|
static |
Builds the constraint polyhedra for LOOP in SCOP. OUTER_PH gives the constraints for the surrounding loops.
0 <= loop_i
loop_i <= cst_nb_iters
loop_i <= expr_nb_iters
Insert in the context the constraints from the estimation of the number of iterations NIT and the symbolic number of iterations (involving parameter names) NB_ITERS. First, build the affine expression "NIT - NB_ITERS" and then say that it is positive, i.e., NIT approximates NB_ITERS: "NIT >= NB_ITERS".
|
static |
Build the data references for PBB.
|
static |
Converts the STATIC_SCHEDULE of PBB into a scattering polyhedron. We generate SCATTERING_DIMENSIONS scattering dimensions. CLooG 0.15.0 and previous versions require, that all scattering functions of one CloogProgram have the same number of scattering dimensions, therefore we allow to specify it. This should be removed in future versions of CLooG. The scattering polyhedron consists of these dimensions: scattering, loop_iterators, parameters. Example: | scattering_dimensions = 5 | used_scattering_dimensions = 3 | nb_iterators = 1 | scop_nb_params = 2 | | Schedule: | i | 4 5 | | Scattering polyhedron: | | scattering: {s1, s2, s3, s4, s5} | loop_iterators: {i} | parameters: {p1, p2} | | s1 s2 s3 s4 s5 i p1 p2 1 | 1 0 0 0 0 0 0 0 -4 = 0 | 0 1 0 0 0 -1 0 0 0 = 0 | 0 0 1 0 0 0 0 0 -5 = 0
Textual order inside this loop.
Iterations of this loop.
|
static |
Build data accesses for DR in PBB.
References dr_may_alias_p().
void build_poly_scop | ( | ) |
Builds the polyhedral representation for a SESE region.
FIXME: This restriction is needed to avoid a problem in CLooG. Once CLooG is fixed, remove this guard. Anyways, it makes no sense to optimize a scop containing only PBBs that do not belong to any loops.
Record all conditions in REGION.
Rewrite out of SSA only after having translated the representation to the polyhedral representation to avoid scev analysis failures. That means that these functions will insert new data references that they create in the right place.
This SCoP has been translated to the polyhedral representation.
|
static |
Gather the basic blocks belonging to the SCOP.
|
static |
Recursive helper function for build_scops_bbs.
References all_non_dominated_preds_marked_p().
|
static |
Build the context of the SCOP. The context usually contains extra constraints that are added to the iteration domains that constrain some parameters.
|
static |
Build data references in SCOP.
Remove all the PBBs that do not have data references: these basic blocks are not handled in the polyhedral representation.
TODO: Add support when building alias set is not optimal.
When debugging, enable the following code. This cannot be used in production compilers.
|
static |
Build the iteration domains: the loops belonging to the current SCOP, and that vary for the execution of the current basic block. Returns false if there is no loop in SCOP.
|
static |
@verbatim
Build for BB the static schedule.
The static schedule is a Dewey numbering of the abstract syntax tree: http://en.wikipedia.org/wiki/Dewey_Decimal_Classification
The following example informally defines the static schedule:
A for (i: ...) { for (j: ...) { B C }
for (k: ...) { D E } } F
Static schedules for A to F:
DEPTH 0 1 2 A 0 B 1 0 0 C 1 0 1 D 1 1 0 E 1 1 1 F 2
We have to start schedules at 0 on the first component and because we cannot compare_prefix_loops against a previous loop, prefix will be equal to zero, and that index will be incremented before copying.
|
static |
When the result of a CLOSE_PHI is written to a memory location, return a pointer to that memory reference, otherwise return NULL_TREE.
FIXME: this restriction is for id-{24,25}.f and could be handled by duplicating the computation of array indices before the loop of the close_phi.
Fallthru.
References gsi_commit_edge_inserts(), loop_in_sese_p(), rewrite_commutative_reductions_out_of_ssa_loop(), scev_reset_htab(), update_ssa(), and verify_loop_closed_ssa().
Referenced by translate_scalar_reduction_to_array_for_stmt().
|
static |
Compare the depth of two basic_block's P1 and P2.
|
static |
Returns a linear expression for tree T evaluated in PBB.
|
static |
Creates a zero dimension array of the same type as VAR.
|
static |
Detect commutative and associative scalar reductions belonging to the SCOP starting at the loop closed phi node STMT. Return the phi node of the reduction cycle, or NULL.
Note that loop close phi nodes should have a single argument because we translated the representation into a canonical form before Graphite: see canonicalize_loop_closed_ssa_form.
References dr_indices_valid_in_loop(), for_each_index(), gimple_phi_arg_def(), and loop_containing_stmt().
|
static |
Detect commutative and associative scalar reductions starting at the STMT. Return the phi node of the reduction cycle, or NULL.
References gimple_phi_arg_def(), gimple_phi_num_args(), and scalar_close_phi_node_p().
|
static |
Detect commutative and associative scalar reductions starting at STMT. Return the phi node of the reduction cycle, or NULL.
|
static |
Helper function for for_each_index. For each INDEX of the data reference REF, returns true when its indices are valid in the loop nest LOOP passed in as DATA.
Referenced by detect_commutative_reduction().
|
static |
Check if DR1 and DR2 are in the same object set.
|
static |
Dump to file the alias graphs for the data references in DRS.
|
static |
Return the argument of the loop PHI that is the initial value coming from outside the loop.
|
static |
Extract an affine expression from the tree E in the scop S.
No need to wrap a single integer.
|
static |
Extract an affine expression from the chain of recurrence E.
Before multiplying, make sure that the result is affine.
Referenced by parameter_index_in_region_1().
|
static |
Extract an affine expression from the gmp constant G.
Referenced by extract_affine_name().
|
static |
Extract an affine expression from the integer_cst E.
Referenced by set_index().
|
static |
Extract an affine expression from the mult_expr E.
Referenced by parameter_index_in_region_1().
|
static |
Extract an affine expression from the ssa_name E.
References extract_affine_gmp(), g, and tree_int_to_gmp().
|
static |
Find parameters with respect to REGION in BB. We are looking in memory access functions, conditions and loop bounds.
Find parameters in the access functions of data references.
Find parameters in conditional statements.
|
static |
Record the parameters used in the SCOP. A variable is a parameter in a scop if it does not vary during the execution of that scop.
Find the parameters used in the loop bounds.
Find the parameters used in data accesses.
References chrec_contains_undetermined(), g, loop::inner, number_of_latch_executions(), scalar_evolution_in_region(), and tree_int_to_gmp().
|
static |
Return a loop phi node that corresponds to a reduction containing LHS.
References gimple_assign_lhs(), gimple_phi_result(), gsi_after_labels(), gsi_for_stmt(), gsi_next(), insert_stmts(), and unshare_expr().
|
static |
Return a loop phi node that corresponds to a reduction containing LHS.
References edge_def::dest, gimple_phi_arg_def(), gimple_phi_arg_edge(), gimple_phi_num_args(), loop_depth(), basic_block_def::loop_father, and edge_def::src.
Referenced by split_reduction_stmt().
|
static |
|
static |
Frees GBB.
Referenced by build_base_obj_set_for_drs().
void free_scops | ( | ) |
Deletes all scops in SCOPS.
|
static |
Sort the basic blocks from DOM such that the first are the ones at a deepest loop level.
|
static |
Return a gsi at the position of the phi node STMT.
|
static |
For every definition DEF in the SCOP that is used outside the scop, insert a closing-scop definition in the basic block just after this SCOP.
Insert in the empty BB just after the scop a use of DEF such that the rewrite of cross_bb_scalar_dependences won't insert arrays everywhere else.
|
static |
Return the argument of the loop PHI that is the initial value coming from outside the loop.
|
static |
Insert the assignment "RES := EXPR" just after AFTER_STMT.
|
static |
Insert on edge E the assignment "RES := EXPR".
References gimple_bb(), gimple_phi_arg_def(), gimple_phi_num_args(), gimple_phi_result(), gsi_after_labels(), gsi_insert_before(), GSI_NEW_STMT, gsi_next(), gsi_stmt(), is_gimple_min_invariant(), basic_block_def::loop_father, propagate_expr_outside_region(), and remove_phi_node().
|
static |
Insert STMT at the end of the STMTS sequence and then insert the statements from STMTS at INSERT_GSI and call analyze_drs_in_stmts on STMTS.
Referenced by follow_inital_value_to_phi().
|
inlinestatic |
Return true when stmt is a reduction operation.
|
static |
Return an ISL identifier for the data reference DR.
Data references all get the same isl_id. They need to be comparable and are distinguished through the first dimension, which contains the alias set number.
|
static |
Return an ISL identifier for the polyhedral basic block PBB.
References poly_bb::domain, pbb_dim_iter_domain(), and poly_bb::schedule.
|
static |
Return an ISL identifier from the name of the ssa_name E.
References dom.
|
static |
Return the number of data references in BB that write in memory.
References phi_contains_arg().
|
static |
Returns the number of pbbs that are in loops contained in SCOP.
|
static |
Store the GRAPHITE representation of BB.
|
static |
Creates a poly_bb_p for basic_block BB from the existing PBB.
The INDEX of PBB in SCOP_BBS.
|
static |
Same as outermost_loop_in_sese, 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.
When the basic block BB does not belong to a loop in the region, return the first loop in the region.
|
static |
When the parameter NAME is in REGION, returns its index in SESE_PARAMS. Otherwise this function inserts NAME in SESE_PARAMS and returns the index of NAME.
|
inlinestatic |
When parameter NAME is in REGION, returns its index in SESE_PARAMS. Otherwise returns -1.
References chrec_dont_know, extract_affine_chrec(), extract_affine_mul(), and type().
Referenced by wrap().
|
static |
Add a constrain to the ACCESSES polyhedron for the alias set of data reference DR. ACCESSP_NB_DIMS is the dimension of the ACCESSES polyhedron, DOM_NB_DIMS is the dimension of the iteration domain.
References array_ref_low_bound(), array_ref_up_bound(), DR_NUM_DIMENSIONS, and DR_REF.
|
static |
Add constrains representing the size of the accessed data to the ACCESSES polyhedron. ACCESSP_NB_DIMS is the dimension of the ACCESSES polyhedron, DOM_NB_DIMS is the dimension of the iteration domain.
XXX The PPL code dealt separately with subscript - low >= 0 and high - subscript >= 0 in case one of the two bounds isn't known. Do the same here?
1-element arrays at end of structures may extend over their declared size.
high >= 0
low <= sub_i <= high
|
static |
Add to ACCESSES polyhedron equalities defining the access functions to the memory. ACCESSP_NB_DIMS is the dimension of the ACCESSES polyhedron, DOM_NB_DIMS is the dimension of the iteration domain. PBB is the poly_bb_p that contains the data reference DR.
|
static |
Returns the index of the PHI argument defined in the outermost loop.
|
static |
Returns true when PHI contains an argument ARG.
References edge_def::dest, gimple_phi_arg_edge(), loop_depth(), basic_block_def::loop_father, and edge_def::src.
Referenced by nb_data_writes_in_bb().
|
static |
For a definition DEF in REGION, propagates the expression EXPR in all the uses of DEF outside REGION.
Referenced by insert_out_of_ssa_copy_on_edge(), and rewrite_reductions_out_of_ssa().
|
static |
Returns true when the phi node at position PSI is a reduction phi node in REGION. Otherwise moves the pointer PSI to the next phi to be considered.
PRE introduces phi nodes like these, for an example, see id-5.f in the fortran graphite testsuite: # prephitmp.85_265 = PHI <prephitmp.85_258(33), prephitmp.85_265(18)>
All the other cases are considered reductions.
References remove_simple_copy_phi().
|
static |
Deletes all gimple bbs in SCOP.
References free_scop(), and free_sese().
|
static |
Removes an invariant phi node at position PSI by inserting on the loop ENTRY edge the assignment RES = INIT.
|
static |
Removes the PHI node and resets all the debug stmts that are using the PHI_RESULT.
|
static |
Removes a simple copy phi node "RES = phi (INIT, RES)" at position PSI by inserting on the loop ENTRY edge assignment "RES = INIT".
Referenced by reduction_phi_p().
|
static |
Rewrite out of SSA the reduction phi node at PSI by creating a zero dimension array for it.
Note that loop close phi nodes should have a single argument because we translated the representation into a canonical form before Graphite: see canonicalize_loop_closed_ssa_form.
The phi node can be a non close phi node, when its argument is invariant, or a default definition.
If res is scev analyzable and is not a scalar value, it is safe to ignore the close phi node: it will be code generated in the out of Graphite pass.
|
static |
Rewrites all the commutative reductions from SCOP out of SSA.
|
static |
Rewrites out of SSA a commutative reduction at CLOSE_PHI. Returns true when something has been changed.
Rewrites all the commutative reductions from LOOP out of SSA. Returns true when something has been changed.
Referenced by close_phi_written_to_memory().
|
static |
Rewrite the scalar dependence of DEF used in USE_STMT with a memory read from ZERO_DIM_ARRAY.
|
static |
Rewrite the scalar dependences crossing the boundary of the BB containing STMT with an array. Return true when something has been changed.
References gimple_vdef(), gsi_end_p(), gsi_next(), gsi_start_bb(), and gsi_stmt().
|
static |
Rewrite out of SSA all the reduction phi nodes of SCOP.
Create an extra empty BB after the scop.
|
static |
Rewrite the degenerate phi node at position PSI from the degenerate form "x = phi (y, y, ..., y)" to "x = y".
|
static |
Rewrite out of SSA the reduction phi node at PSI by creating a zero dimension array for it.
Avoid the insertion of code in the loop latch to please the pattern matching of the vectorizer.
|
static |
Rewrite out of SSA all the reduction phi nodes of SCOP.
References gimple_assign_lhs(), gimple_call_lhs(), gsi_stmt(), is_gimple_reg(), loop_containing_stmt(), propagate_expr_outside_region(), scalar_evolution_in_region(), scev_analyzable_p(), and tree_contains_chrecs().
|
static |
Returns true when PHI is a loop close phi node.
Note that loop close phi nodes should have a single argument because we translated the representation into a canonical form before Graphite: see canonicalize_loop_closed_ssa_form.
Referenced by detect_commutative_reduction_arg().
|
static |
In the context of sese S, scan the expression E and translate it to a linear expression C. When parsing a symbolic multiplication, K represents the constant multiplier of an expression containing parameters.
|
static |
Can all ivs be represented by a signed integer? As CLooG might generate negative values in its expressions, signed loop ivs are required in the backend.
|
static |
Assign the affine expression INDEX to the output dimension POS of MAP and return the result.
References scop::context, and extract_affine_int().
|
inlinestatic |
Returns true when the phi node at PSI is of the form "a = phi (a, x)".
|
static |
Returns a COND_EXPR statement when BB has a single predecessor, the edge between BB and its predecessor is not a loop exit edge, and the last statement of the single predecessor is a COND_EXPR.
References edge_def::flags, sese_dom_walker::m_cases, sese_dom_walker::m_conditions, and single_pred_edge().
|
static |
Splits at STMT the basic block BB represented as PBB in the polyhedral form.
|
static |
Splits STMT out of its current BB. This is done for reduction statements for which we want to ignore data dependences.
Do not split basic blocks with no writes to memory: the reduction will be the only write to memory.
Or if we have already marked BB as a reduction.
Split once more only when the reduction stmt is not the only one left in the original BB.
A part of the data references will end in a different basic block after the split: move the DRs from the original GBB to the newly created GBB1.
References follow_ssa_with_commutative_ops().
Referenced by translate_scalar_reduction_to_array_for_stmt().
|
static |
Rewrite out of SSA the reduction described by the loop phi nodes IN, and the close phi nodes OUT. IN and OUT are structured by loop levels like this: IN: stmt, loop_n, ..., loop_0 OUT: stmt, close_n, ..., close_0 the first element is the reduction statement, and the next elements are the loop and close phi nodes of each of the outer loops.
|
static |
Translate the scalar reduction statement STMT to an array RED knowing that its recursive phi node is LOOP_PHI.
References close_phi_written_to_memory(), pbb_from_bb(), and split_reduction_stmt().
|
inlinestatic |
@verbatim
Conversion of SESE regions to Polyhedra. Copyright (C) 2009-2013 Free Software Foundation, Inc. Contributed by Sebastian Pop sebas. tian .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 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/.
Assigns to RES the value of the INTEGER_CST T.
Referenced by extract_affine_name(), and find_scop_parameters().
|
static |
Generates a polyhedral black box only if the bb contains interesting information.
|
static |
Returns true when DEF is used outside the reduction cycle of LOOP_PHI.
In LOOP, DEF should be used only in LOOP_PHI.
|
static |
Compute pwaff mod 2^width.
References parameter_index_in_region_1().
|
inlinestatic |
Write to FILE the alias graph of data references in DIMACS format.
|
inlinestatic |
Write to FILE the alias graph of data references in DOT format.
First print all the vertices.
References add_edge().
|
inlinestatic |
Write to FILE the alias graph of data references in ECC format.
References vertex::component, vertex::pred, graph_edge::pred_next, graph_edge::src, and graph::vertices.