An analysis providing def-use chains.
More...
#include <def_use_analysis.h>
|
| DefUseAnalysis (ShPtr< Module > module, ShPtr< ValueAnalysis > va, ShPtr< VarUsesVisitor > vuv=nullptr) |
| Constructs a new analysis. More...
|
|
void | computeGenAndKill (ShPtr< DefUseChains > ducs) |
| Computes the GEN [B] and KILL [B] sets for each CFG node B . More...
|
|
void | computeGenAndKillForNode (ShPtr< DefUseChains > ducs, ShPtr< CFG::Node > node) |
| Computes the GEN [B] and KILL [B] sets for the given CFG node node B . More...
|
|
void | computeInAndOut (ShPtr< DefUseChains > ducs) |
| Computes the IN [B] and OUT [B] sets for each CFG node B . More...
|
|
bool | computeInAndOutForNode (ShPtr< DefUseChains > ducs, ShPtr< CFG::Node > node) |
| Computes the IN [node] and OUT [node] set for the given node node. More...
|
|
void | computeDefUseChains (ShPtr< DefUseChains > ducs) |
| Computes the DU[s, x] set for each statement s that defines a variable x . More...
|
|
void | computeDefUseChainForNode (ShPtr< DefUseChains > ducs, ShPtr< CFG::Node > node) |
| Computes the DU[s, x] set for each statement s in node that defines a variable x . More...
|
|
void | computeDefUseChainForStmt (ShPtr< DefUseChains > ducs, ShPtr< CFG::Node > node, CFG::stmt_iterator varDefStmtIter, ShPtr< Variable > defVar) |
| Computes the DU[*varDefStmtIter, defVar] set. More...
|
|
ShPtr< Variable > | getDefVarInStmt (ShPtr< Statement > stmt) |
| Returns the variable that is defined in stmt (if any). More...
|
|
| NonCopyable (const NonCopyable &)=delete |
|
NonCopyable & | operator= (const NonCopyable &)=delete |
|
| NonCopyable ()=default |
|
| ~NonCopyable ()=default |
|
An analysis providing def-use chains.
The analysis and its implementation is based on the following book:
For some basic information about def-use chains, see http://en.wikipedia.org/wiki/Use-define_chain.
Use create() to create instances. Instances of this class have reference object semantics.
◆ DefUseAnalysis()
Constructs a new analysis.
See create() for the description of the parameters.
◆ computeDefUseChainForNode()
Computes the DU[s, x]
set for each statement s
in node that defines a variable x
.
This function should be run only from computeDefUseChains(), and it modifies ducs.
◆ computeDefUseChainForStmt()
Computes the DU[*varDefStmtIter, defVar]
set.
- Parameters
-
[in] | ducs | Information about def-use chains. |
[in] | node | Currently processed basic block. |
[in] | varDefStmtIter | Iterator to the current statement in node. |
[in] | defVar | Variable that is defined in *varDefStmtIter . |
This function should be run only from computeDefUseChainForNode(), and it modifies ducs.
◆ computeDefUseChains()
void retdec::llvmir2hll::DefUseAnalysis::computeDefUseChains |
( |
ShPtr< DefUseChains > |
ducs | ) |
|
|
private |
Computes the DU[s, x]
set for each statement s
that defines a variable x
.
computeGenAndKill() and computeInAndOut() have to be run before this function. This function modifies ducs.
◆ computeGenAndKill()
void retdec::llvmir2hll::DefUseAnalysis::computeGenAndKill |
( |
ShPtr< DefUseChains > |
ducs | ) |
|
|
private |
Computes the GEN
[B] and KILL
[B] sets for each CFG node B
.
This function modifies ducs.
◆ computeGenAndKillForNode()
Computes the GEN
[B] and KILL
[B] sets for the given CFG node node B
.
This function modifies ducs.
◆ computeInAndOut()
void retdec::llvmir2hll::DefUseAnalysis::computeInAndOut |
( |
ShPtr< DefUseChains > |
ducs | ) |
|
|
private |
Computes the IN
[B] and OUT
[B] sets for each CFG node B
.
computeGenAndKill() has to be run before this function. This function modifies ducs.
◆ computeInAndOutForNode()
Computes the IN
[node] and OUT
[node] set for the given node node.
- Returns
true
if either of these two sets has been changed, false
otherwise.
This function modifies ducs.
- Preconditions
- node is not the exit node of a CFG
◆ create()
Creates a new analysis.
- Parameters
-
[in] | module | Module for which the analysis is created. |
[in] | va | The used analysis of values. |
[in] | vuv | The used visitor for obtaining uses of variables. |
If vuv is not provided, a new visitor is created.
- Preconditions
-
All methods of this class leave va in a valid state.
◆ getDefUseChains()
Returns def-use chains for the given function.
- Parameters
-
[in] | func | Function for which the analysis is computed. |
[in] | cfg | Optional CFG for func. |
[in] | shouldBeIncluded | A function that returns whether the given variable should be included in def-use chains. |
- Preconditions
- if cfg is non-null, it has to be a CFG corresponding to func
◆ getDefVarInStmt()
Returns the variable that is defined in stmt (if any).
"Defined" means that it is assigned a value (it doesn't necessary mean that stmt is a VarDefStmt).
If stmt doesn't define any variable, this function returns the null pointer.
◆ cfgBuilder
The used builder of CFGs.
◆ module
ShPtr<Module> retdec::llvmir2hll::DefUseAnalysis::module |
|
private |
Module that is being analyzed.
◆ va
◆ vuv
Visitor for obtaining uses of variables.
The documentation for this class was generated from the following files: