PandA-2024.02
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
PragmaParser Class Reference

Main class for parsing: contains the context associated with a parsing action and the methods to retrieve all the information. More...

#include <PragmaParser.hpp>

Collaboration diagram for PragmaParser:
Collaboration graph
[legend]

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PragmaParser()

PragmaParser::PragmaParser ( const pragma_managerRef  PM,
const ParameterConstRef  Param 
)

Constructor.

Parameters
PMis the pragma manager
Paramis the set of input parameters

Definition at line 61 of file PragmaParser.cpp.

References PM, THROW_ASSERT, and ~PragmaParser().

Here is the call graph for this function:

◆ ~PragmaParser()

PragmaParser::~PragmaParser ( )
default

Destructor.

Referenced by PragmaParser().

Here is the caller graph for this function:

Member Function Documentation

◆ analyze_pragma()

bool PragmaParser::analyze_pragma ( std::string &  Line)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recognize_call_point_hw_pragma()

bool PragmaParser::recognize_call_point_hw_pragma ( std::string &  line) const
private

Retrieve information about a pragma directive of type pragma map call_point_hw.

Parameters
lineis 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recognize_generic_pragma()

bool PragmaParser::recognize_generic_pragma ( std::string &  Line)
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().

Here is the caller graph for this function:

◆ recognize_issue_pragma()

bool PragmaParser::recognize_issue_pragma ( std::string &  Line)
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().

Here is the caller graph for this function:

◆ recognize_mapping_pragma()

bool PragmaParser::recognize_mapping_pragma ( std::string &  Line)
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().

Here is the caller graph for this function:

◆ recognize_omp_pragma()

bool PragmaParser::recognize_omp_pragma ( std::string &  Line)
private

◆ recognize_profiling_pragma()

bool PragmaParser::recognize_profiling_pragma ( std::string &  Line)
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().

Here is the caller graph for this function:

◆ substitutePragmas()

std::string PragmaParser::substitutePragmas ( const std::string &  OldFile)

Substitute the pragmas with proper functions.

Parameters
OldFileis the name of the file to be analyzed and substituted
Returns
the name of the new file coming from the substitution

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.

Here is the call graph for this function:

Field Documentation

◆ debug_level

const int PragmaParser::debug_level
private

current debugging level

Definition at line 78 of file PragmaParser.hpp.

Referenced by recognize_omp_pragma(), and substitutePragmas().

◆ FloatingPragmas

std::list<std::string> PragmaParser::FloatingPragmas
private

Definition at line 122 of file PragmaParser.hpp.

Referenced by recognize_omp_pragma(), and substitutePragmas().

◆ FunctionPragmas

CustomUnorderedSet<std::string> PragmaParser::FunctionPragmas
private

◆ level

unsigned int PragmaParser::level
private

counter for nesting level

Definition at line 120 of file PragmaParser.hpp.

Referenced by recognize_generic_pragma(), recognize_mapping_pragma(), and substitutePragmas().

◆ name_function

std::string PragmaParser::name_function
private

Definition at line 130 of file PragmaParser.hpp.

Referenced by substitutePragmas().

◆ number

unsigned int PragmaParser::number = 0
staticprivate

counter of generic pragma

Definition at line 72 of file PragmaParser.hpp.

Referenced by recognize_generic_pragma(), and recognize_mapping_pragma().

◆ OpenPragmas

std::map<unsigned int, std::list<std::string> > PragmaParser::OpenPragmas
private

Definition at line 126 of file PragmaParser.hpp.

Referenced by substitutePragmas().

◆ Param

const ParameterConstRef PragmaParser::Param
private

reference to the parameter data-structure

Definition at line 81 of file PragmaParser.hpp.

Referenced by analyze_pragma(), and substitutePragmas().

◆ PM

const pragma_managerRef PragmaParser::PM
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().

◆ search_function

bool PragmaParser::search_function
private

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

Generated on Mon Feb 12 2024 13:04:01 for PandA-2024.02 by doxygen 1.8.13