retdec
|
Obtainer of information about functions and function calls that assumes it has access to complete information about the module. More...
#include <optim_call_info_obtainer.h>
Public Member Functions | |
virtual void | init (ShPtr< CG > cg, ShPtr< ValueAnalysis > va) override |
Initializes the obtainer. More... | |
virtual std::string | getId () const override |
Returns the ID of the obtainer. More... | |
virtual ShPtr< CallInfo > | getCallInfo (ShPtr< CallExpr > call, ShPtr< Function > caller) override |
Computes and returns information about the given function call which occurs in caller. More... | |
virtual ShPtr< FuncInfo > | getFuncInfo (ShPtr< Function > func) override |
Computes and returns information about the given function. More... | |
![]() | |
virtual | ~CallInfoObtainer ()=default |
ShPtr< CG > | getCG () const |
Returns the call graph with which the obtainer has been initialized. More... | |
ShPtr< CFG > | getCFGForFunc (ShPtr< Function > func) const |
Returns the CFG for func after the obtainer has been initialized. More... | |
virtual bool | isInitialized () const |
Returns true if the obtainer has been initialized, false otherwise. More... | |
Static Public Member Functions | |
static ShPtr< CallInfoObtainer > | create () |
Creates a new obtainer. More... | |
Private Types | |
using | FuncInfoMap = std::map< ShPtr< Function >, ShPtr< OptimFuncInfo > > |
Mapping of a function into its info. More... | |
using | CallInfoMap = std::map< ShPtr< CallExpr >, ShPtr< OptimCallInfo > > |
Mapping of a function call into its info. More... | |
Private Member Functions | |
OptimCallInfoObtainer () | |
Constructs a new obtainer. More... | |
void | computeAllFuncInfos () |
Computes funcInfoMap for each function in the module. More... | |
void | computeFuncInfo (ShPtr< Function > func) |
Computes funcInfoMap [func] for func from the currently known information. More... | |
void | computeFuncInfos (const FuncSet &funcs) |
Computes funcInfoMap [f] for every function f from funcs using the currently known information. More... | |
VarSet | skipLocalVars (const VarSet &vars) |
Returns the set of variables that are in both vars and globalVars . More... | |
ShPtr< OptimFuncInfo > | computeFuncInfoDeclaration (ShPtr< Function > func) |
Computes and returns a function info for the given function declaration. More... | |
ShPtr< OptimFuncInfo > | computeFuncInfoDefinition (ShPtr< Function > func) |
Computes and returns a function info for the given function definition. More... | |
ShPtr< OptimCallInfo > | computeCallInfo (ShPtr< CallExpr > call, ShPtr< Function > caller) |
Computes and returns information about the given function call which occurs in caller. More... | |
Static Private Member Functions | |
static bool | areDifferent (ShPtr< OptimFuncInfo > fi1, ShPtr< OptimFuncInfo > fi2) |
Returns true if fi1 differs from fi2, false otherwise. More... | |
static bool | hasChanged (const FuncInfoMap &oldInfo, const FuncInfoMap &newInfo) |
Returns true if the FuncInfos in newInfo for functions that are also in oldInfo have changed, false otherwise. More... | |
Private Attributes | |
FuncInfoMap | funcInfoMap |
Mapping of a function into its info. More... | |
CallInfoMap | callInfoMap |
Mapping of a call into its info. More... | |
VarSet | globalVars |
Global variables in the module, including functions. More... | |
Friends | |
class | OptimFuncInfoCFGTraversal |
Additional Inherited Members | |
![]() | |
using | FuncVectorSet = std::vector< FuncSet > |
Vector of sets of functions. More... | |
using | FuncCFGMap = std::map< ShPtr< Function >, ShPtr< CFG > > |
Mapping of a function into its CFG. More... | |
![]() | |
CallInfoObtainer () | |
Constructs a new obtainer. More... | |
ShPtr< FuncInfoCompOrder > | getFuncInfoCompOrder (ShPtr< CG > cg) |
Computes an order in which FuncInfos should be computed. More... | |
![]() | |
ShPtr< Module > | module |
The current module. More... | |
ShPtr< CG > | cg |
Call graph of the current module. More... | |
ShPtr< ValueAnalysis > | va |
Analysis of values. More... | |
FuncCFGMap | funcCFGMap |
Mapping of a function into its CFG. More... | |
ShPtr< CFGBuilder > | cfgBuilder |
The used builder of CFGs. More... | |
Obtainer of information about functions and function calls that assumes it has access to complete information about the module.
Currently, this obtainer utilizes the following assumptions:
Compare with PessimCallInfoObtainer.
Use create() to create instances. Instances of this class have reference object semantics.
|
private |
Mapping of a function call into its info.
|
private |
Mapping of a function into its info.
|
private |
Constructs a new obtainer.
See create() for the description of parameters.
|
staticprivate |
Returns true
if fi1 differs from fi2, false
otherwise.
|
private |
Computes funcInfoMap
for each function in the module.
Declarations are also considered.
|
private |
Computes and returns information about the given function call which occurs in caller.
See the description of getCallInfo() for more information on the preconditions.
Computes funcInfoMap
[func] for func from the currently known information.
|
private |
Computes and returns a function info for the given function declaration.
|
private |
Computes and returns a function info for the given function definition.
|
private |
Computes funcInfoMap
[f] for every function f
from funcs using the currently known information.
The computation is iterative. The function keeps computing funcInfoMap
[f] for every function f
from funcs until there is no change (i.e. it performs a fixed-point computation).
|
static |
Creates a new obtainer.
|
overridevirtual |
Computes and returns information about the given function call which occurs in caller.
Implements retdec::llvmir2hll::CallInfoObtainer.
|
overridevirtual |
Computes and returns information about the given function.
Implements retdec::llvmir2hll::CallInfoObtainer.
|
overridevirtual |
Returns the ID of the obtainer.
Implements retdec::llvmir2hll::CallInfoObtainer.
|
staticprivate |
Returns true
if the FuncInfos in newInfo for functions that are also in oldInfo have changed, false
otherwise.
|
overridevirtual |
Initializes the obtainer.
[in] | cg | The obtainer will be initialized with this call graph. |
[in] | va | The used analysis of values. |
This member function has to be called (1) when an instance of this class (or its subclass) is created and (2) whenever the current module is changed in a way that changes the call graph of the module and/or the variables which are read/modified in a function.
This function leaves va in a valid state.
Reimplemented from retdec::llvmir2hll::CallInfoObtainer.
Returns the set of variables that are in both vars and globalVars
.
|
friend |
|
private |
Mapping of a call into its info.
|
private |
Mapping of a function into its info.
|
private |
Global variables in the module, including functions.