retdec
|
A converter from LLVM instruction to expression in BIR. More...
#include <llvm_instruction_converter.h>
Public Member Functions | |
Constant expression conversion | |
ShPtr< Expression > | convertConstExprToExpression (llvm::ConstantExpr *cExpr) |
Converts the given LLVM constant expression cExpr into an expression in BIR. More... | |
Instruction conversion | |
ShPtr< Expression > | convertInstructionToExpression (llvm::Instruction *inst) |
Converts the given LLVM instruction inst into an expression in BIR. More... | |
ShPtr< CallExpr > | convertCallInstToCallExpr (llvm::CallInst &inst) |
Converts the given LLVM call instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | generateAccessToAggregateType (llvm::CompositeType *type, const ShPtr< Expression > &base, const llvm::ArrayRef< unsigned > &indices) |
Generates access to aggregate type as a part of conversion of LLVM instruction insertvalue or extractvalue. More... | |
Options | |
void | setLLVMValueConverter (ShPtr< LLVMValueConverter > conv) |
Sets converter for LLVM values to the given conv. More... | |
void | setOptionStrictFPUSemantics (bool strict=true) |
Enables/disables the use of strict FPU semantics. More... | |
Private Member Functions | |
ShPtr< Expression > | convertBinaryOpToExpression (llvm::User &inst, unsigned opcode) |
Converts the given LLVM binary operation inst with opcode opcode into an expression in BIR. More... | |
ShPtr< Expression > | convertICmpInstToExpression (llvm::User &inst, unsigned predicate) |
Converts the given LLVM icmp instruction inst with compare predicate predicate into an expression in BIR. More... | |
ShPtr< Expression > | convertFCmpInstToExpression (llvm::User &inst, unsigned predicate) |
Converts the given LLVM fcmp instruction inst with compare predicate predicate into an expression in BIR. More... | |
ShPtr< Expression > | convertSelectInstToExpression (llvm::User &inst) |
Converts the given LLVM select instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | convertExtCastInstToExpression (llvm::User &inst, ExtCastExpr::Variant variant) |
Converts the given LLVM extension cast instruction inst into an extension cast expression in BIR. More... | |
ShPtr< Expression > | convertIntToFPInstToExpression (llvm::User &inst, IntToFPCastExpr::Variant variant) |
Converts the given LLVM int to FP cast instruction inst into an int to FP cast expression in BIR. More... | |
ShPtr< Expression > | convertFPToIntInstToExpression (llvm::User &inst) |
Converts the given LLVM FP to int cast instruction inst into a FP to int cast expression in BIR. More... | |
ShPtr< Expression > | convertTruncInstToExpression (llvm::User &inst) |
Converts the given LLVM trunc instruction inst into a trunc cast expression in BIR. More... | |
template<class T > | |
ShPtr< Expression > | convertCastInstToExpression (llvm::User &inst) |
Converts the given LLVM cast instruction inst into a specified expression in BIR. More... | |
ShPtr< Expression > | convertGetElementPtrToExpression (llvm::User &inst) |
Converts the given LLVM getelementptr instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | convertGEPIndices (ShPtr< Expression > base, llvm::gep_type_iterator start, llvm::gep_type_iterator end) |
Converts indices of LLVM getelementptr instruction. More... | |
ShPtr< LLVMValueConverter > | getConverter () |
Returns the LLVMValueConverter . More... | |
![]() | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable ()=default | |
~NonCopyable ()=default | |
Private Attributes | |
WkPtr< LLVMValueConverter > | converter |
A converter from LLVM values to values in BIR. More... | |
LLVMFCmpConverter | fcmpConverter |
A converter from LLVM fcmp instruction to expression in BIR. More... | |
Instruction conversion using InstVisitor | |
class | llvm::InstVisitor< LLVMInstructionConverter, ShPtr< Expression > > |
ShPtr< Expression > | visitAddrSpaceCastInst (llvm::AddrSpaceCastInst &inst) |
Converts the given LLVM address space cast instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitBinaryOperator (llvm::BinaryOperator &inst) |
Converts the given LLVM binary operation inst into an expression in BIR. More... | |
ShPtr< Expression > | visitBitCastInst (llvm::BitCastInst &inst) |
Converts the given LLVM bitcast instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitFPExtInst (llvm::FPExtInst &inst) |
Converts the given LLVM fpext instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitSExtInst (llvm::SExtInst &inst) |
Converts the given LLVM sext instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitZExtInst (llvm::ZExtInst &inst) |
Converts the given LLVM zext instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitFPToSIInst (llvm::FPToSIInst &inst) |
Converts the given LLVM fptosi instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitFPToUIInst (llvm::FPToUIInst &inst) |
Converts the given LLVM fptoui instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitTruncInst (llvm::TruncInst &inst) |
Converts the given LLVM trunc instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitFPTruncInst (llvm::FPTruncInst &inst) |
Converts the given LLVM fptrunc instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitIntToPtrInst (llvm::IntToPtrInst &inst) |
Converts the given LLVM inttoptr instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitPtrToIntInst (llvm::PtrToIntInst &inst) |
Converts the given LLVM ptrtoint instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitSIToFPInst (llvm::SIToFPInst &inst) |
Converts the given LLVM sitofp instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitUIToFPInst (llvm::UIToFPInst &inst) |
Converts the given LLVM uitofp instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitICmpInst (llvm::ICmpInst &inst) |
Converts the given LLVM icmp instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitFCmpInst (llvm::FCmpInst &inst) |
Converts the given LLVM fcmp instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitSelectInst (llvm::SelectInst &inst) |
Converts the given LLVM select instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitGetElementPtrInst (llvm::GetElementPtrInst &inst) |
Converts the given LLVM getElementPtr instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitExtractValueInst (llvm::ExtractValueInst &inst) |
Converts the given LLVM extractvalue instruction inst into an expression in BIR. More... | |
ShPtr< Expression > | visitInstruction (llvm::Instruction &inst) |
Converts the given LLVM instruction inst into an expression in BIR. More... | |
A converter from LLVM instruction to expression in BIR.
This class converts only inlinable instructions which are converted into expressions.
LLVMValueConverter
must be set
|
private |
Converts the given LLVM binary operation inst with opcode opcode into an expression in BIR.
Note that inst type is llvm::User
instead of llvm::BinaryOperator
because this method can handle also constant binary expressions.
ShPtr< CallExpr > retdec::llvmir2hll::LLVMInstructionConverter::convertCallInstToCallExpr | ( | llvm::CallInst & | inst | ) |
Converts the given LLVM call instruction inst into an expression in BIR.
|
private |
Converts the given LLVM cast instruction inst into a specified expression in BIR.
Note that inst type is llvm::User
instead of llvm::CastInst
because this method can handle also constant cast expressions.
T | Class that represents a cast expression in BIR. |
ShPtr< Expression > retdec::llvmir2hll::LLVMInstructionConverter::convertConstExprToExpression | ( | llvm::ConstantExpr * | cExpr | ) |
Converts the given LLVM constant expression cExpr into an expression in BIR.
|
private |
Converts the given LLVM extension cast instruction inst into an extension cast expression in BIR.
Note that inst type is llvm::User
instead of llvm::CastInst
because this method can handle also constant cast expressions.
[in] | inst | Given LLVM extension cast instruction. |
[in] | variant | Variant of extension cast expression in BIR. |
|
private |
Converts the given LLVM fcmp instruction inst with compare predicate predicate into an expression in BIR.
Note that inst type is llvm::User
instead of llvm::FCmpInst
because this method can handle also constant floating-point compare expressions.
|
private |
Converts the given LLVM FP to int cast instruction inst into a FP to int cast expression in BIR.
Note that inst type is llvm::User
instead of llvm::CastInst
because this method can handle also constant cast expressions.
|
private |
Converts indices of LLVM getelementptr instruction.
[in] | base | Pointed operand of LLVM getelementptr instruction converted to an expression in BIR. |
[in] | start | First index of LLVM getelementptr instruction to be converted. |
[in] | end | End of iterator through LLVM getelementptr instruction indices. |
|
private |
Converts the given LLVM getelementptr instruction inst into an expression in BIR.
Note that inst type is llvm::User
instead of llvm::GetElementPtrInst
because this method can handle also constant getelementptr expression.
|
private |
Converts the given LLVM icmp instruction inst with compare predicate predicate into an expression in BIR.
Note that inst type is llvm::User
instead of llvm::ICmpInst
because this method can handle also constant integral compare expressions.
ShPtr< Expression > retdec::llvmir2hll::LLVMInstructionConverter::convertInstructionToExpression | ( | llvm::Instruction * | inst | ) |
Converts the given LLVM instruction inst into an expression in BIR.
|
private |
Converts the given LLVM int to FP cast instruction inst into an int to FP cast expression in BIR.
Note that inst type is llvm::User
instead of llvm::CastInst
because this method can handle also constant cast expressions.
[in] | inst | Given LLVM int to FP cast instruction. |
[in] | variant | Variant of int to FP cast expression in BIR. |
|
private |
Converts the given LLVM select instruction inst into an expression in BIR.
Note that inst type is llvm::User
instead of llvm::SelectInst
because this method can handle also constant select expressions.
|
private |
Converts the given LLVM trunc instruction inst into a trunc cast expression in BIR.
Note that inst type is llvm::User
instead of llvm::CastInst
because this method can handle also constant cast expressions.
ShPtr< Expression > retdec::llvmir2hll::LLVMInstructionConverter::generateAccessToAggregateType | ( | llvm::CompositeType * | type, |
const ShPtr< Expression > & | base, | ||
const llvm::ArrayRef< unsigned > & | indices | ||
) |
Generates access to aggregate type as a part of conversion of LLVM instruction insertvalue or extractvalue.
[in] | type | Type of aggregate type. |
[in] | base | Base expression. |
[in] | indices | Array of indices. |
|
private |
Returns the LLVMValueConverter
.
void retdec::llvmir2hll::LLVMInstructionConverter::setLLVMValueConverter | ( | ShPtr< LLVMValueConverter > | conv | ) |
Sets converter for LLVM values to the given conv.
void retdec::llvmir2hll::LLVMInstructionConverter::setOptionStrictFPUSemantics | ( | bool | strict = true | ) |
Enables/disables the use of strict FPU semantics.
[in] | strict | If true , enables the use of strict FPU semantics. If false , disables the use of strict FPU semantics. |
|
private |
Converts the given LLVM address space cast instruction inst into an expression in BIR.
|
private |
Converts the given LLVM binary operation inst into an expression in BIR.
|
private |
Converts the given LLVM bitcast instruction inst into an expression in BIR.
|
private |
Converts the given LLVM extractvalue instruction inst into an expression in BIR.
|
private |
Converts the given LLVM fcmp instruction inst into an expression in BIR.
|
private |
Converts the given LLVM fpext instruction inst into an expression in BIR.
|
private |
Converts the given LLVM fptosi instruction inst into an expression in BIR.
|
private |
Converts the given LLVM fptoui instruction inst into an expression in BIR.
|
private |
Converts the given LLVM fptrunc instruction inst into an expression in BIR.
|
private |
Converts the given LLVM getElementPtr instruction inst into an expression in BIR.
|
private |
Converts the given LLVM icmp instruction inst into an expression in BIR.
|
private |
Converts the given LLVM instruction inst into an expression in BIR.
|
private |
Converts the given LLVM inttoptr instruction inst into an expression in BIR.
|
private |
Converts the given LLVM ptrtoint instruction inst into an expression in BIR.
|
private |
Converts the given LLVM select instruction inst into an expression in BIR.
|
private |
Converts the given LLVM sext instruction inst into an expression in BIR.
|
private |
Converts the given LLVM sitofp instruction inst into an expression in BIR.
|
private |
Converts the given LLVM trunc instruction inst into an expression in BIR.
|
private |
Converts the given LLVM uitofp instruction inst into an expression in BIR.
|
private |
Converts the given LLVM zext instruction inst into an expression in BIR.
|
friend |
|
private |
A converter from LLVM values to values in BIR.
|
private |
A converter from LLVM fcmp instruction to expression in BIR.