ROSE 0.11.145.147
reachingDefUnfilteredCfg.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
12namespace ssa_unfiltered_cfg
13{
14
16 {
17 public:
18
35
36 typedef boost::shared_ptr<ReachingDef> ReachingDefPtr;
37
38 private:
40 Type defType;
41
44 std::map<ReachingDefPtr, std::set<CFGEdge> > parentDefs;
45
48 CFGNode thisNode;
49
51 int renamingNumer;
52
53 public:
54
55 //---------CONSTRUCTORS---------
56
58 ReachingDef(const CFGNode& defNode, Type type);
59
60 //---------ACCESSORS---------
61
63 bool isPhiFunction() const;
64
67 const std::map<ReachingDefPtr, std::set<CFGEdge> >& getJoinedDefs() const;
68
71 const CFGNode& getDefinitionNode() const;
72
74 std::set<CFGNode> getActualDefinitions() const;
75
78 int getRenamingNumber() const;
79
82 bool isOriginalDef() const
83 {
84 return defType == ORIGINAL_DEF;
85 }
86
87 bool operator==(const ReachingDef& other) const;
88
89 Type getType() const
90 {
91 return defType;
92 }
93
94 //---------MODIFIERS---------
95
97 void setDefinitionNode(CFGNode defNode);
98
100 void addJoinedDef(ReachingDefPtr newDef, CFGEdge edge);
101
103 void setRenamingNumber(int n);
104
105 void setType(Type t)
106 {
107 defType = t;
108 }
109 };
110
111}
const std::map< ReachingDefPtr, std::set< CFGEdge > > & getJoinedDefs() const
If this is a join node (phi function), get the definitions merged.
ReachingDef(const CFGNode &defNode, Type type)
Creates a new reaching def.
@ EXTERNAL_DEF
This is not a real definition; this variable is external to the scope being analyzed and this def rep...
@ ORIGINAL_DEF
Definition for the actual variable in question, not a parent or child.
@ PHI_FUNCTION
'Fake' definition that joins two different reaching definitions.
@ EXPANDED_DEF
Definition for the parent or child of this variable.
void setDefinitionNode(CFGNode defNode)
Set the definition node in the AST (only valid if this is not a phi function)
std::set< CFGNode > getActualDefinitions() const
Returns the actual reaching definitions at the current node, expanding all phi functions.
int getRenamingNumber() const
Get the renaming (SSA index) associated with this definition.
void addJoinedDef(ReachingDefPtr newDef, CFGEdge edge)
Add a new join definition (only valid for phi functions).
bool isPhiFunction() const
Returns true if this is a phi function.
void setRenamingNumber(int n)
Set the renaming number (SSA index) of this def.
const CFGNode & getDefinitionNode() const
If this is not a phi function, returns the actual reaching definition.
bool isOriginalDef() const
Returns true if this is an original definition (i.e.