PandA-2024.02
pragma_manager.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
45 #ifndef PRAGMA_MANAGER_HPP
46 #define PRAGMA_MANAGER_HPP
47 
49 #include "config_HAVE_FROM_PRAGMA_BUILT.hpp"
50 
52 #include "graph.hpp"
53 
55 #include "custom_map.hpp"
56 #include "custom_set.hpp"
57 
59 #include "dbgPrintHelper.hpp"
60 #include "refcount.hpp"
61 
70 REF_FORWARD_DECL(PartitioningManager);
71 REF_FORWARD_DECL(TaskGraphManager);
72 REF_FORWARD_DECL(TaskGraphEstimator);
75 
81 {
82  protected:
86 
88 
90 
91  std::map<std::string, CustomUnorderedSet<std::string>> FunctionCallPragmas;
92 
94  std::map<std::string, std::list<std::string>> function_definition_pragmas;
95 
96  std::map<unsigned int, std::string> GenericPragmas;
97 
100 
103 
104  public:
110  {
125  };
126 
128  static const std::string omp_directive_keywords[OMP_UNKNOWN];
129 
135  pragma_manager(const application_managerRef application_manager, const ParameterConstRef param);
136 
140  virtual ~pragma_manager();
141 
146  bool checkCompliant() const;
147 
148  bool isBlackBox(const std::string& name) const;
149 
154  const std::list<std::string> GetFunctionDefinitionPragmas(const std::string& function_name) const;
155 
156  CustomUnorderedSet<std::string> getFunctionCallPragmas(const std::string& Name) const;
157 
163  void AddFunctionDefinitionPragmas(const std::string& name, const CustomUnorderedSet<std::string>& pragmas);
164 
165  void addFunctionCallPragmas(const std::string& Name, const CustomUnorderedSet<std::string>& Pragmas);
166 
167  unsigned int addBlackBoxPragma(const std::string& function_name, unsigned int function_id);
168 
169  void setGenericPragma(unsigned int number, const std::string& line);
170 
171  std::string getGenericPragma(unsigned int number) const;
172 
178  unsigned int AddOmpSimdPragma(const std::string& line, unsigned int function_id) const;
179 
187  bool CheckOmpFor(const application_managerConstRef app_man, const unsigned int function_index,
188  const vertex bb_operation_vertex) const;
189 
195  void CheckAddOmpFor(const unsigned int function_index, const vertex bb_operation_vertex,
196  const application_managerRef AppM);
197 
203  void CheckAddOmpSimd(const unsigned int function_index, const vertex bb_operation_vertex,
204  const application_managerRef AppM);
205 
210  std::string get_mapping(const std::string& function_name) const;
211 
217  static OmpPragmaType GetOmpPragmaType(const std::string& directive);
218 
224  CustomUnorderedMapUnstable<std::string, std::string> ExtractClauses(const std::string& clauses_list) const;
225 };
226 
230 
231 #endif
const application_managerRef application_manager
The application manager NOTE: this is equivalente to a weakrefcount since deleter should be null...
static const std::string omp_directive_keywords[OMP_UNKNOWN]
The list of omp directive keywords.
CustomOrderedSet< std::string > BlackBoxFunctions
File containing functions and utilities to support the printing of debug messagges.
const std::list< std::string > GetFunctionDefinitionPragmas(const std::string &function_name) const
Return the pragmas associated with a function definition.
const tree_managerRef TM
CustomUnorderedSet< std::string > getFunctionCallPragmas(const std::string &Name) const
std::map< std::string, std::list< std::string > > function_definition_pragmas
Function defintion pragmas.
std::map< unsigned int, std::string > GenericPragmas
This class manages the tree structures extracted from the raw file.
void addFunctionCallPragmas(const std::string &Name, const CustomUnorderedSet< std::string > &Pragmas)
bool checkCompliant() const
Check if the data-structure information are compliant with the pragma reference manual.
Class specification of the graph structures.
CustomUnorderedMapUnstable< std::string, std::string > ExtractClauses(const std::string &clauses_list) const
Extract clauses associated with a pragma.
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMapUnstable
Definition: custom_map.hpp:156
redefinition of map to manage ordered/unordered structures
unsigned int addBlackBoxPragma(const std::string &function_name, unsigned int function_id)
REF_FORWARD_DECL(application_manager)
void line(int x1, int y1, int x2, int y2, unsigned int color)
Definition: main.c:110
void AddFunctionDefinitionPragmas(const std::string &name, const CustomUnorderedSet< std::string > &pragmas)
Add a set of definition pragmas to a function.
virtual ~pragma_manager()
Destructor.
std::map< std::string, CustomUnorderedSet< std::string > > FunctionCallPragmas
This class is used to manage the pragma directives found in the source code.
std::string getGenericPragma(unsigned int number) const
redefinition of set to manage ordered/unordered structures
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
OmpPragmaType
The possible openmp pragmas Note that sections has to go before section but after parallel sections o...
Definition: loop.hpp:153
bool CheckOmpFor(const application_managerConstRef app_man, const unsigned int function_index, const vertex bb_operation_vertex) const
Check if a omp for pragma is associated with the loop.
std::string get_mapping(const std::string &function_name) const
Get mapping of a function given by the pragma.
Template definition of refcount.
void CheckAddOmpFor(const unsigned int function_index, const vertex bb_operation_vertex, const application_managerRef AppM)
Check if a omp for pragma is associated with the loop; if yes, add the gimple_for.
pragma_manager(const application_managerRef application_manager, const ParameterConstRef param)
Constructor.
int debug_level
The debug level.
bool isBlackBox(const std::string &name) const
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
unsigned int AddOmpSimdPragma(const std::string &line, unsigned int function_id) const
Create a simd openmp pragma starting from the line containing it.
void setGenericPragma(unsigned int number, const std::string &line)
CONSTREF_FORWARD_DECL(application_manager)
const ParameterConstRef param
Set of input parameters.
static OmpPragmaType GetOmpPragmaType(const std::string &directive)
Returns the identifier corresponding to an openmp directive.
void CheckAddOmpSimd(const unsigned int function_index, const vertex bb_operation_vertex, const application_managerRef AppM)
Check if a omp simd pragma is associated with the loop; if yes, add information to the loop...

Generated on Mon Feb 12 2024 13:02:55 for PandA-2024.02 by doxygen 1.8.13