ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
omp_lowering.h
Go to the documentation of this file.
1 #include "astQuery.h"
2 //#include "sage3basic.h"
3 
11 #ifndef OMP_LOWERING_H
12 #define OMP_LOWERING_H
13 namespace OmpSupport
14 {
15 
16  // OpenMP version info.
17  extern bool enable_accelerator;
18 
21 
22 
24  // TODO: patchUpDefaultVariables(SgFile* );
25 
27 
28  // last edited by Hongyi on 07/24/2012.
29 
31  // We support both Omni and GCC OpenMP runtime libraries
33  {
37  };
38  extern unsigned int nCounter; // translation generated variable counter, used to avoid name collision
39 
40  extern omp_rtl_enum rtl_type;
41  typedef std::map<const SgVariableSymbol *, SgVariableSymbol *> VariableSymbolMap_t;
42 
43  void commandLineProcessing(std::vector<std::string> &argvList);
44 
46  void lower_omp(SgSourceFile*);
47 
48 
51 
54 
58  {
59  protected:
60  void visit(SgNode*);
61  }; //translationDriver
62 
64  void transOmpParallel(SgNode* node);
65 
67  void transOmpTargetParallel(SgNode* node);
68 
70  void transOmpSections(SgNode* node);
71 
73  void transOmpTask(SgNode* node);
74 
76  void transOmpLoop(SgNode* node);
77 
79  void transOmpTargetLoop(SgNode* node);
80 
82  //void transOmpDo(SgNode* node);
83 
85  void transOmpTarget(SgNode* node);
86 
88  void transOmpTargetData(SgNode* node);
89 
90 
92  void transOmpBarrier(SgNode* node);
93 
95  void transOmpFlush(SgNode* node);
96 
98  void transOmpTaskwait(SgNode* node);
99 
101  void transOmpThreadprivate(SgNode* node);
102 
104  void transOmpOrdered(SgNode* node);
106  void transOmpAtomic(SgNode* node);
108  void transOmpCritical(SgNode* node);
110  void transOmpMaster(SgNode* node);
112  void transOmpSingle(SgNode* node);
113 
115  // It calls the ROSE AST outliner internally.
116  SgFunctionDeclaration* generateOutlinedTask(SgNode* node, std::string& wrapper_name, std::set<SgVariableSymbol*>& syms);
117 
119  ROSE_DLL_API void transOmpVariables(SgStatement * ompStmt, SgBasicBlock* bb1, SgExpression* orig_loop_upper = NULL, bool withinAcceleratorModel= false);
120 
123 
126 
129 
132 
134  ROSE_DLL_API bool isInClauseVariableList(SgInitializedName* var, SgOmpClauseBodyStatement * clause_stmt, const VariantVector& vvt);
135 
138 
141  // I decided to reuse the existing Outliner work instead of coding a new one
142  //SgFunctionDeclaration* generateOutlinedFunction(SgNode* node);
143 
145  int replaceVariablesWithPointerDereference(SgNode* root, std::set<SgVariableSymbol*>& vars);
146 
149 
152 
154  ROSE_DLL_API bool hasClause(SgOmpClauseBodyStatement* clause_stmt, const VariantT & vt);
155 
157  ROSE_DLL_API Rose_STL_Container<SgOmpClause*> getClause(SgOmpClauseBodyStatement* clause_stmt, const VariantT & vt);
158 
161 
164 
167 
170 
173 
176 
179 
182 
184  std::set<SgInitializedName*> collectThreadprivateVariables();
185 
187  SgVariableDeclaration * buildAndInsertDeclarationForOmp(const std::string &name, SgType *type, SgInitializer *varInit, SgBasicBlock *orig_scope);
190 } // end namespace OmpSupport
191 
192 #endif //OMP_LOWERING_H