PandA-2024.02
|
Main class for parsing: contains the context associated with a parsing action and the methods to retrieve all the information. More...
#include <PragmaParser.hpp>
Public Member Functions | |
PragmaParser (const pragma_managerRef PM, const ParameterConstRef Param) | |
Constructor. More... | |
~PragmaParser () | |
Destructor. More... | |
std::string | substitutePragmas (const std::string &OldFile) |
Substitute the pragmas with proper functions. More... | |
Private Member Functions | |
bool | analyze_pragma (std::string &Line) |
Retrieve information about a pragma directive when the token "#pragma" has been found. More... | |
bool | recognize_omp_pragma (std::string &Line) |
Retrieve information about a pragma directive when a OpenMP (parallelism) pragma has been found. More... | |
bool | recognize_mapping_pragma (std::string &Line) |
Retrieve information about a pragma directive when a mapping pragma has been found. More... | |
bool | recognize_call_point_hw_pragma (std::string &line) const |
Retrieve information about a pragma directive of type pragma map call_point_hw. More... | |
bool | recognize_issue_pragma (std::string &Line) |
Retrieve information about a pragma directive when an issue pragma has been found. More... | |
bool | recognize_profiling_pragma (std::string &Line) |
Retrieve information about a pragma directive when a profiling pragma has been found. More... | |
bool | recognize_generic_pragma (std::string &Line) |
Retrieve information about a generic pragma directive (i.e., none of the known ones has been detected) More... | |
Private Attributes | |
const pragma_managerRef | PM |
pointer to the pragma manager data-structure More... | |
const int | debug_level |
current debugging level More... | |
const ParameterConstRef | Param |
reference to the parameter data-structure More... | |
unsigned int | level |
counter for nesting level More... | |
std::list< std::string > | FloatingPragmas |
CustomUnorderedSet< std::string > | FunctionPragmas |
std::map< unsigned int, std::list< std::string > > | OpenPragmas |
bool | search_function |
std::string | name_function |
Static Private Attributes | |
static unsigned int | number = 0 |
counter of generic pragma More... | |
Main class for parsing: contains the context associated with a parsing action and the methods to retrieve all the information.
Definition at line 68 of file PragmaParser.hpp.
PragmaParser::PragmaParser | ( | const pragma_managerRef | PM, |
const ParameterConstRef | Param | ||
) |
Constructor.
PM | is the pragma manager |
Param | is the set of input parameters |
Definition at line 61 of file PragmaParser.cpp.
References PM, THROW_ASSERT, and ~PragmaParser().
|
default |
|
private |
Retrieve information about a pragma directive when the token "#pragma" has been found.
parallelism pragmas
mapping pragmas
call_point_hw pragmas
issue pragmas
profiling pragmas
generate_hw pragmas
generic pragmas
Definition at line 192 of file PragmaParser.cpp.
References Param, recognize_call_point_hw_pragma(), recognize_generic_pragma(), recognize_issue_pragma(), recognize_mapping_pragma(), recognize_omp_pragma(), recognize_profiling_pragma(), and STR_CST_pragma_keyword_omp.
Referenced by substitutePragmas().
|
private |
Retrieve information about a pragma directive of type pragma map call_point_hw.
line | is the line containing the pragma; it will be replaced con a function call |
Definition at line 319 of file PragmaParser.cpp.
References line(), SplitString(), STR_CST_pragma_function_single_line_two_arguments, STR_CST_pragma_keyword_call_point_hw, STR_CST_pragma_keyword_map, and THROW_ASSERT.
Referenced by analyze_pragma().
|
private |
Retrieve information about a generic pragma directive (i.e., none of the known ones has been detected)
Definition at line 370 of file PragmaParser.cpp.
References FunctionPragmas, level, number, PM, and search_function.
Referenced by analyze_pragma().
|
private |
Retrieve information about a pragma directive when an issue pragma has been found.
Definition at line 356 of file PragmaParser.cpp.
References FunctionPragmas, and search_function.
Referenced by analyze_pragma().
|
private |
Retrieve information about a pragma directive when a mapping pragma has been found.
Definition at line 339 of file PragmaParser.cpp.
References FunctionPragmas, level, number, PM, and search_function.
Referenced by analyze_pragma().
|
private |
Retrieve information about a pragma directive when a OpenMP (parallelism) pragma has been found.
Definition at line 249 of file PragmaParser.cpp.
References debug_level, DEBUG_LEVEL_VERY_PEDANTIC, FloatingPragmas, FunctionPragmas, pragma_manager::GetOmpPragmaType(), INDENT_DBG_MEX, line(), pragma_manager::OMP_ATOMIC, pragma_manager::OMP_BARRIER, pragma_manager::OMP_CRITICAL, pragma_manager::OMP_DECLARE_SIMD, pragma_manager::omp_directive_keywords, pragma_manager::OMP_FOR, pragma_manager::OMP_PARALLEL, pragma_manager::OMP_PARALLEL_FOR, pragma_manager::OMP_PARALLEL_SECTIONS, pragma_manager::OMP_SECTION, pragma_manager::OMP_SECTIONS, pragma_manager::OMP_SIMD, pragma_manager::OMP_TARGET, pragma_manager::OMP_TASK, pragma_manager::OMP_UNKNOWN, search_function, STR_CST_pragma_function_single_line_one_argument, STR_CST_pragma_function_start, STR_CST_pragma_keyword_omp, THROW_ERROR, and THROW_UNREACHABLE.
Referenced by analyze_pragma().
|
private |
Retrieve information about a pragma directive when a profiling pragma has been found.
Definition at line 363 of file PragmaParser.cpp.
References FunctionPragmas, and search_function.
Referenced by analyze_pragma().
std::string PragmaParser::substitutePragmas | ( | const std::string & | OldFile | ) |
Substitute the pragmas with proper functions.
OldFile | is the name of the file to be analyzed and substituted |
search for function name
Pragma associated with called are added by pragma_analysis
print out the new pragma line
manage nesting levels
increment line number
Definition at line 74 of file PragmaParser.cpp.
References analyze_pragma(), debug_level, DEBUG_LEVEL_VERY_PEDANTIC, FloatingPragmas, FunctionPragmas, INDENT_DBG_MEX, level, name_function, OpenPragmas, Param, PM, search_function, STR_CST_pragma_function_end, and THROW_ASSERT.
|
private |
current debugging level
Definition at line 78 of file PragmaParser.hpp.
Referenced by recognize_omp_pragma(), and substitutePragmas().
|
private |
Definition at line 122 of file PragmaParser.hpp.
Referenced by recognize_omp_pragma(), and substitutePragmas().
|
private |
Definition at line 124 of file PragmaParser.hpp.
Referenced by recognize_generic_pragma(), recognize_issue_pragma(), recognize_mapping_pragma(), recognize_omp_pragma(), recognize_profiling_pragma(), and substitutePragmas().
|
private |
counter for nesting level
Definition at line 120 of file PragmaParser.hpp.
Referenced by recognize_generic_pragma(), recognize_mapping_pragma(), and substitutePragmas().
|
private |
Definition at line 130 of file PragmaParser.hpp.
Referenced by substitutePragmas().
|
staticprivate |
counter of generic pragma
Definition at line 72 of file PragmaParser.hpp.
Referenced by recognize_generic_pragma(), and recognize_mapping_pragma().
|
private |
Definition at line 126 of file PragmaParser.hpp.
Referenced by substitutePragmas().
|
private |
reference to the parameter data-structure
Definition at line 81 of file PragmaParser.hpp.
Referenced by analyze_pragma(), and substitutePragmas().
|
private |
pointer to the pragma manager data-structure
Definition at line 75 of file PragmaParser.hpp.
Referenced by PragmaParser(), recognize_generic_pragma(), recognize_mapping_pragma(), and substitutePragmas().
|
private |
Definition at line 128 of file PragmaParser.hpp.
Referenced by recognize_generic_pragma(), recognize_issue_pragma(), recognize_mapping_pragma(), recognize_omp_pragma(), recognize_profiling_pragma(), and substitutePragmas().