retdec
|
Used variables for a value (expression, statement). More...
#include <used_vars_visitor.h>
Public Types | |
using | var_iterator = VarSet::const_iterator |
Variables iterator. More... | |
Public Member Functions | |
UsedVars (const UsedVars &other)=default | |
UsedVars & | operator= (const UsedVars &other)=default |
bool | operator== (const UsedVars &other) const |
Returns true if the current object is equal to other, false otherwise. More... | |
bool | operator!= (const UsedVars &other) const |
Returns true if the current object is not equal to other, false otherwise. More... | |
VarSet | getReadVars () const |
Returns the variables that are read. More... | |
VarSet | getWrittenVars () const |
Returns the variables that are written into. More... | |
VarSet | getAllVars () const |
Returns read variables merged with written-into variables. More... | |
std::size_t | getCount (bool read=true, bool written=true) const |
Returns the number of used variables. More... | |
std::size_t | getNumOfUses (ShPtr< Variable > var) const |
Returns the number of uses of var. More... | |
bool | isUsed (ShPtr< Variable > var, bool read=true, bool written=true) const |
Returns true if var is used, false otherwise. More... | |
Used Variables Accessors | |
var_iterator | read_begin () const |
Returns an iterator to the first read variable. More... | |
var_iterator | read_end () const |
Returns an iterator past the last read variable. More... | |
var_iterator | written_begin () const |
Returns an iterator to the first written variable. More... | |
var_iterator | written_end () const |
Returns an iterator past the last written variable. More... | |
var_iterator | all_begin () const |
Returns an iterator to the first variable. More... | |
var_iterator | all_end () const |
Returns an iterator past the last variable. More... | |
Private Types | |
using | VarCountMap = std::map< ShPtr< Variable >, std::size_t > |
Mapping of a variable into a count. More... | |
Private Member Functions | |
UsedVars () | |
Constructs a new UsedVars object. More... | |
void | clear () |
Clears all private containers. More... | |
Private Attributes | |
VarSet | readVars |
Set of variables that are read. More... | |
VarSet | writtenVars |
Set of variables into which something is written. More... | |
VarSet | allVars |
Set of all variables (read or written). More... | |
VarCountMap | numOfVarUses |
Number of uses of a variable. More... | |
Friends | |
class | UsedVarsVisitor |
Used variables for a value (expression, statement).
See UsedVarsVisitor for a way of creating instances of this class.
Instances of this class have value object semantics.
using retdec::llvmir2hll::UsedVars::var_iterator = VarSet::const_iterator |
Variables iterator.
|
private |
Mapping of a variable into a count.
|
default |
|
private |
Constructs a new UsedVars object.
UsedVars::var_iterator retdec::llvmir2hll::UsedVars::all_begin | ( | ) | const |
Returns an iterator to the first variable.
UsedVars::var_iterator retdec::llvmir2hll::UsedVars::all_end | ( | ) | const |
Returns an iterator past the last variable.
|
private |
Clears all private containers.
VarSet retdec::llvmir2hll::UsedVars::getAllVars | ( | ) | const |
Returns read variables merged with written-into variables.
std::size_t retdec::llvmir2hll::UsedVars::getCount | ( | bool | read = true , |
bool | written = true |
||
) | const |
Returns the number of used variables.
[in] | read | Include the number of variables that are read. |
[in] | written | Include the number of written-into variables. |
If a variable is both read and written, it is counted only once.
Returns the number of uses of var.
VarSet retdec::llvmir2hll::UsedVars::getReadVars | ( | ) | const |
Returns the variables that are read.
VarSet retdec::llvmir2hll::UsedVars::getWrittenVars | ( | ) | const |
Returns the variables that are written into.
bool retdec::llvmir2hll::UsedVars::isUsed | ( | ShPtr< Variable > | var, |
bool | read = true , |
||
bool | written = true |
||
) | const |
Returns true
if var is used, false
otherwise.
[in] | var | Variable that is looked up. |
[in] | read | Consider variables that are read. |
[in] | written | Consider written-into variables. |
bool retdec::llvmir2hll::UsedVars::operator!= | ( | const UsedVars & | other | ) | const |
Returns true
if the current object is not equal to other, false
otherwise.
bool retdec::llvmir2hll::UsedVars::operator== | ( | const UsedVars & | other | ) | const |
Returns true
if the current object is equal to other, false
otherwise.
UsedVars::var_iterator retdec::llvmir2hll::UsedVars::read_begin | ( | ) | const |
Returns an iterator to the first read variable.
UsedVars::var_iterator retdec::llvmir2hll::UsedVars::read_end | ( | ) | const |
Returns an iterator past the last read variable.
UsedVars::var_iterator retdec::llvmir2hll::UsedVars::written_begin | ( | ) | const |
Returns an iterator to the first written variable.
UsedVars::var_iterator retdec::llvmir2hll::UsedVars::written_end | ( | ) | const |
Returns an iterator past the last written variable.
|
friend |
|
private |
Set of all variables (read or written).
|
private |
Number of uses of a variable.
|
private |
Set of variables that are read.
|
private |
Set of variables into which something is written.