7 #ifndef RETDEC_LLVMIR2HLL_LLVM_LLVMIR2BIR_CONVERTER_H
8 #define RETDEC_LLVMIR2HLL_LLVM_LLVMIR2BIR_CONVERTER_H
32 class LLVMValueConverter;
35 class StructureConverter;
37 class VariablesManager;
62 bool isExternal(
const llvm::GlobalVariable &var)
const;
66 llvm::GlobalVariable &globVar)
const;
A converter of LLVM IR to BIR.
Definition: llvmir2bir_converter.h:44
VarVector sortLocalVars(const VarSet &vars) const
Sorts local variables set vars alphabetically by name.
Definition: llvmir2bir_converter.cpp:220
ShPtr< Variable > convertGlobalVariable(llvm::GlobalVariable &globVar) const
Converts the given LLVM global variable globVar into a variable in BIR.
Definition: llvmir2bir_converter.cpp:118
void generateVarDefinitions(ShPtr< Function > func) const
Generates variable definition statements at the beginning of func.
Definition: llvmir2bir_converter.cpp:229
void updateFuncToDefinition(llvm::Function &func)
Updates the given LLVM function func from declaration to definition.
Definition: llvmir2bir_converter.cpp:198
ShPtr< VariablesManager > variablesManager
Variables manager.
Definition: llvmir2bir_converter.h:114
void makeIdentifiersValid()
Makes all identifiers valid by replacing invalid characters with valid characters.
Definition: llvmir2bir_converter.cpp:278
bool shouldBeConvertedAndAdded(const llvm::GlobalVariable &globVar) const
Determines whether the given LLVM global variable globVar should be converted and added into the resu...
Definition: llvmir2bir_converter.cpp:110
ShPtr< Function > convertFuncDeclaration(llvm::Function &func)
Converts a declaration of the given LLVM function func into a function declaration in BIR.
Definition: llvmir2bir_converter.cpp:181
void setOptionStrictFPUSemantics(bool strict=true)
Enables/disables the use of strict FPU semantics.
Definition: llvmir2bir_converter.cpp:57
LLVMIR2BIRConverter(llvm::Pass *basePass)
Constructs a new converter.
Definition: llvmir2bir_converter.cpp:34
VarVector convertFuncParams(llvm::Function &func)
Converts parameters of the given LLVM function func into a list of function parameters in BIR.
Definition: llvmir2bir_converter.cpp:168
void convertFuncsBodies()
Goes through all functions definitions of the input LLVM module and converts their bodies and stores ...
Definition: llvmir2bir_converter.cpp:266
void convertAndAddFuncsDeclarations()
Converts all functions declarations of the input LLVM module and stores them into the resulting modul...
Definition: llvmir2bir_converter.cpp:254
void makeFuncVariablesValid(ShPtr< Function > func) const
Makes all identifiers of the local variables and parameters in the given function func valid.
Definition: llvmir2bir_converter.cpp:315
UPtr< StructureConverter > structConverter
A converter of the LLVM function structure.
Definition: llvmir2bir_converter.h:111
ShPtr< LLVMValueConverter > converter
A converter from LLVM values to values in BIR.
Definition: llvmir2bir_converter.h:102
llvm::Pass * basePass
Pass that have instantiated the converter.
Definition: llvmir2bir_converter.h:93
static ShPtr< LLVMIR2BIRConverter > create(llvm::Pass *basePass)
Creates a new converter.
Definition: llvmir2bir_converter.cpp:47
ShPtr< Expression > convertGlobalVariableInitializer(llvm::GlobalVariable &globVar) const
Converts initializer of the given LLVM global variable globVar into an expression in BIR.
Definition: llvmir2bir_converter.cpp:135
void makeGlobVarsIdentifiersValid()
Makes all identifiers of the global variables valid.
Definition: llvmir2bir_converter.cpp:286
void makeFuncsIdentifiersValid()
Makes all identifiers of the functions valid (function names, parameters and local variables).
Definition: llvmir2bir_converter.cpp:296
void makeFuncIdentifiersValid(ShPtr< Function > func) const
Makes all identifiers of the given function func valid (function name, parameters and local variables...
Definition: llvmir2bir_converter.cpp:306
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.
Definition: llvmir2bir_converter.cpp:73
bool isExternal(const llvm::GlobalVariable &var) const
Determines if given LLVM global variable var is external.
Definition: llvmir2bir_converter.cpp:100
ShPtr< Module > resModule
The resulting module in BIR.
Definition: llvmir2bir_converter.h:108
void convertAndAddGlobalVariables()
Converts all global variables of the input LLVM module and stores them into the resulting module.
Definition: llvmir2bir_converter.cpp:149
llvm::Module * llvmModule
The input LLVM module.
Definition: llvmir2bir_converter.h:105
bool enableDebug
Should debugging messages be enabled?
Definition: llvmir2bir_converter.h:99
bool optionStrictFPUSemantics
Use strict FPU semantics?
Definition: llvmir2bir_converter.h:96
A mixin to make classes non-copyable.
Definition: non_copyable.h:27
A base class for all converters of LLVM IR to BIR.
Definition: itanium_ast_ctypes_parser.h:12
A library providing API for working with back-end IR.
std::shared_ptr< T > ShPtr
An alias for a shared pointer.
Definition: smart_ptr.h:18
std::unique_ptr< T > UPtr
An alias for a unique pointer.
Definition: smart_ptr.h:26
std::set< ShPtr< Variable > > VarSet
Set of variables.
Definition: types.h:57
std::vector< ShPtr< Variable > > VarVector
Vector of variables.
Definition: types.h:93
Definition: archive_wrapper.h:19
A mixin to make classes non-copyable.
Declarations, aliases, macros, etc. for the use of smart pointers.
Aliases for several useful types.