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
defsAndUsesTraversal.h
Go to the documentation of this file.
1
#pragma once
2
#include "rose.h"
3
#include "
staticSingleAssignment.h
"
4
5
namespace
ssa_private
6
{
7
9
class
ChildUses
10
{
11
private
:
13
SgVarRefExp
*
currentVar
;
14
16
std::vector<SgNode*>
uses
;
17
18
public
:
19
21
ChildUses
() :
currentVar
(NULL)
22
{
23
}
24
25
ChildUses
(
SgNode
* useNode,
SgVarRefExp
* var)
26
{
27
uses
.push_back(useNode);
28
currentVar
= var;
29
}
30
35
ChildUses
(
const
std::vector<SgNode*>& useTree,
SgVarRefExp
* var = NULL)
36
{
37
if
(useTree.size() > 0)
38
uses
.assign(useTree.begin(), useTree.end());
39
currentVar
= var;
40
}
41
46
std::vector<SgNode*>&
getUses
()
47
{
48
return
uses
;
49
}
50
55
void
setUses
(
const
std::vector<SgNode*>& newUses)
56
{
57
uses
.assign(newUses.begin(), newUses.end());
58
}
59
60
SgVarRefExp
*
getCurrentVar
()
const
61
{
62
return
currentVar
;
63
}
64
};
65
69
class
DefsAndUsesTraversal
:
public
AstBottomUpProcessing
<ChildUses>
70
{
71
StaticSingleAssignment
*
ssa
;
72
75
const
bool
treatPointersAsStructs
;
76
77
public
:
78
81
DefsAndUsesTraversal
(
StaticSingleAssignment
*
ssa
,
bool
treatPointersAsStructs
=
true
) : ssa(ssa),
82
treatPointersAsStructs
(
treatPointersAsStructs
)
83
{
84
}
85
94
virtual
ChildUses
evaluateSynthesizedAttribute
(
SgNode
* node,
SynthesizedAttributesList
attrs);
95
96
private
:
97
99
void
addUsesToNode
(
SgNode
* node, std::vector<SgNode*> uses);
100
102
void
addDefForVarAtNode
(
SgVarRefExp
* currentVar,
SgNode
* defNode);
103
};
104
105
}
//namespace ssa_private
106
rose-edg4x
src
midend
programAnalysis
staticSingleAssignment
defsAndUsesTraversal.h
Generated on Mon May 5 2014 17:29:21 for ROSE by
1.8.4