8 #ifndef RETDEC_LLVMIR2HLL_OBTAINER_CALL_INFO_OBTAINER_H
9 #define RETDEC_LLVMIR2HLL_OBTAINER_CALL_INFO_OBTAINER_H
231 virtual std::string
getId()
const = 0;
419 const FuncSet &computedFuncs)
const;
421 const FuncSet &computedFuncs,
const FuncSet &remainingFuncs)
const;
A representation of a call graph (CG).
Represents an order in which FuncInfos should be computed.
Definition: call_info_obtainer.h:291
FuncVectorSet sccs
SCCs in the call graph.
Definition: call_info_obtainer.h:300
FuncVector order
An order in which FuncInfos should be computed.
Definition: call_info_obtainer.h:297
void debugPrint() const
Emits the order to standard error.
Definition: call_info_obtainer.cpp:280
A computation of strongly connected components (SCCs) from a call graph.
Definition: call_info_obtainer.h:341
ShPtr< CG > cg
Call graph of the current module.
Definition: call_info_obtainer.h:387
CalledFuncStack stack
The 'stack' variable from the SCC algorithm.
Definition: call_info_obtainer.h:399
FuncVectorSet sccs
The set of computed SCCs.
Definition: call_info_obtainer.h:393
CalledFuncInfoMap calledFuncInfoMap
Information about every CalledFunc.
Definition: call_info_obtainer.h:402
FuncSet currentSCC
The currently computed SCC.
Definition: call_info_obtainer.h:396
std::map< ShPtr< CG::CalledFuncs >, CalledFuncInfo > CalledFuncInfoMap
Mapping of a CalledFunc into its information.
Definition: call_info_obtainer.h:377
FuncVectorSet findSCCs()
Finds and returns all strongly connected components (SCCs) in the given call graph.
Definition: call_info_obtainer.cpp:342
int index
The 'index' variable from the SCC algorithm.
Definition: call_info_obtainer.h:390
static FuncVectorSet computeSCCs(ShPtr< CG > cg)
Computes and returns all strongly connected components (SCCs) in the given call graph.
Definition: call_info_obtainer.cpp:327
std::stack< ShPtr< CG::CalledFuncs > > CalledFuncStack
Stack of CalledFuncs.
Definition: call_info_obtainer.h:363
void visit(ShPtr< CG::CalledFuncs > calledFunc, CalledFuncInfo &calledFuncInfo)
Visits the given node in the call graph.
Definition: call_info_obtainer.cpp:371
SCCComputer(ShPtr< CG > cg)
Constructs a computer.
Definition: call_info_obtainer.cpp:309
A base class of all obtainers of information about functions and function calls.
Definition: call_info_obtainer.h:218
ShPtr< Module > module
The current module.
Definition: call_info_obtainer.h:313
virtual ~CallInfoObtainer()=default
FuncVectorSet computeSCCs()
Computes all SCCs in the current call graph and returns them.
Definition: call_info_obtainer.cpp:271
FuncCFGMap funcCFGMap
Mapping of a function into its CFG.
Definition: call_info_obtainer.h:322
bool callsJustComputedFuncs(ShPtr< Function > func, const FuncSet &computedFuncs) const
Returns true if func calls just functions from computedFuncs, false otherwise.
Definition: call_info_obtainer.cpp:198
ShPtr< FuncInfoCompOrder > getFuncInfoCompOrder(ShPtr< CG > cg)
Computes an order in which FuncInfos should be computed.
Definition: call_info_obtainer.cpp:130
virtual ShPtr< FuncInfo > getFuncInfo(ShPtr< Function > func)=0
Computes and returns information about the given function.
CallInfoObtainer()
Constructs a new obtainer.
Definition: call_info_obtainer.cpp:59
SCCWithRepresent findNextSCC(const FuncVectorSet &sccs, const FuncSet &computedFuncs, const FuncSet &remainingFuncs) const
Finds a next SCC and its represent and returns them.
Definition: call_info_obtainer.cpp:223
virtual ShPtr< CallInfo > getCallInfo(ShPtr< CallExpr > call, ShPtr< Function > caller)=0
Computes and returns information about the given function call which occurs in caller.
ShPtr< ValueAnalysis > va
Analysis of values.
Definition: call_info_obtainer.h:319
ShPtr< CG > getCG() const
Returns the call graph with which the obtainer has been initialized.
Definition: call_info_obtainer.cpp:69
ShPtr< CFGBuilder > cfgBuilder
The used builder of CFGs.
Definition: call_info_obtainer.h:325
virtual std::string getId() const =0
Returns the ID of the obtainer.
virtual bool isInitialized() const
Returns true if the obtainer has been initialized, false otherwise.
Definition: call_info_obtainer.cpp:121
ShPtr< CG > cg
Call graph of the current module.
Definition: call_info_obtainer.h:316
ShPtr< CFG > getCFGForFunc(ShPtr< Function > func) const
Returns the CFG for func after the obtainer has been initialized.
Definition: call_info_obtainer.cpp:79
std::map< ShPtr< Function >, ShPtr< CFG > > FuncCFGMap
Mapping of a function into its CFG.
Definition: call_info_obtainer.h:304
std::vector< FuncSet > FuncVectorSet
Vector of sets of functions.
Definition: call_info_obtainer.h:255
virtual void init(ShPtr< CG > cg, ShPtr< ValueAnalysis > va)
Initializes the obtainer.
Definition: call_info_obtainer.cpp:101
Base class for all classes storing information about a function call.
Definition: call_info_obtainer.h:34
ShPtr< CallExpr > call
Function call for which this piece of information is computed.
Definition: call_info_obtainer.h:111
virtual bool mayBeModified(ShPtr< Variable > var) const =0
Returns true if the value of var may be changed in the call, false otherwise.
ShPtr< CallExpr > getCall() const
Returns the function call for which the piece of information has been computed.
Definition: call_info_obtainer.cpp:38
CallInfo(ShPtr< CallExpr > call)
Constructs a new piece of information about the given function call.
Definition: call_info_obtainer.cpp:31
virtual bool isAlwaysRead(ShPtr< Variable > var) const =0
Returns true if var is always read in the call, false otherwise.
virtual bool valueIsNeverChanged(ShPtr< Variable > var) const =0
Returns true if the value of var is never changed in the call, false otherwise.
virtual bool isNeverModified(ShPtr< Variable > var) const =0
Returns true if there is no assign into var in the call, false otherwise.
virtual bool isNeverRead(ShPtr< Variable > var) const =0
Returns true if var is never read in the call, false otherwise.
virtual bool isAlwaysModified(ShPtr< Variable > var) const =0
Returns true if the value of var is always changed in the call, false otherwise.
virtual bool isAlwaysModifiedBeforeRead(ShPtr< Variable > var) const =0
Returns true if the given variable is modified prior to being read in the call, false otherwise.
virtual bool mayBeRead(ShPtr< Variable > var) const =0
Returns true if var may be read in the call, false otherwise.
virtual ~CallInfo()=default
Base class for all classes storing information about a function.
Definition: call_info_obtainer.h:119
virtual bool valueIsNeverChanged(ShPtr< Variable > var) const =0
Returns true if the value of var is never changed in the call, false otherwise.
virtual bool mayBeRead(ShPtr< Variable > var) const =0
Returns true if var may be read in the function, false otherwise.
ShPtr< Function > func
Function for which this piece of information is computed.
Definition: call_info_obtainer.h:197
virtual bool isAlwaysModifiedBeforeRead(ShPtr< Variable > var) const =0
Returns true if the given variable is modified prior to being read in the function,...
ShPtr< Function > getFunc() const
Returns the function for which the piece of information has been computed.
Definition: call_info_obtainer.cpp:52
virtual bool isNeverRead(ShPtr< Variable > var) const =0
Returns true if var is never read in the function, false otherwise.
virtual bool isAlwaysRead(ShPtr< Variable > var) const =0
Returns true if var is always read in the function, false otherwise.
virtual ~FuncInfo()=default
virtual bool isAlwaysModified(ShPtr< Variable > var) const =0
Returns true if the value of var is always changed in the function, false otherwise.
virtual bool isNeverModified(ShPtr< Variable > var) const =0
Returns true if there is no assign into var in the function, false otherwise.
FuncInfo(ShPtr< Function > func)
Constructs a new piece of information about the given function.
Definition: call_info_obtainer.cpp:45
virtual bool mayBeModified(ShPtr< Variable > var) const =0
Returns true if the value of var may be changed in the function, false otherwise.
Enables shared_from_this() in the inheriting class.
Definition: smart_ptr.h:44
A mixin to make classes non-copyable.
Definition: non_copyable.h:27
A library providing API for working with back-end IR.
std::shared_ptr< T > ShPtr
An alias for a shared pointer.
Definition: smart_ptr.h:18
std::vector< ShPtr< Function > > FuncVector
Vector of functions.
Definition: types.h:105
std::set< ShPtr< Function > > FuncSet
Set of functions.
Definition: types.h:78
Definition: archive_wrapper.h:19
A mixin to make classes non-copyable.
Declarations, aliases, macros, etc. for the use of smart pointers.
Information about a CalledFunc from the SCC algorithm.
Definition: call_info_obtainer.h:368
bool onStack
Definition: call_info_obtainer.h:371
int index
Definition: call_info_obtainer.h:372
CalledFuncInfo()
Definition: call_info_obtainer.h:369
int lowlink
Definition: call_info_obtainer.h:373
An SCC with a represent.
Definition: call_info_obtainer.h:408
FuncSet scc
Definition: call_info_obtainer.h:412
SCCWithRepresent(FuncSet scc, ShPtr< Function > represent)
Definition: call_info_obtainer.h:409
ShPtr< Function > represent
Definition: call_info_obtainer.h:413
Aliases for several useful types.