retdec
|
A base class of all obtainers of information about functions and function calls. More...
#include <call_info_obtainer.h>
Classes | |
class | FuncInfoCompOrder |
Represents an order in which FuncInfos should be computed. More... | |
class | SCCComputer |
A computation of strongly connected components (SCCs) from a call graph. More... | |
struct | SCCWithRepresent |
An SCC with a represent. More... | |
Public Member Functions | |
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 void | init (ShPtr< CG > cg, ShPtr< ValueAnalysis > va) |
Initializes the obtainer. More... | |
virtual bool | isInitialized () const |
Returns true if the obtainer has been initialized, false otherwise. More... | |
virtual std::string | getId () const =0 |
Returns the ID of the obtainer. More... | |
virtual ShPtr< CallInfo > | getCallInfo (ShPtr< CallExpr > call, ShPtr< Function > caller)=0 |
Computes and returns information about the given function call which occurs in caller. More... | |
virtual ShPtr< FuncInfo > | getFuncInfo (ShPtr< Function > func)=0 |
Computes and returns information about the given function. More... | |
Protected Types | |
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... | |
Protected Member Functions | |
CallInfoObtainer () | |
Constructs a new obtainer. More... | |
ShPtr< FuncInfoCompOrder > | getFuncInfoCompOrder (ShPtr< CG > cg) |
Computes an order in which FuncInfos should be computed. More... | |
Protected Attributes | |
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... | |
Private Member Functions | |
FuncVectorSet | computeSCCs () |
Computes all SCCs in the current call graph and returns them. More... | |
bool | callsJustComputedFuncs (ShPtr< Function > func, const FuncSet &computedFuncs) const |
Returns true if func calls just functions from computedFuncs, false otherwise. More... | |
SCCWithRepresent | findNextSCC (const FuncVectorSet &sccs, const FuncSet &computedFuncs, const FuncSet &remainingFuncs) const |
Finds a next SCC and its represent and returns them. More... | |
![]() | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable ()=default | |
~NonCopyable ()=default | |
A base class of all obtainers of information about functions and function calls.
Every function call information obtainer should subclass this class and override getCallInfo() and getFuncInfo(). Furthermore, also CallInfo should be subclassed and this subclass should have the concrete obtainer as a friend so it can set its values (remember that in C++, friendship is not inherited). If the obtainer overrides init(), then it has to call CallInfoObtainer::init().
Every time an instance of this class (or its subclass) is created or the underlying module is changed in a way that affects the call graph, the init() member function has to be called.
Instances of this class have reference object semantics.
|
protected |
Mapping of a function into its CFG.
|
protected |
Vector of sets of functions.
|
virtualdefault |
|
protected |
Constructs a new obtainer.
|
private |
Returns true
if func calls just functions from computedFuncs, false
otherwise.
|
private |
Computes all SCCs in the current call graph and returns them.
A single function is not considered to be an SCC unless it contains a call to itself (see the description of FuncInfoCompOrder).
|
private |
Finds a next SCC and its represent and returns them.
[in] | sccs | All SCCs in the call graph. |
[in] | computedFuncs | Functions that already have been included in FuncInfoCompOrder::order. |
[in] | remainingFuncs | Functions that haven't been included in FuncInfoCompOrder::order. |
|
pure virtual |
Computes and returns information about the given function call which occurs in caller.
Implemented in retdec::llvmir2hll::PessimCallInfoObtainer, and retdec::llvmir2hll::OptimCallInfoObtainer.
Returns the call graph with which the obtainer has been initialized.
If the obtainer hasn't been initialized, this function returns the null pointer.
|
pure virtual |
Computes and returns information about the given function.
Implemented in retdec::llvmir2hll::PessimCallInfoObtainer, and retdec::llvmir2hll::OptimCallInfoObtainer.
|
protected |
Computes an order in which FuncInfos should be computed.
See the description of FuncInfoCompOrder for some more information.
|
pure virtual |
Returns the ID of the obtainer.
Implemented in retdec::llvmir2hll::PessimCallInfoObtainer, and retdec::llvmir2hll::OptimCallInfoObtainer.
|
virtual |
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 in retdec::llvmir2hll::OptimCallInfoObtainer.
|
virtual |
Returns true
if the obtainer has been initialized, false
otherwise.
|
protected |
The used builder of CFGs.
|
protected |
Mapping of a function into its CFG.
|
protected |
Analysis of values.