ROSE
0.9.6a
|
Class that defines an VariableRenaming of a program. More...
#include <VariableRenaming.h>
Classes | |
class | ChildUses |
Attribute that describes the variables used by a given expression. More... | |
class | DefsAndUsesTraversal |
This class collects all the defs and uses associated with each node in the traversed CFG. More... | |
class | UniqueNameTraversal |
Class to traverse the AST and assign unique names to every varRef. More... | |
class | VarRefSynthAttr |
Attribute that describes the variables modified by a given expression. More... | |
Public Types | |
typedef std::vector< SgNode * > | NodeVec |
Vector of SgNode*. More... | |
typedef std::vector < SgInitializedName * > | VarName |
A compound variable name as used by the variable renaming. More... | |
typedef std::map< VarName, NodeVec > | TableEntry |
An entry in the rename table mapping a name to a nodeVec. More... | |
typedef boost::unordered_map < SgNode *, TableEntry > | DefUseTable |
A table storing the name->node mappings for every node in the program. More... | |
typedef boost::unordered_map < VarName, SgNode * > | FirstDefTable |
A table mapping a name to a single node. More... | |
typedef std::vector < SgInitializedName * > | InitNameVec |
A vector of SgInitializedName*. More... | |
typedef FilteredCFGNode < IsDefUseFilter > | cfgNode |
A filtered CFGNode that is used for DefUse traversal. More... | |
typedef FilteredCFGEdge < IsDefUseFilter > | cfgEdge |
A filtered CFGEdge that is used for DefUse traversal. More... | |
typedef std::vector< cfgNode > | cfgNodeVec |
A vector of cfgNodes. More... | |
typedef std::vector< cfgEdge > | cfgEdgeVec |
A vector of cfgEdges. More... | |
typedef std::map< SgNode *, int > | NodeNumRenameEntry |
An entry in the rename table that maps a node to a number. More... | |
typedef boost::unordered_map < VarName, NodeNumRenameEntry > | NodeNumRenameTable |
A table that maps a name to it's node->number renamings. More... | |
typedef std::map< int, SgNode * > | NumNodeRenameEntry |
An entry in the rename table that maps a number to a node. More... | |
typedef boost::unordered_map < VarName, NumNodeRenameEntry > | NumNodeRenameTable |
A table that maps a name to it's number->node renamings. More... | |
Public Member Functions | |
VariableRenaming (SgProject *proj) | |
~VariableRenaming () | |
void | run () |
bool | getDebug () const |
bool | getDebugExtra () const |
void | toDOT (const std::string fileName) |
Print the CFG with any UniqueNames and Def/Use information visible. More... | |
void | toFilteredDOT (const std::string fileName) |
Print the CFG with any UniqueNames and Def/Use information visible. More... | |
void | printDefs (SgNode *node) |
void | printOriginalDefs (SgNode *node) |
void | printOriginalDefTable () |
void | printUses (SgNode *node) |
void | printRenameTable () |
void | printRenameTable (const VarName &var) |
DefUseTable & | getDefTable () |
Get the table of definitions for every node. More... | |
const DefUseTable & | getDefTable () const |
Get the table of definitions for every node. More... | |
DefUseTable & | getPropDefTable () |
Get the defTable containing the propogated definition information. More... | |
const DefUseTable & | getPropDefTable () const |
Get the defTable containing the propogated definition information. More... | |
DefUseTable & | getUseTable () |
Get the table of uses for every node. More... | |
const DefUseTable & | getUseTable () const |
Get the table of uses for every node. More... | |
int | getRenameNumberForNode (const VarName &var, SgNode *node) const |
Get the rename number for the given variable and the given node. More... | |
SgNode * | getNodeForRenameNumber (const VarName &var, int num) const |
Get the node that defines the given number of the given variable. More... | |
int | getMaxRenameNumberForName (const VarName &var) const |
Get the number of the last rename of the given variable. More... | |
NodeVec | getAllUsesForDef (const VarName &var, int num) |
Retrieve a list of nodes that use the var:num specified. More... | |
template<typename T > | |
std::vector< T * > | getAllUsesForDef (const VarName &var, int num) |
Retrieve a list of nodes of type T that use the var:num specified. More... | |
NumNodeRenameTable | getReachingDefsAtNode (SgNode *node) |
Get name:num mappings for all reaching definitions of all variables at the node. More... | |
NumNodeRenameEntry | getReachingDefsAtNodeForName (SgNode *node, const VarName &var) |
Get name:num mapping for all reaching definitions of the given variable at the node. More... | |
NumNodeRenameTable | getReachingDefsAtScopeEnd (SgScopeStatement *scope) |
Get the final versions if all variables at the end of the given scope. More... | |
NumNodeRenameTable | getReachingDefsAtFunctionEnd (SgFunctionDefinition *node) |
Get the final versions if all variables at the end of the given function. More... | |
NumNodeRenameEntry | getReachingDefsAtFunctionEndForName (SgFunctionDefinition *node, const VarName &var) |
Get the versions of a variable at the end of the given function. More... | |
NumNodeRenameTable | getReachingDefsAtStatementStart (SgStatement *statement) |
Gets the versions of all variables reaching a statment before its execution. More... | |
NumNodeRenameTable | getReachingDefsAtFunctionStart (SgFunctionDefinition *node) |
Get the versions of all variables at the start of the given function. More... | |
NumNodeRenameEntry | getReachingDefsAtFunctionStartForName (SgFunctionDefinition *node, const VarName &var) |
Get the versions of a variable at the start of the given function. More... | |
NumNodeRenameTable | getUsesAtNode (SgNode *node) |
Get name:num mappings for all uses at this node. More... | |
NumNodeRenameTable | getOriginalUsesAtNode (SgNode *node) |
Get name:num mappings for the original uses at this node. More... | |
NumNodeRenameEntry | getUsesAtNodeForName (SgNode *node, const VarName &var) |
Get name:num mapping for use of the given variable at this node. More... | |
NumNodeRenameTable | getDefsAtNode (SgNode *node) |
Get name:num mapping for all defs at the given node. More... | |
NumNodeRenameEntry | getDefsAtNodeForName (SgNode *node, const VarName &var) |
Get name:num mapping for def of the specified variable at the given node. More... | |
NumNodeRenameTable | getOriginalDefsAtNode (SgNode *node) |
Get name:num mapping for all original defs at the given node. More... | |
NumNodeRenameEntry | getOriginalDefsAtNodeForName (SgNode *node, const VarName &var) |
Get name:num mapping for def of the specified variable at the given node. More... | |
NumNodeRenameTable | getExpandedDefsAtNode (SgNode *node) |
Get name:num mapping for all expanded defs at the given node. More... | |
NumNodeRenameEntry | getExpandedDefsAtNodeForName (SgNode *node, const VarName &var) |
Get name:num mapping for def of the specified variable at the given node. More... | |
NumNodeRenameTable | getDefsForSubtree (SgNode *node) |
Get all definitions for the subtree rooted at this node. More... | |
NumNodeRenameTable | getOriginalDefsForSubtree (SgNode *node) |
Get all original definitions for the subtree rooted at this node. More... | |
Static Public Member Functions | |
static std::string | keyToString (const VarName &vec) |
Get a string representation of a varName. More... | |
static void | printRenameTable (const NodeNumRenameTable &table) |
static void | printRenameTable (const NumNodeRenameTable &table) |
static void | printRenameEntry (const NodeNumRenameEntry &entry) |
static void | printRenameEntry (const NumNodeRenameEntry &entry) |
static bool | isPrefixOfName (VarName name, VarName prefix) |
Find if the given prefix is a prefix of the given name. More... | |
static VarUniqueName * | getUniqueName (SgNode *node) |
Get the uniqueName attribute for the given node. More... | |
static VarName | getVarName (SgNode *node) |
Get the variable name of the given node. More... | |
static bool | isFromLibrary (SgFunctionDeclaration *node) |
Gets whether or not the function is from a library. More... | |
static SgExpression * | buildVariableReference (const VarName &var, SgScopeStatement *scope=NULL) |
Get an AST fragment containing the appropriate varRefs and Dot/Arrow ops to access the given variable. More... | |
Static Public Attributes | |
static std::string | varKeyTag |
Tag to use to retrieve unique naming key from node. More... | |
static SgInitializedName * | thisDecl |
This represents the initializedName for the 'this' keyword. More... | |
static VarName | emptyName |
static NumNodeRenameTable | emptyRenameTable |
static NumNodeRenameEntry | emptyRenameEntry |
Private Member Functions | |
void | runDefUse (SgFunctionDefinition *func) |
bool | defUse (cfgNode node, bool *memberRefInserted, NodeVec &changedNodes) |
int | addRenameNumberForNode (const VarName &var, SgNode *node) |
Add an entry to the renumbering table for the given var and node. More... | |
bool | isBuiltinVar (const VarName &var) |
bool | mergeDefs (cfgNode curNode, bool *memberRefInserted, NodeVec &changedNodes) |
Called to merge the defs from previous nodes in the CFG to this one. More... | |
bool | resolveUses (cfgNode curNode, bool *memberRefInserted, NodeVec &changedNodes) |
Called to update the uses on the current node. More... | |
void | aggregatePreviousDefs (cfgNode curNode, TableEntry &results) |
Trace backwards in the cfg one step and return an aggregate of all previous defs. More... | |
bool | expandMemberDefinitions (cfgNode curNode) |
Expand all member definitions (chained names) to define every name in the chain. More... | |
bool | insertExpandedDefsForUse (cfgNode curNode, VarName name, NodeVec &changedNodes) |
Insert defs for member uses (chained names) that do not have an explicit def. More... | |
bool | expandMemberUses (cfgNode curNode) |
Expand all member uses (chained names) to explicitly use every name in the chain. More... | |
void | insertDefsForExternalVariables (SgFunctionDeclaration *function) |
Insert defs for functions that are declared outside the function scope. More... | |
std::set< VarName > | getVarsUsedInSubtree (SgNode *root) |
Returns a set of all the variables names that have uses in the subtree. More... | |
void | printToDOT (SgSourceFile *file, std::ofstream &outFile) |
void | printToFilteredDOT (SgSourceFile *file, std::ofstream &outFile) |
void | printUses (const TableEntry &table) |
void | printDefs (const TableEntry &table) |
Private Attributes | |
SgProject * | project |
The project to perform SSA Analysis on. More... | |
bool | DEBUG_MODE |
bool | DEBUG_MODE_EXTRA |
DefUseTable | originalDefTable |
This is the table of variable definition locations that is generated by the VarDefUseTraversal. More... | |
DefUseTable | expandedDefTable |
This is the table of definitions that is expanded from the original table. More... | |
DefUseTable | defTable |
This is the table that is populated with all the def information for all the variables at all the nodes. More... | |
DefUseTable | useTable |
This is the table that is populated with all the use information for all the variables at all the nodes. More... | |
FirstDefTable | firstDefList |
Holds a list of the locations that a particular name is first defined. More... | |
NodeNumRenameTable | nodeRenameTable |
This holds the mapping between variables and the nodes where they are renumbered. More... | |
NumNodeRenameTable | numRenameTable |
This holds the mapping between variables and the nodes where they are renumbered. More... | |
Class that defines an VariableRenaming of a program.
Contains all the functionality to implement variable renaming on a given program. For this class, we do not actually transform the AST directly, rather we perform the analysis and add attributes to the AST nodes so that later optimizations can access the results of this analysis while still preserving the original AST.
Definition at line 193 of file VariableRenaming.h.
typedef std::vector<SgNode*> VariableRenaming::NodeVec |
Vector of SgNode*.
Definition at line 205 of file VariableRenaming.h.
typedef std::vector<SgInitializedName*> VariableRenaming::VarName |
A compound variable name as used by the variable renaming.
Definition at line 208 of file VariableRenaming.h.
typedef std::map<VarName, NodeVec> VariableRenaming::TableEntry |
An entry in the rename table mapping a name to a nodeVec.
Definition at line 211 of file VariableRenaming.h.
typedef boost::unordered_map<SgNode*, TableEntry> VariableRenaming::DefUseTable |
A table storing the name->node mappings for every node in the program.
Definition at line 214 of file VariableRenaming.h.
typedef boost::unordered_map<VarName, SgNode*> VariableRenaming::FirstDefTable |
A table mapping a name to a single node.
Definition at line 217 of file VariableRenaming.h.
typedef std::vector<SgInitializedName*> VariableRenaming::InitNameVec |
A vector of SgInitializedName*.
Definition at line 221 of file VariableRenaming.h.
typedef FilteredCFGNode<IsDefUseFilter> VariableRenaming::cfgNode |
A filtered CFGNode that is used for DefUse traversal.
Definition at line 224 of file VariableRenaming.h.
typedef FilteredCFGEdge<IsDefUseFilter> VariableRenaming::cfgEdge |
A filtered CFGEdge that is used for DefUse traversal.
Definition at line 227 of file VariableRenaming.h.
typedef std::vector<cfgNode> VariableRenaming::cfgNodeVec |
A vector of cfgNodes.
Definition at line 230 of file VariableRenaming.h.
typedef std::vector<cfgEdge> VariableRenaming::cfgEdgeVec |
A vector of cfgEdges.
Definition at line 233 of file VariableRenaming.h.
typedef std::map<SgNode*, int> VariableRenaming::NodeNumRenameEntry |
An entry in the rename table that maps a node to a number.
Definition at line 236 of file VariableRenaming.h.
typedef boost::unordered_map<VarName, NodeNumRenameEntry> VariableRenaming::NodeNumRenameTable |
A table that maps a name to it's node->number renamings.
Definition at line 239 of file VariableRenaming.h.
typedef std::map<int, SgNode*> VariableRenaming::NumNodeRenameEntry |
An entry in the rename table that maps a number to a node.
Definition at line 242 of file VariableRenaming.h.
typedef boost::unordered_map<VarName, NumNodeRenameEntry> VariableRenaming::NumNodeRenameTable |
A table that maps a name to it's number->node renamings.
Definition at line 245 of file VariableRenaming.h.
|
inline |
Definition at line 294 of file VariableRenaming.h.
|
inline |
Definition at line 296 of file VariableRenaming.h.
void VariableRenaming::run | ( | ) |
|
inline |
Definition at line 300 of file VariableRenaming.h.
References DEBUG_MODE.
|
inline |
Definition at line 301 of file VariableRenaming.h.
References DEBUG_MODE_EXTRA.
|
private |
|
private |
Add an entry to the renumbering table for the given var and node.
This will place a new entry into the renaming table that renumbers var at node. This new definition will have the next available numbering of var. If the var @ node combination already exists, the number will be returned.
var | The variable to renumber. |
node | The node that defines the new number. |
|
private |
|
private |
Called to merge the defs from previous nodes in the CFG to this one.
This will merge the def tables from all previous CFG nodes, merge in the defs at this node, and update this node's table if needed. If it locates a def that is not in the table, it will attempt to find the location where that member was first defined and insert a definition there. It will then set the outParameter to indicate that it back-inserted a def.
curNode | The node to merge defs onto. |
memberRefInserted | Reference that indicates whether the function back-inserted a definition. |
|
private |
Called to update the uses on the current node.
This will update the uses at this node to point to the defs that were propogated from previous nodes. If it locates a use of a def that did not exist, it will attempt to locate the definition site of the base variable and insert a def there. It will then set the outParameter to indicate that it back-inserted a def.
curNode | The node to resolve uses on. |
memberRefInserted | Reference that indicates whether the function back-inserted a definition. |
|
private |
Trace backwards in the cfg one step and return an aggregate of all previous defs.
curNode | Node to traverse backwards from. |
results | TableEntry reference where results are stored. |
|
private |
Expand all member definitions (chained names) to define every name in the chain.
When a member of a struct/class is referenced, this will insert definitions for every member referenced to access the currently referenced one.
ex. Obj o; //Declare o of type Obj o.a.b = 5; //Def for o.a.b
In the second line, this function will insert the following:
o.a.b = 5; //Def for o.a.b, o.a, o
curNode | The node to expand the definitions on. |
|
private |
Insert defs for member uses (chained names) that do not have an explicit def.
When a member of a struct/class is used and that member does not have a propogated def on the current node, this will find the closest definition of a member in the ref chain and insert a definition for this use at that member's def.
ex. Obj o; //Declare o of type o o.a = 5; //Def for o.a int i = o.b.x; //Def for i, use for o.b.x int j = o.a.x; //Def for j, use for o.a.x
This function will insert the following: Obj o; //Declare o of type o, Def for o.a, def for o.b, def for o.b.x o.a = 5; //Def for o.a, use for o, use for o.a, def for o.a.x int i = o.b.x; //Def for i, use for o.b.x int j = o.a.x; //Def for j, use for o.a.x
curNode | The node to expand the uses on. |
name | The variableName to expand the uses for. |
|
private |
Expand all member uses (chained names) to explicitly use every name in the chain.
When a member of a struct/class is used, this will insert uses for every member referenced to access the currently used one.
ex. Obj o; //Declare o of type Obj int i; //Declare i of type int i = o.a.b; //Def for i, use for o.a.b
In the third line, this function will insert the following:
i = o.a.b; //Def for i, use for o.a.b, o.a, o
curNode |
|
private |
Insert defs for functions that are declared outside the function scope.
Returns a set of all the variables names that have uses in the subtree.
|
private |
|
private |
|
private |
|
private |
void VariableRenaming::toDOT | ( | const std::string | fileName) |
Print the CFG with any UniqueNames and Def/Use information visible.
fileName | The filename to save graph as. Filenames will be prepended. |
void VariableRenaming::toFilteredDOT | ( | const std::string | fileName) |
Print the CFG with any UniqueNames and Def/Use information visible.
This will only print the nodes that are of interest to the filter function used by the def/use traversal.
fileName | The filename to save graph as. Filenames will be prepended. |
|
static |
Get a string representation of a varName.
vec | varName to get string for. |
void VariableRenaming::printDefs | ( | SgNode * | node) |
void VariableRenaming::printOriginalDefs | ( | SgNode * | node) |
void VariableRenaming::printOriginalDefTable | ( | ) |
void VariableRenaming::printUses | ( | SgNode * | node) |
void VariableRenaming::printRenameTable | ( | ) |
void VariableRenaming::printRenameTable | ( | const VarName & | var) |
|
static |
|
static |
|
static |
|
static |
|
inline |
Get the table of definitions for every node.
Definition at line 501 of file VariableRenaming.h.
References originalDefTable.
|
inline |
Get the table of definitions for every node.
Definition at line 507 of file VariableRenaming.h.
References originalDefTable.
|
inline |
Get the defTable containing the propogated definition information.
Definition at line 513 of file VariableRenaming.h.
References defTable.
|
inline |
Get the defTable containing the propogated definition information.
Definition at line 519 of file VariableRenaming.h.
References defTable.
|
inline |
Get the table of uses for every node.
Definition at line 525 of file VariableRenaming.h.
References useTable.
|
inline |
Get the table of uses for every node.
Definition at line 531 of file VariableRenaming.h.
References useTable.
Get the rename number for the given variable and the given node.
This will return the number of the given variable as it is defined on the given node. If the provided node does not define the variable, the function will return -1.
var | The variable to get the renumbering for. |
node | The defining node to get the renumbering at. |
Get the node that defines the given number of the given variable.
This will return the node that defines the 'num' value of var. It will be the defining node for the variable renumbered with num of the variable var. If the provided number does not exist for var, it will return NULL.
var | The variable to get the defining node for. |
num | The renumbering of the defining node to get. |
int VariableRenaming::getMaxRenameNumberForName | ( | const VarName & | var) | const |
Get the number of the last rename of the given variable.
This will return the number of the last renaming of the given variable. If the given variable has no renamings, it will return -1.
var | The variable to get the last renaming for. |
Retrieve a list of nodes that use the var:num specified.
This will retrieve a list of nodes that use the specified var:num combo. ex. int i = s2.y1; //Search for s:y1 will yield varRef for y1, as well as //the DotExpr and the AssignOp
var | The variable name to find. |
num | The revision of the variable to find. |
Referenced by getAllUsesForDef().
|
inline |
Retrieve a list of nodes of type T that use the var:num specified.
This will retrieve a list of nodes of type T that use the specified var:num combo. ex. int i = s2.y1; //Search for s:y1,AssignOp will yield the AssignOp
var | The variable name to find. |
num | The revision of the variable to find. |
Definition at line 600 of file VariableRenaming.h.
References getAllUsesForDef().
NumNodeRenameTable VariableRenaming::getReachingDefsAtNode | ( | SgNode * | node) |
Get name:num mappings for all reaching definitions of all variables at the node.
node | The node to retrieve reaching definitions for. |
NumNodeRenameEntry VariableRenaming::getReachingDefsAtNodeForName | ( | SgNode * | node, |
const VarName & | var | ||
) |
Get name:num mapping for all reaching definitions of the given variable at the node.
node | The node to retrieve reaching definitions for. |
var | The variable to retrieve definitions of. |
NumNodeRenameTable VariableRenaming::getReachingDefsAtScopeEnd | ( | SgScopeStatement * | scope) |
Get the final versions if all variables at the end of the given scope.
bb | The scope to get variables for. |
NumNodeRenameTable VariableRenaming::getReachingDefsAtFunctionEnd | ( | SgFunctionDefinition * | node) |
Get the final versions if all variables at the end of the given function.
node | The function to get variables for. |
NumNodeRenameEntry VariableRenaming::getReachingDefsAtFunctionEndForName | ( | SgFunctionDefinition * | node, |
const VarName & | var | ||
) |
Get the versions of a variable at the end of the given function.
node | The function definition to get definitions for. |
var | The varName to get definitions for. |
NumNodeRenameTable VariableRenaming::getReachingDefsAtStatementStart | ( | SgStatement * | statement) |
Gets the versions of all variables reaching a statment before its execution.
Notice that this method and getReachingDefsAtNode potentially return different values for loops. With loops, variable values from the body of the loop flow to the top; hence getReachingDefsAtNode returns definitions from the loop body. On the other hand, getReachingDefsAtStatementStart does not return definitions coming in from a loop body.
statement |
NumNodeRenameTable VariableRenaming::getReachingDefsAtFunctionStart | ( | SgFunctionDefinition * | node) |
Get the versions of all variables at the start of the given function.
node | The function to get variables for. |
NumNodeRenameEntry VariableRenaming::getReachingDefsAtFunctionStartForName | ( | SgFunctionDefinition * | node, |
const VarName & | var | ||
) |
Get the versions of a variable at the start of the given function.
node | The function definition to get definitions for. |
var | The varName to get definitions for. |
NumNodeRenameTable VariableRenaming::getUsesAtNode | ( | SgNode * | node) |
Get name:num mappings for all uses at this node.
For example, if p.x appears, there will be a use for both p and p.x
node | The node to get uses for. |
NumNodeRenameTable VariableRenaming::getOriginalUsesAtNode | ( | SgNode * | node) |
Get name:num mappings for the original uses at this node.
For example, if p.x appears, there will be a use for p.x, but not for p.
node | The node to get uses for. |
NumNodeRenameEntry VariableRenaming::getUsesAtNodeForName | ( | SgNode * | node, |
const VarName & | var | ||
) |
Get name:num mapping for use of the given variable at this node.
node | The node to get uses for. |
var | The varName to get the uses for. |
NumNodeRenameTable VariableRenaming::getDefsAtNode | ( | SgNode * | node) |
Get name:num mapping for all defs at the given node.
This will return the combination of original and expanded defs on this node.
ex. s.x = 5; //This will return s.x and s (s.x is original & s is expanded)
node | The node to get defs for. |
NumNodeRenameEntry VariableRenaming::getDefsAtNodeForName | ( | SgNode * | node, |
const VarName & | var | ||
) |
Get name:num mapping for def of the specified variable at the given node.
This will return the combination of original and expanded defs of the given variable on this node.
ex. s.x = 5; //(s is expanded & s.x is original) Looking for s will return this node, even though s is an expanded definition.
node | The node to get defs for. |
var | The variable to get defs for. |
NumNodeRenameTable VariableRenaming::getOriginalDefsAtNode | ( | SgNode * | node) |
Get name:num mapping for all original defs at the given node.
This will return the original defs on this node.
ex. s.x = 5; //This will return s.x (s.x is original & s is expanded)
node | The node to get defs for. |
NumNodeRenameEntry VariableRenaming::getOriginalDefsAtNodeForName | ( | SgNode * | node, |
const VarName & | var | ||
) |
Get name:num mapping for def of the specified variable at the given node.
This will return the combination of original defs of the given variable on this node.
ex. s.x = 5; //(s is expanded & s.x is original) Looking for s.x will return this node, s will return empty
node | The node to get defs for. |
var | The variable to get defs for. |
NumNodeRenameTable VariableRenaming::getExpandedDefsAtNode | ( | SgNode * | node) |
Get name:num mapping for all expanded defs at the given node.
This will return the expanded defs on this node.
ex. s.x = 5; //This will return s (s.x is original & s is expanded)
node | The node to get defs for. |
NumNodeRenameEntry VariableRenaming::getExpandedDefsAtNodeForName | ( | SgNode * | node, |
const VarName & | var | ||
) |
Get name:num mapping for def of the specified variable at the given node.
This will return the combination of expanded defs of the given variable on this node.
ex. s.x = 5; //(s is expanded & s.x is original) Looking for s will return this node, s.x will return empty
node | The node to get defs for. |
var | The variable to get defs for. |
NumNodeRenameTable VariableRenaming::getDefsForSubtree | ( | SgNode * | node) |
Get all definitions for the subtree rooted at this node.
If m.x is defined, the resulting table will also include a definition for m.
node | The root of the subtree to get definitions for. |
NumNodeRenameTable VariableRenaming::getOriginalDefsForSubtree | ( | SgNode * | node) |
Get all original definitions for the subtree rooted at this node.
No expanded definitions will be included - for example, if m.x is defined, there will be no definition for the structure m.
node | The root of the subtree to get definitions for. |
Find if the given prefix is a prefix of the given name.
This will return whether the given name has the given prefix inside it.
ex. a.b.c has prefix a.b, but not a.c
name | The name to search. |
prefix | The prefix to search for. |
|
static |
Get the uniqueName attribute for the given node.
node | Node to get the attribute from. |
Get the variable name of the given node.
node | The node to get the name for. |
|
static |
Gets whether or not the function is from a library.
This method checks if the variable is compiler generated, and if its filename has "/include/" in it. If so, it will return true. Otherwise, it returns false.
node | The function to check. |
|
static |
Get an AST fragment containing the appropriate varRefs and Dot/Arrow ops to access the given variable.
var | The variable to construct access for. |
scope | The scope within which to construct the access. |
|
private |
The project to perform SSA Analysis on.
Definition at line 198 of file VariableRenaming.h.
|
private |
Definition at line 199 of file VariableRenaming.h.
Referenced by getDebug().
|
private |
Definition at line 200 of file VariableRenaming.h.
Referenced by getDebugExtra().
|
private |
This is the table of variable definition locations that is generated by the VarDefUseTraversal.
It is later used to populate the actual def/use table.
Definition at line 254 of file VariableRenaming.h.
Referenced by getDefTable().
|
private |
This is the table of definitions that is expanded from the original table.
It is used to populate the actual def/use table.
Definition at line 259 of file VariableRenaming.h.
|
private |
This is the table that is populated with all the def information for all the variables at all the nodes.
It is populated during the runDefUse function, and is done with the steady-state dataflow algorithm.
Definition at line 265 of file VariableRenaming.h.
Referenced by getPropDefTable().
|
private |
This is the table that is populated with all the use information for all the variables at all the nodes.
It is populated during the runDefUse function, and is done with the steady-state dataflow algorithm.
Definition at line 271 of file VariableRenaming.h.
Referenced by getUseTable().
|
private |
Holds a list of the locations that a particular name is first defined.
This helps when backwards-inserting definitions of member variables, so that we can simply insert the definition at the first definition.
Definition at line 279 of file VariableRenaming.h.
|
private |
This holds the mapping between variables and the nodes where they are renumbered.
Given a name and a node, we can get the number of the name that is defined at that node. Nodes which do not define a name are not in the table.
Definition at line 285 of file VariableRenaming.h.
|
private |
This holds the mapping between variables and the nodes where they are renumbered.
Given a name and a number, we can get the node where that number is defined. Nodes which do not define a name are not in the table.
Definition at line 291 of file VariableRenaming.h.
|
static |
Tag to use to retrieve unique naming key from node.
Definition at line 430 of file VariableRenaming.h.
|
static |
This represents the initializedName for the 'this' keyword.
This will allow the this pointer to be versioned inside member functions.
Definition at line 436 of file VariableRenaming.h.
|
static |
Definition at line 438 of file VariableRenaming.h.
|
static |
Definition at line 440 of file VariableRenaming.h.
|
static |
Definition at line 442 of file VariableRenaming.h.