Clan
0.8.0
|
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <osl/vector.h>
#include <osl/relation.h>
#include <osl/relation_list.h>
#include <osl/statement.h>
#include <osl/strings.h>
#include <osl/extensions/scatnames.h>
#include <osl/extensions/arrays.h>
#include <osl/extensions/coordinates.h>
#include <osl/extensions/clay.h>
#include <osl/extensions/extbody.h>
#include <osl/generic.h>
#include <osl/body.h>
#include <osl/scop.h>
#include <parser.h>
#include <clan/macros.h>
#include <clan/options.h>
#include <clan/relation.h>
#include <clan/statement.h>
#include <clan/scop.h>
Go to the source code of this file.
Functions | |
osl_scop_p | clan_parse (FILE *, clan_options_p) |
osl_scop_p | clan_scop_extract (FILE *input, clan_options_p options) |
void | clan_scop_compact (osl_scop_p scop) |
void | clan_scop_print (FILE *file, osl_scop_p scop, clan_options_p options) |
void | clan_scop_generate_scatnames (osl_scop_p scop) |
void | clan_scop_generate_coordinates (osl_scop_p scop, char *name) |
void | clan_scop_generate_clay (osl_scop_p scop, char *script) |
void | clan_scop_update_coordinates (osl_scop_p scop, int coordinates[5][CLAN_MAX_SCOPS]) |
void | clan_scop_print_autopragma (FILE *input, int nb_scops, int coordinates[5][CLAN_MAX_SCOPS]) |
static int | clan_scop_no_pragma (char *filename, int line_start) |
void | clan_scop_insert_pragmas (osl_scop_p scop, char *filename, int test) |
void | clan_scop_simplify (osl_scop_p scop) |
Variables | |
int | scanner_scop_start |
int | scanner_scop_end |
int | parser_indent |
osl_scop_p clan_parse | ( | FILE * | , |
clan_options_p | |||
) |
clan_parse function: this function parses a file to extract a SCoP and returns, if successful, a pointer to the osl_scop_t structure.
input | The file to parse (already open). |
options | Options for file parsing. |
Definition at line 4810 of file parser.c.
References clan_options::autoscop, CLAN_debug, clan_parser_autoscop(), clan_parser_state_free(), clan_parser_state_initialize(), clan_parser_state_malloc(), clan_scanner_free(), clan_scanner_initialize(), parser_error, parser_scop, clan_options::precision, yyin, yyparse(), and yyrestart().
Referenced by clan_scop_extract().
void clan_scop_compact | ( | osl_scop_p | scop | ) |
clan_scop_compact function: This function scans the SCoP to put the right number of columns to every relation (during construction we used CLAN_MAX_DEPTH and CLAN_MAX_PARAMETERS to define relation and vector sizes).
scop | The scop to scan to compact matrices. |
Definition at line 96 of file scop.c.
References clan_statement_compact().
Referenced by yyparse().
osl_scop_p clan_scop_extract | ( | FILE * | input, |
clan_options_p | options | ||
) | [read] |
clan_scop_extract function: this function is a wrapper to the clan_parse function that parses a file to extract a SCoP and returns, if successful, a pointer to the osl_scop_t structure.
input | The file to parse (already open). |
options | Options for file parsing. |
Definition at line 84 of file scop.c.
References clan_parse().
Referenced by main().
void clan_scop_generate_clay | ( | osl_scop_p | scop, |
char * | script | ||
) |
clan_scop_generate_clay function: this function generates a clay extension for the scop passed as an argument.
[in,out] | scop | The scop to add a clay extension to. |
[in] | script | The clay script. |
Definition at line 250 of file scop.c.
References CLAN_strdup.
Referenced by yyparse().
void clan_scop_generate_coordinates | ( | osl_scop_p | scop, |
char * | name | ||
) |
clan_scop_generate_coordinates function: this function generates a coordinates extension for the scop passed as an argument.
[in] | name | The name of the SCoP original file. |
[in,out] | scop | The scop to add a scatnames extension to. |
Definition at line 222 of file scop.c.
References CLAN_strdup, CLAN_UNDEFINED, parser_indent, scanner_scop_end, and scanner_scop_start.
Referenced by yyparse().
void clan_scop_generate_scatnames | ( | osl_scop_p | scop | ) |
clan_scop_generate_scatnames function: this function generates a scatnames extension for the scop passed as an argument. Since Clan use a "2d+1" scattering strategy, the scattering dimension names are generated by reusing the original iterator names of the deepest statement and by inserting between those names some beta vector elements (the Xth beta element is called bX).
[in,out] | scop | The scop to add a scatnames extension to. |
Definition at line 161 of file scop.c.
References CLAN_malloc, CLAN_MAX_STRING, and CLAN_strdup.
Referenced by yyparse().
void clan_scop_insert_pragmas | ( | osl_scop_p | scop, |
char * | filename, | ||
int | test | ||
) |
clan_scop_insert_pragmas function: inserts "#pragma scop" and "#pragma endscop" in a source file around the SCoPs related in the input SCoP list that have no surrounding pragmas in the file.
[in] | scop | The list of SCoPS. |
[in] | filename | Name of the file where to insert pragmas. |
[in] | test | 0 to insert, 1 to leave the result in the CLAN_AUTOPRAGMA_FILE temporary file. |
Definition at line 431 of file scop.c.
References CLAN_AUTOPRAGMA_FILE, CLAN_error, CLAN_MAX_SCOPS, clan_scop_no_pragma(), and clan_scop_print_autopragma().
Referenced by main().
static int clan_scop_no_pragma | ( | char * | filename, |
int | line_start | ||
) | [static] |
clan_scop_no_pragma function: this function returns CLAN_FALSE if there is a "#pragma scop" at the beginning of the line number "line_start" of the file "filename", CLAN_TRUE otherwise.
[in] | filename | Name of the file to be checked. |
[in] | line_start | Line number to check. |
Definition at line 376 of file scop.c.
References CLAN_debug, CLAN_error, CLAN_FALSE, CLAN_MAX_STRING, and CLAN_TRUE.
Referenced by clan_scop_insert_pragmas().
void clan_scop_print | ( | FILE * | file, |
osl_scop_p | scop, | ||
clan_options_p | options | ||
) |
clan_scop_print function: this function prints the content of an osl_scop_t structure (*scop) into a file (file, possibly stdout) in the OpenScop textual format.
[in] | file | The file where the information has to be printed. |
[in] | scop | The scop structure whose information has to be printed. |
[in] | options | Clan's general option settings. |
Definition at line 109 of file scop.c.
References clan_options::castle, CLAN_VERSION, and clan_options::outscoplib.
Referenced by main().
void clan_scop_print_autopragma | ( | FILE * | input, |
int | nb_scops, | ||
int | coordinates[5][CLAN_MAX_SCOPS] | ||
) |
clan_scop_print_autopragma function: this function prints a copy of the input file 'input' to a file named by the CLAN_AUTOPRAGMA_FILE macro, where the SCoP pragmas for 'nb_scops' SCoPs are inserted according to the coordinates array. The rows of the coordinates array have the following meaning: 0: line start, 1: line end, 2: column start, 3: column end, 4: boolean set to 1 for an auto-discovered scop, 0 for user-scop.
[in] | input | The input stream (must be open). |
[in] | nb_scops | The number of scops. |
[in] | coordinates | The array of coordinates for each SCoPs. |
Definition at line 317 of file scop.c.
References CLAN_AUTOPRAGMA_FILE, CLAN_DEBUG, CLAN_debug, and CLAN_error.
Referenced by clan_parser_autoscop(), and clan_scop_insert_pragmas().
void clan_scop_simplify | ( | osl_scop_p | scop | ) |
clan_scop_simplify function: this function tries to simplify the iteration domains of the SCoP. /param[in,out] scop SCoP to simplify (updated).
Definition at line 500 of file scop.c.
References clan_relation_simplify().
Referenced by yyparse().
void clan_scop_update_coordinates | ( | osl_scop_p | scop, |
int | coordinates[5][CLAN_MAX_SCOPS] | ||
) |
clan_scop_update_coordinates function: this function replaces the values in the coordinates extension of each SCoP of the list 'scop' by those in the 'coordinates' array. The rows of the coordinates array have the following meaning: 0: line start, 1: line end, 2: column start, 3: column end, 4: boolean set to 1 for an auto-discovered scop, 0 for user-scop. The ith column of the coordinates array describes the coordinates of the ith SCoP.
[in,out] | scop | SCoP list to update the coordinates. |
[in] | coordinates | Array of coordinates. |
Definition at line 280 of file scop.c.
References CLAN_error.
Referenced by clan_parser_autoscop().
int parser_indent |
SCoP indentation
Definition at line 135 of file parser.c.
Referenced by clan_parser_state_initialize(), clan_scop_generate_coordinates(), and yyparse().
int scanner_scop_end |