retdec
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
retdec::llvmir2hll::AliasAnalysis Class Referenceabstract

A base class for all alias analyses. More...

#include <alias_analysis.h>

Inheritance diagram for retdec::llvmir2hll::AliasAnalysis:
Inheritance graph
[legend]
Collaboration diagram for retdec::llvmir2hll::AliasAnalysis:
Collaboration graph
[legend]

Public Member Functions

virtual ~AliasAnalysis ()=default
 
virtual void init (ShPtr< Module > module)
 Initializes the analysis. More...
 
virtual bool isInitialized () const
 Returns true if the analysis has been initialized, false otherwise. More...
 
virtual const VarSetmayPointTo (ShPtr< Variable > var) const =0
 Returns the set of variables to which var may point to. More...
 
virtual ShPtr< VariablepointsTo (ShPtr< Variable > var) const =0
 Returns the variable to which var always points. More...
 
virtual bool mayBePointed (ShPtr< Variable > var) const =0
 Returns true if a pointer may point to var, false otherwise. More...
 
virtual std::string getId () const =0
 Returns the ID of the analysis. More...
 

Protected Member Functions

 AliasAnalysis ()=default
 

Protected Attributes

ShPtr< Modulemodule
 The current module. More...
 
VarSet globalVars
 

Additional Inherited Members

- Private Member Functions inherited from retdec::utils::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Detailed Description

A base class for all alias analyses.

Use create() to create instances. After create(), the alias analysis has to be initialized by calling init(). If this member function is not called prior to calling analysis member functions, like mayPointTo(), the behavior of these member functions is undefined.

Instances of this class have reference object semantics.

Constructor & Destructor Documentation

◆ ~AliasAnalysis()

virtual retdec::llvmir2hll::AliasAnalysis::~AliasAnalysis ( )
virtualdefault

◆ AliasAnalysis()

retdec::llvmir2hll::AliasAnalysis::AliasAnalysis ( )
protecteddefault

Member Function Documentation

◆ getId()

virtual std::string retdec::llvmir2hll::AliasAnalysis::getId ( ) const
pure virtual

Returns the ID of the analysis.

Implemented in retdec::llvmir2hll::SimpleAliasAnalysis, and retdec::llvmir2hll::BasicAliasAnalysis.

◆ init()

void retdec::llvmir2hll::AliasAnalysis::init ( ShPtr< Module module)
virtual

Initializes the analysis.

Parameters
[in]moduleThe module to be analyzed.

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 may change the results of the alias analysis.

Preconditions
  • module is non-null

Reimplemented in retdec::llvmir2hll::SimpleAliasAnalysis, and retdec::llvmir2hll::BasicAliasAnalysis.

◆ isInitialized()

bool retdec::llvmir2hll::AliasAnalysis::isInitialized ( ) const
virtual

Returns true if the analysis has been initialized, false otherwise.

◆ mayBePointed()

virtual bool retdec::llvmir2hll::AliasAnalysis::mayBePointed ( ShPtr< Variable var) const
pure virtual

Returns true if a pointer may point to var, false otherwise.

Implemented in retdec::llvmir2hll::SimpleAliasAnalysis.

◆ mayPointTo()

virtual const VarSet& retdec::llvmir2hll::AliasAnalysis::mayPointTo ( ShPtr< Variable var) const
pure virtual

Returns the set of variables to which var may point to.

If var is not a pointer, the empty set is returned. If pointsTo(var) returns a variable (non-null), then this function returns the singleton set containing the result of pointsTo(var).

If the analysis hasn't been initialized, the behavior of this member function is undefined.

Implemented in retdec::llvmir2hll::SimpleAliasAnalysis.

◆ pointsTo()

virtual ShPtr<Variable> retdec::llvmir2hll::AliasAnalysis::pointsTo ( ShPtr< Variable var) const
pure virtual

Returns the variable to which var always points.

If the variable may point to several variables or it is unknown to what the variable points to, the null pointer is returned.

If the analysis hasn't been initialized, the behavior of this member function is undefined.

Implemented in retdec::llvmir2hll::SimpleAliasAnalysis.

Member Data Documentation

◆ globalVars

VarSet retdec::llvmir2hll::AliasAnalysis::globalVars
protected

Global variables in module. This is here to speedup the analysis. By using this set, we do not have to ask module every time we need such information.

◆ module

ShPtr<Module> retdec::llvmir2hll::AliasAnalysis::module
protected

The current module.


The documentation for this class was generated from the following files: