retdec
|
A converter of LLVM IR to BIR. More...
#include <llvmir2bir_converter.h>
Public Member Functions | |
ShPtr< Module > | convert (llvm::Module *llvmModule, const std::string &moduleName, ShPtr< Semantics > semantics, ShPtr< Config > config, bool enableDebug=false) |
Converts the given LLVM module into a module in BIR. More... | |
Options | |
void | setOptionStrictFPUSemantics (bool strict=true) |
Enables/disables the use of strict FPU semantics. More... | |
Static Public Member Functions | |
static ShPtr< LLVMIR2BIRConverter > | create (llvm::Pass *basePass) |
Creates a new converter. More... | |
Private Member Functions | |
LLVMIR2BIRConverter (llvm::Pass *basePass) | |
Constructs a new converter. More... | |
Global variables conversion | |
bool | isExternal (const llvm::GlobalVariable &var) const |
Determines if given LLVM global variable var is external. More... | |
bool | shouldBeConvertedAndAdded (const llvm::GlobalVariable &globVar) const |
Determines whether the given LLVM global variable globVar should be converted and added into the resulting module. More... | |
ShPtr< Variable > | convertGlobalVariable (llvm::GlobalVariable &globVar) const |
Converts the given LLVM global variable globVar into a variable in BIR. More... | |
ShPtr< Expression > | convertGlobalVariableInitializer (llvm::GlobalVariable &globVar) const |
Converts initializer of the given LLVM global variable globVar into an expression in BIR. More... | |
void | convertAndAddGlobalVariables () |
Converts all global variables of the input LLVM module and stores them into the resulting module. More... | |
Functions conversion | |
VarVector | convertFuncParams (llvm::Function &func) |
Converts parameters of the given LLVM function func into a list of function parameters in BIR. More... | |
ShPtr< Function > | convertFuncDeclaration (llvm::Function &func) |
Converts a declaration of the given LLVM function func into a function declaration in BIR. More... | |
void | updateFuncToDefinition (llvm::Function &func) |
Updates the given LLVM function func from declaration to definition. More... | |
VarVector | sortLocalVars (const VarSet &vars) const |
Sorts local variables set vars alphabetically by name. More... | |
void | generateVarDefinitions (ShPtr< Function > func) const |
Generates variable definition statements at the beginning of func. More... | |
bool | shouldBeConvertedAndAdded (const llvm::Function &func) const |
Determines whether the given LLVM function func should be converted and added into the resulting module. More... | |
void | convertAndAddFuncsDeclarations () |
Converts all functions declarations of the input LLVM module and stores them into the resulting module. More... | |
void | convertFuncsBodies () |
Goes through all functions definitions of the input LLVM module and converts their bodies and stores them into the resulting module. More... | |
Ensure that identifiers are valid | |
void | makeIdentifiersValid () |
Makes all identifiers valid by replacing invalid characters with valid characters. More... | |
void | makeGlobVarsIdentifiersValid () |
Makes all identifiers of the global variables valid. More... | |
void | makeFuncsIdentifiersValid () |
Makes all identifiers of the functions valid (function names, parameters and local variables). More... | |
void | makeFuncIdentifiersValid (ShPtr< Function > func) const |
Makes all identifiers of the given function func valid (function name, parameters and local variables). More... | |
void | makeFuncVariablesValid (ShPtr< Function > func) const |
Makes all identifiers of the local variables and parameters in the given function func valid. More... | |
![]() | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable ()=default | |
~NonCopyable ()=default | |
Private Attributes | |
llvm::Pass * | basePass |
Pass that have instantiated the converter. More... | |
bool | optionStrictFPUSemantics |
Use strict FPU semantics? More... | |
bool | enableDebug |
Should debugging messages be enabled? More... | |
ShPtr< LLVMValueConverter > | converter |
A converter from LLVM values to values in BIR. More... | |
llvm::Module * | llvmModule |
The input LLVM module. More... | |
ShPtr< Module > | resModule |
The resulting module in BIR. More... | |
UPtr< StructureConverter > | structConverter |
A converter of the LLVM function structure. More... | |
ShPtr< VariablesManager > | variablesManager |
Variables manager. More... | |
A converter of LLVM IR to BIR.
Instances of this class have reference object semantics.
|
private |
Constructs a new converter.
For more details, see create().
ShPtr< Module > retdec::llvmir2hll::LLVMIR2BIRConverter::convert | ( | llvm::Module * | llvmModule, |
const std::string & | moduleName, | ||
ShPtr< Semantics > | semantics, | ||
ShPtr< Config > | config, | ||
bool | enableDebug = false |
||
) |
Converts the given LLVM module into a module in BIR.
[in] | llvmModule | LLVM module to be converted. |
[in] | moduleName | Identifier of the resulting module. |
[in] | semantics | The used semantics. |
[in] | config | Configuration for the module. |
[in] | enableDebug | If true , debugging messages will be emitted. |
|
private |
Converts all functions declarations of the input LLVM module and stores them into the resulting module.
|
private |
Converts all global variables of the input LLVM module and stores them into the resulting module.
|
private |
Converts a declaration of the given LLVM function func into a function declaration in BIR.
|
private |
Converts parameters of the given LLVM function func into a list of function parameters in BIR.
|
private |
Goes through all functions definitions of the input LLVM module and converts their bodies and stores them into the resulting module.
|
private |
Converts the given LLVM global variable globVar into a variable in BIR.
|
private |
Converts initializer of the given LLVM global variable globVar into an expression in BIR.
|
static |
Creates a new converter.
[in] | basePass | Pass that instantiates a concrete converter. |
|
private |
Generates variable definition statements at the beginning of func.
|
private |
Determines if given LLVM global variable var is external.
|
private |
Makes all identifiers of the given function func valid (function name, parameters and local variables).
|
private |
Makes all identifiers of the functions valid (function names, parameters and local variables).
|
private |
Makes all identifiers of the local variables and parameters in the given function func valid.
|
private |
Makes all identifiers of the global variables valid.
|
private |
Makes all identifiers valid by replacing invalid characters with valid characters.
void retdec::llvmir2hll::LLVMIR2BIRConverter::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 function func should be converted and added into the resulting module.
|
private |
Determines whether the given LLVM global variable globVar should be converted and added into the resulting module.
|
private |
Sorts local variables set vars alphabetically by name.
|
private |
Updates the given LLVM function func from declaration to definition.
|
private |
Pass that have instantiated the converter.
|
private |
A converter from LLVM values to values in BIR.
|
private |
Should debugging messages be enabled?
|
private |
The input LLVM module.
|
private |
Use strict FPU semantics?
The resulting module in BIR.
|
private |
A converter of the LLVM function structure.
|
private |
Variables manager.