95 switch(relationship_type)
115 return relationships;
124 "-->Asking parameter " + std::to_string(idx) +
" " +
STR(tree_node));
126 const gimple_call* ce = GetPointer<gimple_call>(tn);
127 if(idx >= ce->
args.size())
133 const auto* ae = GetPointer<const addr_expr>(
arg);
136 std::string string_arg;
137 if(ae_arg->get_kind() == var_decl_K)
139 auto vd = GetPointer<const var_decl>(ae_arg);
143 if(vd_init->get_kind() == constructor_K)
145 const auto* co = GetPointer<const constructor>(vd_init);
146 for(
const auto& idx_valu : co->list_of_idx_valu)
150 char val =
static_cast<char>(cst_val);
155 string_arg.push_back(val);
165 const auto* sc = GetPointer<const string_cst>(
166 ae_arg->get_kind() == string_cst_K ? ae_arg :
GET_NODE(GetPointer<const array_ref>(ae_arg)->op0));
167 string_arg = sc->strg;
178 const auto* gc = GetPointer<const gimple_call>(curr_tn);
180 "-->Creating openmp pragma starting from " + curr_tn->
ToString());
184 const std::string& function_name = GetPointer<identifier_node>(name)->strg;
188 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> tree_node_schema;
189 std::string include_name = GetPointer<srcp>(TM->
get_tree_node_const(tree_node))->include_name;
190 unsigned int line_number = GetPointer<srcp>(TM->
get_tree_node_const(tree_node))->line_number;
191 unsigned int column_number = GetPointer<srcp>(TM->
get_tree_node_const(tree_node))->column_number;
193 include_name +
":" + std::to_string(line_number) +
":" + std::to_string(column_number);
195 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> local_tn_schema;
199 bool is_block =
false;
200 bool is_opening =
false;
227 TM->
create_tree_node(directive_idx, omp_critical_pragma_K, tree_node_schema);
235 TM->
create_tree_node(directive_idx, omp_parallel_pragma_K, tree_node_schema);
242 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> local_tn_schema1;
245 TM->
create_tree_node(node_parallel, omp_parallel_pragma_K, local_tn_schema1);
250 TM->
create_tree_node(node_sections, omp_sections_pragma_K, local_tn_schema1);
252 tree_node_schema[
TOK(
TOK_OP0)] = std::to_string(node_parallel);
253 tree_node_schema[
TOK(
TOK_OP1)] = std::to_string(node_sections);
255 TM->
create_tree_node(directive_idx, omp_parallel_sections_pragma_K, tree_node_schema);
263 TM->
create_tree_node(directive_idx, omp_section_pragma_K, tree_node_schema);
269 TM->
create_tree_node(directive_idx, omp_sections_pragma_K, tree_node_schema);
311 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> local_tree_node_schema;
313 TM->
create_tree_node(directive_idx, omp_critical_pragma_K, local_tree_node_schema);
320 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> local_tree_node_schema;
322 TM->
create_tree_node(directive_idx, omp_parallel_pragma_K, local_tree_node_schema);
329 std::to_string(
GET_INDEX_NODE(GetPointer<omp_parallel_sections_pragma>(pn)->op0));
331 std::to_string(
GET_INDEX_NODE(GetPointer<omp_parallel_sections_pragma>(pn)->op1));
333 TM->
create_tree_node(directive_idx, omp_parallel_sections_pragma_K, local_tn_schema);
340 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> local_tree_node_schema;
342 TM->
create_tree_node(directive_idx, omp_section_pragma_K, local_tree_node_schema);
347 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> local_tree_node_schema;
349 TM->
create_tree_node(directive_idx, omp_sections_pragma_K, local_tree_node_schema);
354 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> local_tree_node_schema;
356 TM->
create_tree_node(directive_idx, omp_task_pragma_K, local_tree_node_schema);
393 TM->
create_tree_node(directive_idx, omp_declare_simd_pragma_K, tree_node_schema);
432 tree_node_schema.clear();
434 include_name +
":" + std::to_string(line_number) +
":" + std::to_string(column_number);
459 "-->Creating mapping pragma starting from tree node " + std::to_string(node_id));
461 const auto* gc = GetPointer<const gimple_call>(curr_tn);
466 const std::string& function_name = GetPointer<identifier_node>(name)->strg;
469 std::string include_name = GetPointer<srcp>(TM->
get_tree_node_const(node_id))->include_name;
470 unsigned int line_number = GetPointer<srcp>(TM->
get_tree_node_const(node_id))->line_number;
471 unsigned int column_number = GetPointer<srcp>(TM->
get_tree_node_const(node_id))->column_number;
473 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> scope_tn_schema;
479 "Error in map pragma replacing function " + function_name);
481 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> directive_tn_schema;
486 if(fourth_parameter !=
"")
491 THROW_ERROR(
"Error in pragma syntax: second parameter of mapping pragma is " + fourth_parameter);
495 TM->
create_tree_node(directive_idx, call_point_hw_pragma_K, directive_tn_schema);
497 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> tree_node_schema;
499 include_name +
":" + std::to_string(line_number) +
":" + std::to_string(column_number);
508 "<--Created mapping pragma starting from tree node " + std::to_string(node_id));
517 for(
const auto function : functions)
520 auto* fd = GetPointer<function_decl>(curr_tn);
526 auto*
sl = GetPointer<statement_list>(
GET_NODE(fd->body));
527 std::map<unsigned int, blocRef>& blocks =
sl->list_of_bloc;
528 std::map<unsigned int, blocRef>::iterator it, it_end;
529 it_end = blocks.end();
530 for(it = blocks.begin(); it != it_end; ++it)
533 const auto list_of_stmt = it->second->CGetStmtList();
534 auto it2 = list_of_stmt.begin();
535 while(it2 != list_of_stmt.end())
538 "-->Examining statement " + std::to_string(
GET_INDEX_NODE(*it2)));
543 if(tn and tn->
get_kind() == addr_expr_K)
549 const std::string& function_name = GetPointer<identifier_node>(name)->strg;
558 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> tree_node_schema;
559 std::string include_name = GetPointer<srcp>(TN)->include_name;
560 unsigned int line_number = GetPointer<srcp>(TN)->line_number;
561 unsigned int column_number = GetPointer<srcp>(TN)->column_number;
563 include_name +
":" + std::to_string(line_number) +
":" + std::to_string(column_number);
582 std::string num = function_name;
583 num = num.substr(10, num.size());
584 num = num.substr(0, num.find(
'_'));
585 std::string string_base = PM->getGenericPragma(static_cast<unsigned>(std::stoul(num)));
586 string_base = string_base.substr(string_base.find(
"#pragma") + 8, string_base.size());
588 el->line = string_base;
590 for(next = it2; next != list_of_stmt.end(); next++)
592 auto* en = GetPointer<gimple_node>(
GET_NODE(*next));
595 en->pragmas.push_back(*it2);
597 if(it2 == list_of_stmt.begin())
599 it->second->RemoveStmt(*it2,
AppM);
600 it2 = list_of_stmt.begin();
607 it->second->RemoveStmt(*it2,
AppM);
615 if(next == list_of_stmt.end())
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
static const std::string omp_directive_keywords[OMP_UNKNOWN]
The list of omp directive keywords.
File containing functions and utilities to support the printing of debug messagges.
std::string ToString() const
Print this node as string in gimple format.
#define STR_CST_pragma_function_generic
The function replacin a generic pragma.
const CustomUnorderedSet< unsigned int > GetAllFunctions() const
Returns all the functions in the tree_manager.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
#define STR_CST_pragma_prefix
The prefix common to all functions replacing pragma.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
void create_omp_pragma(const unsigned int tree_node) const
Create an omp pragma.
#define STR_CST_pragma_function_end
The function replacing an ending pragma.
exceptions managed by PandA
A simple interface to token object of the raw files.
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
std::list< tree_nodeRef > OpenParallelSections
void create_map_pragma(const unsigned int node_id) const
Create a map pragma.
std::vector< tree_nodeRef > args
The arguments of the gimple_call.
Data structure describing a basic block at tree level.
redefinition of map to manage ordered/unordered structures
constant strings used in pragma identification
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.
Abstract pure class for the tree structure.
virtual enum kind get_kind() const =0
Virtual function returning the type of the actual class.
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
const tree_nodeRef get_tree_node_const(unsigned int i) const
Return the reference to the i-th tree_node Constant version of get_tree_node.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
virtual std::string get_kind_text() const =0
Virtual function returning the name of the actual class.
bool starts_with(const std::string &str, const std::string &pattern)
const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
#define STR_CST_pragma_function_single_line_two_arguments
The function replacing a single line pragma with two argument.
#define STR_CST_pragma_function_single_line_one_argument
The function replacing a single line pragma with single argument.
unsigned int new_tree_node_id(const unsigned int ask=0)
Return a new node id in the intermediate representation.
Manager for pragma annotations.
void create_tree_node(const unsigned int node_id, enum kind tree_node_type, std::map< TreeVocabularyTokenTypes_TokenEnum, std::string > &tree_node_schema)
Factory method.
Target must be reexecuted.
std::string get_call_parameter(const unsigned int tree_node, const unsigned int idx) const
Given the index of a function replacing a pragma, returns a parameter.
Classes specification of the tree_node data structures.
OmpPragmaType
The possible openmp pragmas Note that sections has to go before section but after parallel sections o...
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
DesignFlowStep_Status Exec() override
Performes the analysis of the pragmas.
#define STR_CST_pragma_keyword_map
The keyword 'map' which identifies mapping pragmas.
This file collects some utility functions.
~PragmaAnalysis() override
Destructor.
Parsing pragma from C sources.
#define STR_CST_pragma_keyword_omp
The keyword 'omp' which identifies openmp pragmas.
#define STR_CST_pragma_keyword_recursive
The keyword 'omp' which identifies openmp recursive.
const application_managerRef AppM
The application manager.
Class specification of the tree_reindex support class.
PragmaAnalysis(const application_managerRef AppM, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
Analysis step that recognizes the pragma calls in the specification.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Classes specification of the tree_node data structures not present in the gcc.
this class is used to manage the command-line or XML options.
static integer_cst_t GetConstValue(const tree_nodeConstRef &tn, bool is_signed=true)
Get value from integer constant.
int debug_level
The debug level.
#define GET_INDEX_CONST_NODE(t)
static OmpPragmaType GetOmpPragmaType(const std::string &directive)
Returns the identifier corresponding to an openmp directive.
#define STR_CST_pragma_function_start
The function replacing an opening pragma.
This struct specifies the gimple_call node.
Class specification of the manager of the tree structures extracted from the raw file.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...