retdec
|
A converter of LLVM basic blocks. More...
#include <basic_block_converter.h>
Public Member Functions | |
BasicBlockConverter (ShPtr< LLVMValueConverter > converter, ShPtr< LabelsHandler > labelsHandler) | |
Constructs a new basic block converter. More... | |
ShPtr< Statement > | convert (llvm::BasicBlock &bb) |
Converts the given LLVM basic block bb into a sequence of statements in BIR. More... | |
Private Member Functions | |
bool | shouldBeConverted (const llvm::Instruction &inst) const |
Determines whether the given LLVM instruction inst should be converted by BasicBlockConverter. More... | |
ShPtr< Statement > | convertInstructionsOf (llvm::BasicBlock &bb) |
Converts instruction of the given LLVM basic block bb into a sequence of statements in BIR. More... | |
ShPtr< Statement > | visitCallInst (llvm::CallInst &inst) |
Converts the given LLVM call instruction inst into a statement in BIR. More... | |
ShPtr< Statement > | visitInsertValueInst (llvm::InsertValueInst &inst) |
Converts the given LLVM insertvalue instruction inst into two assign statements in BIR. More... | |
ShPtr< Statement > | visitLoadInst (llvm::LoadInst &inst) |
Converts the given LLVM load instruction inst into an assign statement in BIR. More... | |
ShPtr< Statement > | visitReturnInst (llvm::ReturnInst &inst) |
Converts the given LLVM return instruction inst into a statement in BIR. More... | |
ShPtr< Statement > | visitStoreInst (llvm::StoreInst &inst) |
Converts the given LLVM store instruction inst into an assign statement in BIR. More... | |
ShPtr< Statement > | visitUnreachableInst (llvm::UnreachableInst &inst) |
Converts the given LLVM unreachable instruction inst into an unreachable statement in BIR. More... | |
ShPtr< Statement > | visitInstruction (llvm::Instruction &inst) |
Converts the given LLVM instruction inst into an assign statement in BIR. This method converts other instructions. More... | |
ShPtr< Statement > | generateAssignOfPrevValForInsertValueInst (llvm::InsertValueInst &inst) |
Generates assignment of previous value to aggregate type expression for the given LLVM insertvalue instruction inst. More... | |
![]() | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable ()=default | |
~NonCopyable ()=default | |
Private Attributes | |
ShPtr< LLVMValueConverter > | converter |
A converter from LLVM values to values in BIR. More... | |
ShPtr< LabelsHandler > | labelsHandler |
A handler of labels. More... | |
Friends | |
class | llvm::InstVisitor< BasicBlockConverter, ShPtr< Statement > > |
A converter of LLVM basic blocks.
This class converts only not inlinable instructions which are converted into statements.
retdec::llvmir2hll::BasicBlockConverter::BasicBlockConverter | ( | ShPtr< LLVMValueConverter > | converter, |
ShPtr< LabelsHandler > | labelsHandler | ||
) |
Constructs a new basic block converter.
[in] | converter | A converter from LLVM values to values in BIR. |
[in] | labelsHandler | A handler of labels. |
Converts the given LLVM basic block bb into a sequence of statements in BIR.
|
private |
Converts instruction of the given LLVM basic block bb into a sequence of statements in BIR.
|
private |
Generates assignment of previous value to aggregate type expression for the given LLVM insertvalue instruction inst.
|
private |
Determines whether the given LLVM instruction inst should be converted by BasicBlockConverter.
Following instruction shouldn't be converted:
|
private |
Converts the given LLVM call instruction inst into a statement in BIR.
If function result is used somewhere, an assign statement will be created. Otherwise, a call statement will be created.
|
private |
Converts the given LLVM insertvalue instruction inst into two assign statements in BIR.
The reason why this instruction is converted into two statements is that this instruction does two operations: Inserts value to the specified position of the composite and returns new composite with inserted value (original composite remains unchanged).
Example code in LLVM IR:
The example code is converted into following code in BIR:
|
private |
Converts the given LLVM instruction inst into an assign statement in BIR. This method converts other instructions.
|
private |
Converts the given LLVM load instruction inst into an assign statement in BIR.
|
private |
Converts the given LLVM return instruction inst into a statement in BIR.
|
private |
Converts the given LLVM store instruction inst into an assign statement in BIR.
|
private |
Converts the given LLVM unreachable
instruction inst into an unreachable statement in BIR.
|
friend |
|
private |
A converter from LLVM values to values in BIR.
|
private |
A handler of labels.