retdec
|
Managing of local variables created during conversion of LLVM functions to BIR. More...
#include <variables_manager.h>
Public Member Functions | |
VariablesManager (ShPtr< Module > resModule) | |
Constructs a new variables manager. More... | |
void | reset () |
Resets local variables in the variables manager. More... | |
void | addGlobalValVarPair (llvm::Value *val, ShPtr< Variable > var) |
ShPtr< Variable > | getVarByValue (llvm::Value *val) |
Returns the variable representing LLVM value val. More... | |
VarSet | getLocalVars () const |
Returns set of all local variables. More... | |
Private Member Functions | |
void | assignNameToValue (llvm::Value *val) const |
Assigns new name from generator to LLVM value. More... | |
ShPtr< Variable > | getGlobalVar (llvm::Value *val) |
ShPtr< Variable > | getOrCreateLocalVar (llvm::Value *val) |
Returns the local variable for val. More... | |
![]() | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable ()=default | |
~NonCopyable ()=default | |
Private Attributes | |
std::unordered_map< llvm::Value *, ShPtr< Variable > > | localVarsMap |
Mapping of a LLVM value to an existing variable. More... | |
std::unordered_map< llvm::Value *, ShPtr< Variable > > | globalVarsMap |
Mapping of LLVM functions and globals to existing variables. More... | |
UPtr< VarNameGen > | varNameGen |
Variable names generator. More... | |
ShPtr< Module > | resModule |
The resulting module in BIR. More... | |
Managing of local variables created during conversion of LLVM functions to BIR.
Constructs a new variables manager.
void retdec::llvmir2hll::VariablesManager::addGlobalValVarPair | ( | llvm::Value * | val, |
ShPtr< Variable > | var | ||
) |
|
private |
Assigns new name from generator to LLVM value.
VarSet retdec::llvmir2hll::VariablesManager::getLocalVars | ( | ) | const |
Returns set of all local variables.
|
private |
Returns the local variable for val.
If local variable doesn't exist, new one will be created. Type of new created variable is unknown.
Returns the variable representing LLVM value val.
If variable doesn't have it's own name, a new one is generated and assigned to it. The reason is, that all variables in BIR have to be named.
void retdec::llvmir2hll::VariablesManager::reset | ( | ) |
Resets local variables in the variables manager.
Also resets generator of new variable names.
|
private |
Mapping of LLVM functions and globals to existing variables.
|
private |
Mapping of a LLVM value to an existing variable.
|
private |
Variable names generator.