ROSE
0.9.6a
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
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
23
int
patchUpSharedVariables
(
SgFile
* );
24
// TODO: patchUpDefaultVariables(SgFile* );
25
26
int
makeDataSharingExplicit
(
SgFile
* );
27
28
// last edited by Hongyi on 07/24/2012.
29
31
// We support both Omni and GCC OpenMP runtime libraries
32
enum
omp_rtl_enum
33
{
34
e_gomp
,
35
e_omni
,
36
e_last_rtl
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
50
void
insertRTLHeaders
(
SgSourceFile
*);
51
53
void
insertRTLinitAndCleanCode
(
SgSourceFile
* );
54
57
class
translationDriver
:
public
AstSimpleProcessing
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
122
ROSE_DLL_API
SgInitializedNamePtrList
collectAllClauseVariables
(
SgOmpClauseBodyStatement
* clause_stmt);
123
125
ROSE_DLL_API
SgInitializedNamePtrList
collectClauseVariables
(
SgOmpClauseBodyStatement
* clause_stmt,
const
VariantT
& vt);
126
128
ROSE_DLL_API
SgInitializedNamePtrList
collectClauseVariables
(
SgOmpClauseBodyStatement
* clause_stmt,
const
VariantVector& vvt);
129
131
ROSE_DLL_API
bool
isInClauseVariableList
(
SgInitializedName
* var,
SgOmpClauseBodyStatement
* clause_stmt,
const
VariantT
& vt);
132
134
ROSE_DLL_API
bool
isInClauseVariableList
(
SgInitializedName
* var,
SgOmpClauseBodyStatement
* clause_stmt,
const
VariantVector& vvt);
135
137
ROSE_DLL_API
int
replaceVariableReferences
(
SgNode
* root,
SgVariableSymbol
* oldVar,
SgVariableSymbol
* newVar);
138
140
ROSE_DLL_API
int
replaceVariableReferences
(
SgNode
* root,
VariableSymbolMap_t
varRemap);
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
148
ROSE_DLL_API
void
addClauseVariable
(
SgInitializedName
* var,
SgOmpClauseBodyStatement
* clause_stmt,
const
VariantT
& vt);
149
151
ROSE_DLL_API
SgOmpVariablesClause
*
buildOmpVariableClause
(
SgOmpClauseBodyStatement
* clause_stmt,
const
VariantT
& vt);
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
160
ROSE_DLL_API
bool
useStaticSchedule
(
SgOmpClauseBodyStatement
* omp_loop);
161
163
ROSE_DLL_API
SgOmpClause::omp_reduction_operator_enum
getReductionOperationType
(
SgInitializedName
* init_name,
SgOmpClauseBodyStatement
* clause_stmt);
164
166
ROSE_DLL_API
SgExpression
*
createInitialValueExp
(
SgOmpClause::omp_reduction_operator_enum
r_operator);
167
169
ROSE_DLL_API
std::string
generateGOMPLoopStartFuncName
(
bool
isOrdered,
SgOmpClause::omp_schedule_kind_enum
s_kind);
170
172
ROSE_DLL_API
std::string
generateGOMPLoopNextFuncName
(
bool
isOrdered,
SgOmpClause::omp_schedule_kind_enum
s_kind);
173
175
ROSE_DLL_API
std::string
toString
(
SgOmpClause::omp_schedule_kind_enum
s_kind);
176
178
ROSE_DLL_API
int
patchUpPrivateVariables
(
SgFile
*);
179
181
ROSE_DLL_API
int
patchUpFirstprivateVariables
(
SgFile
*);
182
184
std::set<SgInitializedName*>
collectThreadprivateVariables
();
185
187
SgVariableDeclaration
*
buildAndInsertDeclarationForOmp
(
const
std::string &
name
,
SgType
*type,
SgInitializer
*varInit,
SgBasicBlock
*orig_scope);
189
SgBasicBlock
*
getEnclosingRegionOrFuncDefinition
(
SgNode
*);
190
}
// end namespace OmpSupport
191
192
#endif //OMP_LOWERING_H
rose-edg4x
src
midend
programTransformation
ompLowering
omp_lowering.h
Generated on Mon May 5 2014 17:29:24 for ROSE by
1.8.4