7 #ifndef RETDEC_LLVMIR2HLL_LLVM_LLVMIR2BIR_CONVERTER_LLVM_INSTRUCTION_CONVERTER_H
8 #define RETDEC_LLVMIR2HLL_LLVM_LLVMIR2BIR_CONVERTER_LLVM_INSTRUCTION_CONVERTER_H
10 #include <llvm/ADT/ArrayRef.h>
11 #include <llvm/IR/GetElementPtrTypeIterator.h>
12 #include <llvm/IR/InstVisitor.h>
23 class AddrSpaceCastInst;
29 class ExtractValueInst;
35 class GetElementPtrInst;
55 class LLVMValueConverter;
67 private llvm::InstVisitor<LLVMInstructionConverter, ShPtr<Expression>> {
131 llvm::gep_type_iterator start, llvm::gep_type_iterator end);
A base class of all expressions.
Definition: expression.h:23
Variant
Variants of the cast.
Definition: ext_cast_expr.h:29
Variant
Variants of the integer to floating point casts.
Definition: int_to_fp_cast_expr.h:29
A converter from LLVM fcmp instruction to expression in BIR.
Definition: llvm_fcmp_converter.h:28
A converter from LLVM instruction to expression in BIR.
Definition: llvm_instruction_converter.h:67
ShPtr< Expression > visitBinaryOperator(llvm::BinaryOperator &inst)
Converts the given LLVM binary operation inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:237
ShPtr< Expression > visitSelectInst(llvm::SelectInst &inst)
Converts the given LLVM select instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:358
ShPtr< Expression > convertInstructionToExpression(llvm::Instruction *inst)
Converts the given LLVM instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:153
ShPtr< Expression > convertICmpInstToExpression(llvm::User &inst, unsigned predicate)
Converts the given LLVM icmp instruction inst with compare predicate predicate into an expression in ...
Definition: llvm_instruction_converter.cpp:474
void setLLVMValueConverter(ShPtr< LLVMValueConverter > conv)
Sets converter for LLVM values to the given conv.
Definition: llvm_instruction_converter.cpp:207
ShPtr< Expression > visitGetElementPtrInst(llvm::GetElementPtrInst &inst)
Converts the given LLVM getElementPtr instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:366
ShPtr< Expression > convertFPToIntInstToExpression(llvm::User &inst)
Converts the given LLVM FP to int cast instruction inst into a FP to int cast expression in BIR.
Definition: llvm_instruction_converter.cpp:601
ShPtr< Expression > convertSelectInstToExpression(llvm::User &inst)
Converts the given LLVM select instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:552
ShPtr< Expression > visitIntToPtrInst(llvm::IntToPtrInst &inst)
Converts the given LLVM inttoptr instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:310
ShPtr< Expression > convertGEPIndices(ShPtr< Expression > base, llvm::gep_type_iterator start, llvm::gep_type_iterator end)
Converts indices of LLVM getelementptr instruction.
Definition: llvm_instruction_converter.cpp:678
ShPtr< Expression > visitSIToFPInst(llvm::SIToFPInst &inst)
Converts the given LLVM sitofp instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:326
ShPtr< Expression > convertConstExprToExpression(llvm::ConstantExpr *cExpr)
Converts the given LLVM constant expression cExpr into an expression in BIR.
Definition: llvm_instruction_converter.cpp:74
ShPtr< Expression > visitFPTruncInst(llvm::FPTruncInst &inst)
Converts the given LLVM fptrunc instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:302
ShPtr< Expression > visitTruncInst(llvm::TruncInst &inst)
Converts the given LLVM trunc instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:294
ShPtr< Expression > generateAccessToAggregateType(llvm::CompositeType *type, const ShPtr< Expression > &base, const llvm::ArrayRef< unsigned > &indices)
Generates access to aggregate type as a part of conversion of LLVM instruction insertvalue or extract...
Definition: llvm_instruction_converter.cpp:181
ShPtr< Expression > visitExtractValueInst(llvm::ExtractValueInst &inst)
Converts the given LLVM extractvalue instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:375
ShPtr< Expression > visitPtrToIntInst(llvm::PtrToIntInst &inst)
Converts the given LLVM ptrtoint instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:318
ShPtr< Expression > convertBinaryOpToExpression(llvm::User &inst, unsigned opcode)
Converts the given LLVM binary operation inst with opcode opcode into an expression in BIR.
Definition: llvm_instruction_converter.cpp:397
void setOptionStrictFPUSemantics(bool strict=true)
Enables/disables the use of strict FPU semantics.
Definition: llvm_instruction_converter.cpp:219
ShPtr< Expression > visitFPToUIInst(llvm::FPToUIInst &inst)
Converts the given LLVM fptoui instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:286
ShPtr< Expression > convertExtCastInstToExpression(llvm::User &inst, ExtCastExpr::Variant variant)
Converts the given LLVM extension cast instruction inst into an extension cast expression in BIR.
Definition: llvm_instruction_converter.cpp:570
ShPtr< Expression > visitFPToSIInst(llvm::FPToSIInst &inst)
Converts the given LLVM fptosi instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:278
ShPtr< Expression > visitFPExtInst(llvm::FPExtInst &inst)
Converts the given LLVM fpext instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:254
ShPtr< Expression > visitAddrSpaceCastInst(llvm::AddrSpaceCastInst &inst)
Converts the given LLVM address space cast instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:227
ShPtr< Expression > visitICmpInst(llvm::ICmpInst &inst)
Converts the given LLVM icmp instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:342
ShPtr< Expression > convertFCmpInstToExpression(llvm::User &inst, unsigned predicate)
Converts the given LLVM fcmp instruction inst with compare predicate predicate into an expression in ...
Definition: llvm_instruction_converter.cpp:533
ShPtr< Expression > convertIntToFPInstToExpression(llvm::User &inst, IntToFPCastExpr::Variant variant)
Converts the given LLVM int to FP cast instruction inst into an int to FP cast expression in BIR.
Definition: llvm_instruction_converter.cpp:587
ShPtr< Expression > visitZExtInst(llvm::ZExtInst &inst)
Converts the given LLVM zext instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:270
ShPtr< Expression > visitBitCastInst(llvm::BitCastInst &inst)
Converts the given LLVM bitcast instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:246
ShPtr< Expression > visitSExtInst(llvm::SExtInst &inst)
Converts the given LLVM sext instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:262
ShPtr< LLVMValueConverter > getConverter()
Returns the LLVMValueConverter.
Definition: llvm_instruction_converter.cpp:697
LLVMFCmpConverter fcmpConverter
A converter from LLVM fcmp instruction to expression in BIR.
Definition: llvm_instruction_converter.h:139
ShPtr< Expression > convertTruncInstToExpression(llvm::User &inst)
Converts the given LLVM trunc instruction inst into a trunc cast expression in BIR.
Definition: llvm_instruction_converter.cpp:613
ShPtr< Expression > visitInstruction(llvm::Instruction &inst)
Converts the given LLVM instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:385
ShPtr< Expression > convertGetElementPtrToExpression(llvm::User &inst)
Converts the given LLVM getelementptr instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:641
ShPtr< CallExpr > convertCallInstToCallExpr(llvm::CallInst &inst)
Converts the given LLVM call instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:163
ShPtr< Expression > visitUIToFPInst(llvm::UIToFPInst &inst)
Converts the given LLVM uitofp instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:334
ShPtr< Expression > convertCastInstToExpression(llvm::User &inst)
Converts the given LLVM cast instruction inst into a specified expression in BIR.
Definition: llvm_instruction_converter.cpp:628
ShPtr< Expression > visitFCmpInst(llvm::FCmpInst &inst)
Converts the given LLVM fcmp instruction inst into an expression in BIR.
Definition: llvm_instruction_converter.cpp:350
WkPtr< LLVMValueConverter > converter
A converter from LLVM values to values in BIR.
Definition: llvm_instruction_converter.h:136
A mixin to make classes non-copyable.
Definition: non_copyable.h:27
The casting of LLVM instructions: FPExt, SExt, ZExt.
The casting of LLVM instructions SItoFP/UItoFP.
A converter from LLVM fcmp instruction to expression in BIR.
Definition: itanium_ast_ctypes_parser.h:12
A library providing API for working with back-end IR.
std::weak_ptr< T > WkPtr
An alias for a weak pointer.
Definition: smart_ptr.h:22
std::shared_ptr< T > ShPtr
An alias for a shared pointer.
Definition: smart_ptr.h:18
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.