Candl 0.6.0
|
#include <stdio.h>
#include <candl/statement.h>
#include <candl/matrix.h>
#include <candl/program.h>
#include <candl/options.h>
Go to the source code of this file.
#define CANDL_ARRAY_BUFF_SIZE 2048 |
------ ( ----------------------------------------------------------** )\ CAnDL ** ----- / ) --------------------------------------------------------** ( * ( dependence.h ** ---- #/ --------------------------------------------------------** .-"#'-. First version: september 18th 2003 ** --- |"-.-"| -------------------------------------------------------** | | | | | | ************************************************************* CAnDL '-._,-' the Chunky Analyzer for Dependences in Loops (experimental) *
* Copyright (C) 2003-2008 Cedric Bastoul * * This 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 2 of the License, or (at your option) any later * version. * * This software 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 software; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * CAnDL, the Chunky Dependence Analyzer * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr * *
#define CANDL_VAR_IS_DEF 2 |
#define CANDL_VAR_IS_DEF_USED 4 |
Referenced by candl_dependence_scalar_renaming(), and candl_dependence_var_is_ref().
#define CANDL_VAR_IS_USED 3 |
Referenced by candl_dependence_scalar_renaming(), and candl_dependence_var_is_ref().
#define CANDL_VAR_UNDEF 1 |
typedef struct candldependence* candl_dependence_p |
typedef struct candldependence candl_dependence_t |
typedef struct candldependence CandlDependence |
void candl_compute_last_writer | ( | CandlDependence * | dep, |
CandlProgram * | prog | ||
) |
Compute the last writer for each RAW, WAW, and RAR dependence. This will modify the dependence polyhedra. Be careful of any references to the old dependence polyhedra. They are freed and new ones allocated.
References candl_dep_compute_lastwriter(), CANDL_RAR, CANDL_RAW, CANDL_WAW, candldependence::next, and candldependence::type.
Referenced by candl_dependence().
candl_dependence_p candl_dependence | ( | CandlProgram * | , |
CandlOptions * | |||
) |
int candl_dependence_analyze_scalars | ( | candl_program_p | program, |
CandlOptions * | options | ||
) |
candl_dependence_analyze_scalars function: This function checks, for all scalar variables of the program, and all loop levels, if the scalar can be privatized at that level.
References candl_dependence_check_domain_is_included(), candl_dependence_expand_scalar(), candl_dependence_extract_scalar_variables(), candl_dependence_refvar_chain(), candl_dependence_var_is_ref(), CANDL_get_si, CANDL_set_si, CANDL_VAR_IS_DEF, CANDL_VAR_UNDEF, candl_program::context, candlstatement::index, max, candl_program::nb_statements, candloptions::scalar_expansion, candloptions::scalar_privatization, candl_program::scalars_privatizable, candl_program::statement, candloptions::verbose, and candlstatement::written.
Referenced by candl_dependence(), candl_dependence_prune_with_privatization(), and candl_dependence_scalar_is_privatizable_at().
int candl_dependence_check | ( | CandlProgram * | , |
candl_dependence_p | , | ||
CandlOptions * | |||
) |
int candl_dependence_check_domain_is_included | ( | CandlStatement * | s1, |
CandlStatement * | s2, | ||
CandlMatrix * | context, | ||
int | level | ||
) |
candl_dependence_check_domain_is_included function: This function checks if the 'level'-first iterators of 2 domains are in such a way that s1 is larger or equal to s2, for the considered iterator dimensions.
References CANDL_assign, CANDL_clear, CANDL_decrement, candl_dependence_compute_lb(), CANDL_get_si, CANDL_init, candl_matrix_check_point(), candl_matrix_free(), candl_matrix_malloc(), CANDL_oppose, CANDL_set_si, candlstatement::depth, candlstatement::domain, and max.
Referenced by candl_dependence_analyze_scalars(), and candl_dependence_scalar_renaming().
void candl_dependence_free | ( | candl_dependence_p | ) |
References candl_matrix_free(), candldependence::domain, and candldependence::next.
Referenced by candl_dependence_scalar_renaming(), and main().
int candl_dependence_gcd_test | ( | CandlStatement * | source, |
CandlStatement * | target, | ||
CandlMatrix * | system, | ||
int | level | ||
) |
candl_dependence_gcd_test function: This functions performs a GCD test on a dependence polyhedra represented exactly by a set of constraints 'system' organized in such a way:
The function returns false if the dependence is impossible, true otherwise. A series of simple checks (SIV/ZIV/MIV/bounds checking) are also performed before the actual GCD test.
References candl_dependence_gcd(), candl_dependence_gcd_test_context(), CANDL_get_si, candlstatement::depth, and candlstatement::domain.
Referenced by candl_dependence_system().
int candl_dependence_is_loop_carried | ( | candl_program_p | program, |
CandlDependence * | dep, | ||
int | loop_index | ||
) |
candl_dependence_is_loop_carried function: This function returns true if the dependence 'dep' is loop-carried for loop 'loop_index', false otherwise.
References CANDL_assign, CANDL_get_si, candl_matrix_free(), candl_matrix_malloc(), CANDL_RAR, CANDL_RAW, CANDL_set_si, CANDL_WAR, candldependence::depth, candlstatement::depth, candldependence::domain, candlstatement::index, candlstatement::read, candldependence::ref_source, candldependence::ref_target, candldependence::source, candldependence::target, candldependence::type, and candlstatement::written.
Referenced by candl_dependence_prune_with_privatization().
candl_dependence_p candl_dependence_malloc | ( | ) |
candl_dependence_malloc function: This function allocates the memory space for a CandlDependence structure and sets its fields with default values. Then it returns a pointer to the allocated space.
References CANDL_FAIL, CANDL_UNSET, candldependence::depth, candldependence::domain, candldependence::next, candldependence::ref_source, candldependence::ref_target, candldependence::source, candldependence::target, candldependence::type, and candldependence::usr.
Referenced by candl_dep_compute_lastwriter(), candl_dependence_read_one_dep(), and candl_dependence_system().
void candl_dependence_pprint | ( | FILE * | , |
candl_dependence_p | |||
) |
References CANDL_RAR, CANDL_RAW, CANDL_RELEASE, CANDL_UNSET, CANDL_VERSION, CANDL_WAR, CANDL_WAW, candldependence::depth, candlstatement::label, candldependence::next, candldependence::ref_source, candldependence::ref_target, candldependence::source, candldependence::target, and candldependence::type.
Referenced by candl_dependence_view(), and main().
void candl_dependence_print | ( | FILE * | , |
candl_dependence_p | |||
) |
References candl_dependence_print_structure().
Referenced by main().
void candl_dependence_print_scop | ( | FILE * | input, |
FILE * | output, | ||
CandlDependence * | dependence | ||
) |
Print the scop, containing the list of dependences.
References candl_dependence_update_scop_with_deps().
Referenced by main().
void candl_dependence_print_structure | ( | FILE * | file, |
candl_dependence_p | dependence, | ||
int | level | ||
) |
candl_dependence_print_structure function: Displays a CandlDependence structure (dependence) into a file (file, possibly stdout) in a way that trends to be understandable without falling in a deep depression or, for the lucky ones, getting a headache... It includes an indentation level (level) in order to work with others print_structure functions.
References candl_matrix_print_structure(), CANDL_RAR, CANDL_RAW, candl_statement_print_structure(), CANDL_UNSET, CANDL_WAR, CANDL_WAW, candldependence::depth, candldependence::domain, candldependence::next, candldependence::source, candldependence::target, and candldependence::type.
Referenced by candl_dependence_print(), and candl_violation_print_structure().
void candl_dependence_prune_scalar_waw | ( | candl_program_p | program, |
CandlOptions * | options, | ||
CandlDependence ** | deps | ||
) |
candl_dependence_prune_scalar_waw function: This function removes all WAW dependences between the same scalar (they are useless dependences).
References candl_dependence_extract_scalar_variables(), candl_dependence_get_array_refs_in_dep(), candl_matrix_free(), CANDL_WAW, candldependence::domain, candldependence::next, candldependence::type, and candloptions::verbose.
Referenced by candl_dependence().
CandlDependence* candl_dependence_prune_transitively_covered | ( | CandlDependence * | deps | ) |
Remove somes dependences that are duplicates under transitive closure. In-place modification of the list of dependence polyhedra.
void candl_dependence_prune_with_privatization | ( | candl_program_p | program, |
CandlOptions * | options, | ||
CandlDependence ** | deps | ||
) |
candl_dependence_prune_with_privatization function: This function prunes the dependence graph 'deps' by removing loop-carried dependences involving a scalar variable privatizable for that loop.
References candl_dependence_analyze_scalars(), candl_dependence_get_array_refs_in_dep(), candl_dependence_is_loop_carried(), candl_dependence_scalar_is_privatizable_at(), candl_matrix_free(), candl_options_free(), candl_options_malloc(), candlstatement::depth, candldependence::domain, candlstatement::index, candl_program::nb_statements, candldependence::next, candloptions::scalar_privatization, candl_program::scalars_privatizable, candldependence::source, candldependence::target, and candloptions::verbose.
Referenced by candl_dependence().
CandlDependence* candl_dependence_read_from_scop | ( | scoplib_scop_p | scop, |
CandlProgram * | program | ||
) |
Retrieve a CandlDependence list from the option tag in the scop.
References candl_dependence_read_one_dep(), and candldependence::next.
CandlStatement** candl_dependence_refvar_chain | ( | candl_program_p | program, |
CandlStatement * | dom, | ||
int | var_index, | ||
int | level | ||
) |
candl_dependence_refvar_chain function: This function returns a chain of statements as a feshly allocated array of pointer on statements, of all statements reading or writing the variable 'var_index', surrounded by the 'level' common loops of 'dom'. Output is a NULL-terminated array.
References candl_dependence_var_is_ref(), CANDL_VAR_UNDEF, candlstatement::depth, candlstatement::index, candl_program::nb_statements, and candl_program::statement.
Referenced by candl_dependence_analyze_scalars(), and candl_dependence_scalar_renaming().
int candl_dependence_scalar_is_privatizable_at | ( | candl_program_p | program, |
int | var_index, | ||
int | loop_index | ||
) |
candl_dependence_is_privatizable function: This function checks if a given scalar 'var_index' is privatizable for loop 'loop_index'.
References candl_dependence_analyze_scalars(), candl_options_free(), candl_options_malloc(), candloptions::scalar_privatization, and candl_program::scalars_privatizable.
Referenced by candl_dependence_prune_with_privatization().
int candl_dependence_scalar_renaming | ( | candl_program_p | program, |
CandlOptions * | options, | ||
CandlDependence ** | deps | ||
) |
candl_dependence_scalar_renaming function: This function renames scalars in the program. In case scalars have been renamed, the dependence analysis is re-run.
References candl_dependence(), candl_dependence_check_domain_is_included(), candl_dependence_extract_scalar_variables(), candl_dependence_free(), candl_dependence_refvar_chain(), candl_dependence_var_is_ref(), CANDL_get_si, CANDL_set_si, CANDL_VAR_IS_DEF, CANDL_VAR_IS_DEF_USED, CANDL_VAR_IS_USED, candl_program::context, candlstatement::depth, candlstatement::index, candlstatement::label, candl_program::nb_statements, candlstatement::read, candloptions::scalar_privatization, candloptions::scalar_renaming, candl_program::scalars_privatizable, candl_program::statement, candloptions::verbose, and candlstatement::written.
Referenced by candl_dependence().
void candl_dependence_update_scop_with_deps | ( | scoplib_scop_p | scop, |
CandlDependence * | dependence | ||
) |
Update the scop option tag with the dependence list.
References CANDL_FAIL, and candl_program_deps_to_string().
Referenced by candl_dependence_print_scop().
int candl_dependence_var_is_ref | ( | CandlStatement * | s, |
int | var_index | ||
) |
candl_dependence_var_is_ref function: This function checks if a var 'var_index' is referenced (DEF or USE) by the statement.
References CANDL_get_si, CANDL_VAR_IS_DEF, CANDL_VAR_IS_DEF_USED, CANDL_VAR_IS_USED, CANDL_VAR_UNDEF, candlstatement::read, and candlstatement::written.
Referenced by candl_dependence_analyze_scalars(), candl_dependence_refvar_chain(), and candl_dependence_scalar_renaming().
int candl_dependence_var_is_scalar | ( | candl_program_p | program, |
int | var_index | ||
) |
candl_dependence_var_is_scalar function: This function returns true if the variable indexed by 'var_index' is a scalar in the whole program.
References CANDL_get_si, candl_program::nb_statements, candlstatement::read, candl_program::statement, and candlstatement::written.
Referenced by candl_dependence_extract_scalar_variables().
void candl_dependence_view | ( | candl_dependence_p | ) |
References candl_dependence_pprint(), and CANDL_TEMP_OUTPUT.
Referenced by main().
int candl_num_dependences | ( | CandlDependence * | candl_deps | ) |
candl_num_dependences function: This function returns the number of dependences in the dependence list
dependence | The first dependence of the dependence list. |
References candldependence::next.