ROSE 0.11.145.147
reachingDef.h
1#pragma once
2
3// DQ (10/5/2014): This is more strict now that we include rose_config.h in the sage3basic.h.
4// #include "rose.h"
5// rose.h and sage3basic.h should not be included in librose header files. [Robb P. Matzke 2014-10-15]
6// #include "sage3basic.h"
7
8#include <boost/shared_ptr.hpp>
9#include <map>
10#include <set>
11
12#include "dataflowCfgFilter.h"
13
14class ROSE_DLL_API ReachingDef
15{
16public:
17
18 enum Type
19 {
22
25
28 EXPANDED_DEF
29 };
30
31 typedef boost::shared_ptr<ReachingDef> ReachingDefPtr;
32
33 typedef FilteredCFGEdge<ssa_private::DataflowCfgFilter> FilteredCfgEdge;
34
35private:
37 Type defType;
38
41 std::map<ReachingDefPtr, std::set<FilteredCfgEdge> > parentDefs;
42
45 SgNode* thisNode;
46
48 int renamingNumer;
49
50public:
51
52 //---------CONSTRUCTORS---------
53
55 ReachingDef(SgNode* defNode, Type type);
56
57 //---------ACCESSORS---------
58
60 bool isPhiFunction() const;
61
64 const std::map<ReachingDefPtr, std::set<FilteredCfgEdge> >& getJoinedDefs() const;
65
69
71 std::set<SgNode*> getActualDefinitions() const;
72
75 int getRenamingNumber() const;
76
79 bool isOriginalDef() const
80 {
81 return defType == ORIGINAL_DEF;
82 }
83
84 bool operator==(const ReachingDef& other) const;
85
86 //---------MODIFIERS---------
87
89 void setDefinitionNode(SgNode* defNode);
90
92 void addJoinedDef(ReachingDefPtr newDef, FilteredCfgEdge edge);
93
95 void setRenamingNumber(int n);
96};
bool isPhiFunction() const
Returns true if this is a phi function.
bool isOriginalDef() const
Returns true if this is an original definition (i.e.
Definition reachingDef.h:79
int getRenamingNumber() const
Get the renaming (SSA index) associated with this definition.
void setDefinitionNode(SgNode *defNode)
Set the definition node in the AST (only valid if this is not a phi function)
std::set< SgNode * > getActualDefinitions() const
Returns the actual reaching definitions at the current node, expanding all phi functions.
@ ORIGINAL_DEF
Definition for the actual variable in question, not a parent or child.
Definition reachingDef.h:24
@ PHI_FUNCTION
'Fake' definition that joins two different reaching definitions.
Definition reachingDef.h:21
SgNode * getDefinitionNode() const
If this is not a phi function, returns the actual reaching definition.
const std::map< ReachingDefPtr, std::set< FilteredCfgEdge > > & getJoinedDefs() const
If this is a join node (phi function), get the definitions merged.
ReachingDef(SgNode *defNode, Type type)
Creates a new reaching def.
void setRenamingNumber(int n)
Set the renaming number (SSA index) of this def.
void addJoinedDef(ReachingDefPtr newDef, FilteredCfgEdge edge)
Add a new join definition (only valid for phi functions).
This class represents the base class for all IR nodes within Sage III.