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
AstSharedMemoryParallelSimpleProcessing.h
Go to the documentation of this file.
1
// Author: Gergo Barany
2
// $Id: AstSharedMemoryParallelSimpleProcessing.h,v 1.1 2008/01/08 02:56:39 dquinlan Exp $
3
4
// Class for parallelizing AstSimpleProcessing traversals; see the comment in
5
// AstSharedMemoryParallelProcessing.h for general information.
6
7
#ifndef ASTSHAREDMEMORYPARALLELSIMPLEPROCESSING_H
8
#define ASTSHAREDMEMORYPARALLELSIMPLEPROCESSING_H
9
10
#include "
AstSimpleProcessing.h
"
11
#include "
AstSharedMemoryParallelProcessing.h
"
12
13
// parallel SIMPLE processing class
14
15
// Class representing a traversal that can run in parallel with some other instances of the same type. It is basically a
16
// combined processing class with a thin synchronization layer. The user will probably never need to instantiate this
17
// class, they should use the AstSharedMemoryParallel*Processing classes instead.
18
class
AstSharedMemoryParallelizableSimpleProcessing
19
:
public
AstCombinedSimpleProcessing
,
20
private
AstSharedMemoryParallelProcessingSynchronizationBase
21
{
22
public
:
23
typedef
AstCombinedSimpleProcessing
Superclass
;
24
typedef
Superclass::TraversalType
TraversalType
;
25
typedef
Superclass::TraversalPtr
TraversalPtr
;
26
typedef
Superclass::TraversalPtrList
TraversalPtrList
;
27
28
AstSharedMemoryParallelizableSimpleProcessing
(
29
const
AstSharedMemoryParallelProcessingSynchronizationInfo
&,
30
const
TraversalPtrList
&);
31
32
void
set_runningParallelTraversal
(
bool
val);
33
34
protected
:
35
virtual
void
visit
(
SgNode
*astNode);
36
virtual
void
atTraversalEnd
();
37
38
private
:
39
size_t
visitedNodes
;
40
bool
runningParallelTraversal
;
41
size_t
synchronizationWindowSize
;
42
};
43
44
// Class for parallel execution of a number of traversals. This is a drop-in
45
// replacement for the corresponding AstCombined*Processing class, the usage
46
// is identical except that you call traverseInParallel() instead of
47
// traverse(). (Calling traverse() is identical to AstCombined*Processing,
48
// i.e. it will not run in parallel.)
49
class
ROSE_DLL_API
AstSharedMemoryParallelSimpleProcessing
50
:
public
AstCombinedSimpleProcessing
51
{
52
public
:
53
typedef
AstCombinedSimpleProcessing
Superclass
;
54
typedef
Superclass::TraversalPtr
TraversalPtr
;
55
typedef
Superclass::TraversalPtrList
TraversalPtrList
;
56
57
typedef
AstSharedMemoryParallelizableSimpleProcessing
*
ParallelizableTraversalPtr
;
58
typedef
std::vector<ParallelizableTraversalPtr>
ParallelizableTraversalPtrList
;
59
60
AstSharedMemoryParallelSimpleProcessing
(
int
threads);
61
AstSharedMemoryParallelSimpleProcessing
(
const
TraversalPtrList
&,
int
threads);
62
63
void
traverseInParallel(
SgNode
*basenode,
t_traverseOrder
treeTraverseOrder);
64
65
private
:
66
size_t
numberOfThreads
;
67
size_t
synchronizationWindowSize
;
68
};
69
70
// parallel PRE POST processing class
71
72
// Class representing a traversal that can run in parallel with some other instances of the same type. It is basically a
73
// combined processing class with a thin synchronization layer. The user will probably never need to instantiate this
74
// class, they should use the AstSharedMemoryParallel*Processing classes instead.
75
class
AstSharedMemoryParallelizablePrePostProcessing
76
:
public
AstCombinedPrePostProcessing
,
77
private
AstSharedMemoryParallelProcessingSynchronizationBase
78
{
79
public
:
80
typedef
AstCombinedPrePostProcessing
Superclass
;
81
typedef
Superclass::TraversalType
TraversalType
;
82
typedef
Superclass::TraversalPtr
TraversalPtr
;
83
typedef
Superclass::TraversalPtrList
TraversalPtrList
;
84
85
AstSharedMemoryParallelizablePrePostProcessing
(
86
const
AstSharedMemoryParallelProcessingSynchronizationInfo
&,
87
const
TraversalPtrList
&);
88
89
void
set_runningParallelTraversal
(
bool
val);
90
91
protected
:
92
virtual
void
preOrderVisit
(
SgNode
*astNode);
93
virtual
void
atTraversalEnd
();
94
95
private
:
96
size_t
visitedNodes
;
97
bool
runningParallelTraversal
;
98
size_t
synchronizationWindowSize
;
99
};
100
101
// Class for parallel execution of a number of traversals. This is a drop-in
102
// replacement for the corresponding AstCombined*Processing class, the usage
103
// is identical except that you call traverseInParallel() instead of
104
// traverse(). (Calling traverse() is identical to AstCombined*Processing,
105
// i.e. it will not run in parallel.)
106
class
AstSharedMemoryParallelPrePostProcessing
107
:
public
AstCombinedPrePostProcessing
108
{
109
public
:
110
typedef
AstCombinedPrePostProcessing
Superclass
;
111
typedef
Superclass::TraversalPtr
TraversalPtr
;
112
typedef
Superclass::TraversalPtrList
TraversalPtrList
;
113
114
typedef
AstSharedMemoryParallelizablePrePostProcessing
*
ParallelizableTraversalPtr
;
115
typedef
std::vector<ParallelizableTraversalPtr>
ParallelizableTraversalPtrList
;
116
117
AstSharedMemoryParallelPrePostProcessing
(
int
threads);
118
AstSharedMemoryParallelPrePostProcessing
(
const
TraversalPtrList
&,
int
threads);
119
120
void
traverseInParallel
(
SgNode
*basenode);
121
122
private
:
123
size_t
numberOfThreads
;
124
size_t
synchronizationWindowSize
;
125
};
126
127
#endif
rose-edg4x
src
midend
astProcessing
AstSharedMemoryParallelSimpleProcessing.h
Generated on Mon May 5 2014 17:28:51 for ROSE by
1.8.4