retdec
Protected Member Functions | Static Protected Member Functions | Private Attributes | List of all members
retdec::bin2llvmir::IdiomsAbstract Class Referenceabstract

Instruction idiom analysis abstract class. More...

#include <idioms_abstract.h>

Inheritance diagram for retdec::bin2llvmir::IdiomsAbstract:
Inheritance graph
[legend]

Protected Member Functions

 IdiomsAbstract ()
 
void init (llvm::Module *M, CC_compiler cc, CC_arch arch)
 
CC_compiler getCompiler () const
 
CC_arch getArch () const
 
llvm::Module * getModule () const
 
virtual bool doAnalysis (llvm::Function &, llvm::Pass *)=0
 
virtual ~IdiomsAbstract ()=default
 
bool findBranchDependingOn (llvm::BranchInst **br, llvm::BasicBlock &bb, const llvm::Value *val) const
 

Static Protected Member Functions

static void eraseInstFromBasicBlock (llvm::Value *val, llvm::BasicBlock *bb)
 
static bool isPowerOfTwo (unsigned x)
 
static bool isPowerOfTwoRepresentable (const llvm::ConstantInt *cnst)
 

Private Attributes

CC_arch m_arch
 
CC_compiler m_compiler
 
llvm::Module * m_module
 

Detailed Description

Instruction idiom analysis abstract class.

Constructor & Destructor Documentation

◆ IdiomsAbstract()

retdec::bin2llvmir::IdiomsAbstract::IdiomsAbstract ( )
protected

◆ ~IdiomsAbstract()

virtual retdec::bin2llvmir::IdiomsAbstract::~IdiomsAbstract ( )
protectedvirtualdefault

Member Function Documentation

◆ doAnalysis()

virtual bool retdec::bin2llvmir::IdiomsAbstract::doAnalysis ( llvm::Function &  ,
llvm::Pass *   
)
protectedpure virtual

◆ eraseInstFromBasicBlock()

void retdec::bin2llvmir::IdiomsAbstract::eraseInstFromBasicBlock ( llvm::Value *  val,
llvm::BasicBlock *  bb 
)
staticprotected

Look for instruction by value and erase it from module.

Parameters
valinstruction value to look for
bbBasicBlock to erase instruction from
Returns
void

◆ findBranchDependingOn()

bool retdec::bin2llvmir::IdiomsAbstract::findBranchDependingOn ( llvm::BranchInst **  br,
llvm::BasicBlock &  bb,
const llvm::Value *  val 
) const
protected

Find a branch instruction in a BasicBlock

Parameters
brfound branch instruction
bbbasic block to look for br
valValue or Instruction with branch use

◆ getArch()

CC_arch retdec::bin2llvmir::IdiomsAbstract::getArch ( ) const
inlineprotected

◆ getCompiler()

CC_compiler retdec::bin2llvmir::IdiomsAbstract::getCompiler ( ) const
inlineprotected

◆ getModule()

llvm::Module* retdec::bin2llvmir::IdiomsAbstract::getModule ( ) const
inlineprotected

◆ init()

void retdec::bin2llvmir::IdiomsAbstract::init ( llvm::Module *  M,
CC_compiler  cc,
CC_arch  arch 
)
protected

◆ isPowerOfTwo()

bool retdec::bin2llvmir::IdiomsAbstract::isPowerOfTwo ( unsigned  x)
staticprotected

Is value a power of two?

Parameters
xvalue to be check
Returns
true if value is power of two or zero

◆ isPowerOfTwoRepresentable()

bool retdec::bin2llvmir::IdiomsAbstract::isPowerOfTwoRepresentable ( const llvm::ConstantInt *  cnst)
staticprotected

Is 2^cnst representable on the bit width of cnst?

If you want to compute pow(2, cnst), always ensure that isPowerOfTwoRepresentable(cnst) returns true.

Member Data Documentation

◆ m_arch

CC_arch retdec::bin2llvmir::IdiomsAbstract::m_arch
private

◆ m_compiler

CC_compiler retdec::bin2llvmir::IdiomsAbstract::m_compiler
private

◆ m_module

llvm::Module* retdec::bin2llvmir::IdiomsAbstract::m_module
private

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