retdec
|
A converter from LLVM values to values in BIR. More...
#include <llvm_value_converter.h>
Public Member Functions | |
Value conversion | |
ShPtr< Expression > | convertValueToDerefExpression (llvm::Value *value) |
Converts the given LLVM value value into a dereference expression in BIR. More... | |
ShPtr< Expression > | convertValueToExpression (llvm::Value *value) |
Converts the given LLVM value value into an expression in BIR. More... | |
ShPtr< Expression > | convertValueToExpressionDirectly (llvm::Value *value) |
Converts the given LLVM value value into an expression in BIR. More... | |
ShPtr< Variable > | convertValueToVariable (llvm::Value *value) |
Converts the given LLVM value value into a variable in BIR. More... | |
Type conversion | |
ShPtr< Type > | convertType (const llvm::Type *type) |
Converts the given LLVM type type into a type in BIR. More... | |
Constant conversion | |
bool | storesStringLiteral (const llvm::GlobalVariable &globVar) const |
Determines whether the given LLVM global variable globVar stores string literal. More... | |
ShPtr< Expression > | convertConstantToExpression (llvm::Constant *constant) |
Converts the given LLVM constant constant 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, ShPtr< Expression > base, llvm::ArrayRef< unsigned > indices) |
Generates access to aggregate type as a part of conversion of LLVM instruction insertvalue or extractvalue. More... | |
Options | |
void | setOptionStrictFPUSemantics (bool strict=true) |
Enables/disables the use of strict FPU semantics. More... | |
Static Public Member Functions | |
static ShPtr< LLVMValueConverter > | create (ShPtr< Module > resModule, ShPtr< VariablesManager > varManager) |
Creates a new converter. More... | |
Private Member Functions | |
LLVMValueConverter (ShPtr< Module > resModule, ShPtr< VariablesManager > varManager) | |
Constructs a new converter. More... | |
bool | isConsideredAsPointer (const llvm::Value *value) const |
Determines whether the given LLVM value is considered as pointer variable. More... | |
bool | shouldBeConvertedAsConst (const llvm::Constant *constant) const |
Determines whether the given LLVM constant constant should be converted into BIR as constant. More... | |
bool | shouldBeConvertedAsInst (const llvm::Instruction *inst) const |
Determines whether the given LLVM instruction inst should be converted into BIR as instruction. More... | |
ShPtr< Type > | determineVariableType (llvm::Value *value) |
Determines the correct type of the given LLVM value value. More... | |
![]() | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable ()=default | |
~NonCopyable ()=default | |
Private Attributes | |
ShPtr< LLVMTypeConverter > | typeConverter |
A converter from LLVM type to type in BIR. More... | |
ShPtr< LLVMInstructionConverter > | instConverter |
A converter from LLVM instruction to expression in BIR. More... | |
UPtr< LLVMConstantConverter > | constConverter |
A converter from LLVM constant to constant in BIR. More... | |
ShPtr< VariablesManager > | variablesManager |
Variables manager. More... | |
ShPtr< Module > | resModule |
The resulting module in BIR. More... | |
A converter from LLVM values to values in BIR.
|
private |
Constructs a new converter.
[in] | resModule | The resulting module in BIR. |
[in] | varManager | Variable manager managing local variables of currently converted function. |
ShPtr< CallExpr > retdec::llvmir2hll::LLVMValueConverter::convertCallInstToCallExpr | ( | llvm::CallInst & | inst | ) |
Converts the given LLVM call instruction inst into an expression in BIR.
ShPtr< Expression > retdec::llvmir2hll::LLVMValueConverter::convertConstantToExpression | ( | llvm::Constant * | constant | ) |
Converts the given LLVM constant constant into an expression in BIR.
ShPtr< Expression > retdec::llvmir2hll::LLVMValueConverter::convertInstructionToExpression | ( | llvm::Instruction * | inst | ) |
Converts the given LLVM instruction inst into an expression in BIR.
Converts the given LLVM type type into a type in BIR.
ShPtr< Expression > retdec::llvmir2hll::LLVMValueConverter::convertValueToDerefExpression | ( | llvm::Value * | value | ) |
Converts the given LLVM value value into a dereference expression in BIR.
If converted value value is not considered as pointer, it returns value converted into an expression in BIR as is (value is not converted into dereference expression).
ShPtr< Expression > retdec::llvmir2hll::LLVMValueConverter::convertValueToExpression | ( | llvm::Value * | value | ) |
Converts the given LLVM value value into an expression in BIR.
If converted value value is not considered as pointer, it returns address operand of value converted to an expression in BIR (pointer to value must be created).
ShPtr< Expression > retdec::llvmir2hll::LLVMValueConverter::convertValueToExpressionDirectly | ( | llvm::Value * | value | ) |
Converts the given LLVM value value into an expression in BIR.
ShPtr< Variable > retdec::llvmir2hll::LLVMValueConverter::convertValueToVariable | ( | llvm::Value * | value | ) |
Converts the given LLVM value value into a variable in BIR.
|
static |
Creates a new converter.
[in] | resModule | The resulting module in BIR. |
[in] | varManager | Variable manager managing local variables of currently converted function. |
|
private |
Determines the correct type of the given LLVM value value.
ShPtr< Expression > retdec::llvmir2hll::LLVMValueConverter::generateAccessToAggregateType | ( | llvm::CompositeType * | type, |
ShPtr< Expression > | base, | ||
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 |
Determines whether the given LLVM value is considered as pointer variable.
void retdec::llvmir2hll::LLVMValueConverter::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 |
Determines whether the given LLVM constant constant should be converted into BIR as constant.
|
private |
Determines whether the given LLVM instruction inst should be converted into BIR as instruction.
This means that we don't want into convert all LLVM instruction into BIR instructions. Some instruction may be converted e.g. into variables.
bool retdec::llvmir2hll::LLVMValueConverter::storesStringLiteral | ( | const llvm::GlobalVariable & | globVar | ) | const |
Determines whether the given LLVM global variable globVar stores string literal.
|
private |
A converter from LLVM constant to constant in BIR.
|
private |
A converter from LLVM instruction to expression in BIR.
The resulting module in BIR.
|
private |
A converter from LLVM type to type in BIR.
|
private |
Variables manager.