Supportive functions regarding LLVM IR.
More...
#include <llvm_support.h>
|
static std::size_t | getNumberOfUniquePredecessors (llvm::BasicBlock *bb) |
| Returns the number of unique predecessors of the given basic block. More...
|
|
static bool | isPredecessorOf (llvm::BasicBlock *pred, llvm::BasicBlock *bb) |
| Returns true if pred is a predecessor of bb, false otherwise. More...
|
|
static bool | isInlineAsm (const llvm::Instruction *i) |
| Returns true if the given LLVM instruction i is a call to an inline asm chunk, false otherwise. More...
|
|
static bool | isInlinableInst (const llvm::Instruction *i) |
| Returns true if the given LLVM instruction i is inlinable, false otherwise. More...
|
|
static const llvm::AllocaInst * | isDirectAlloca (const llvm::Value *v) |
| If v is a direct alloca, it returns v converted into an alloca instruction. Otherwise, the null pointer is returned. More...
|
|
static bool | endsWithRetOrUnreach (llvm::BasicBlock *bb, bool indirect=true) |
| Returns true if bb (indirectly) ends with a return or an unreachable instruction, false otherwise. More...
|
|
static bool | endWithSameUncondBranch (llvm::BasicBlock *bb1, llvm::BasicBlock *bb2) |
| Returns true if both bb1 and bb2 end with an unconditional branch to the same basic block, false otherwise. More...
|
|
static const llvm::Module * | getModuleFromValue (const llvm::Value *v) |
| Returns the LLVM module corresponding to the given value v. More...
|
|
static std::string | getBasicBlockLabelPrefix () |
| Returns the used prefix of labels in LLVM IR. More...
|
|
static bool | isBasicBlockLabel (const std::string &str) |
| Returns true if str has the format of a basic block's label in LLVM IR, false otherwise. More...
|
|
static Address | getInstAddress (const llvm::Instruction *i) |
| Get instruction's ASM address from metadata. More...
|
|
Supportive functions regarding LLVM IR.
This class implements the "static helper" (or "library") design pattern (it has just static functions and no instances can be created).
◆ BasicBlockSet
◆ LLVMSupport() [1/2]
retdec::llvmir2hll::LLVMSupport::LLVMSupport |
( |
| ) |
|
|
delete |
◆ LLVMSupport() [2/2]
retdec::llvmir2hll::LLVMSupport::LLVMSupport |
( |
const LLVMSupport & |
| ) |
|
|
delete |
◆ ~LLVMSupport()
retdec::llvmir2hll::LLVMSupport::~LLVMSupport |
( |
| ) |
|
|
delete |
◆ endsWithRetOrUnreach()
bool retdec::llvmir2hll::LLVMSupport::endsWithRetOrUnreach |
( |
llvm::BasicBlock * |
bb, |
|
|
bool |
indirect = true |
|
) |
| |
|
static |
Returns true
if bb (indirectly) ends with a return or an unreachable instruction, false
otherwise.
- Parameters
-
[in] | bb | Basic block to be examined. |
[in] | indirect | If true and bb ends with an unconditional branch b , this function is called recursively on the target of b . |
This function is not reentrant.
- Preconditions
-
◆ endsWithRetOrUnreachImpl()
bool retdec::llvmir2hll::LLVMSupport::endsWithRetOrUnreachImpl |
( |
llvm::BasicBlock * |
bb, |
|
|
bool |
indirect |
|
) |
| |
|
staticprivate |
Implementation of endsWithRetOrUnreach().
It doesn't clear endsWithRetOrUnreachBBSet on return. This function may recursively calls itself. This function is not reentrant.
- Preconditions
- bb is non-null
- endsWithRetOrUnreachBBSet has been cleared
◆ endWithSameUncondBranch()
bool retdec::llvmir2hll::LLVMSupport::endWithSameUncondBranch |
( |
llvm::BasicBlock * |
bb1, |
|
|
llvm::BasicBlock * |
bb2 |
|
) |
| |
|
static |
Returns true
if both bb1 and bb2 end with an unconditional branch to the same basic block, false
otherwise.
◆ getBasicBlockLabelPrefix()
std::string retdec::llvmir2hll::LLVMSupport::getBasicBlockLabelPrefix |
( |
| ) |
|
|
static |
Returns the used prefix of labels in LLVM IR.
◆ getInstAddress()
Address retdec::llvmir2hll::LLVMSupport::getInstAddress |
( |
const llvm::Instruction * |
i | ) |
|
|
static |
Get instruction's ASM address from metadata.
- Returns
- Address, or undefined address if metadata entry is not present.
- Preconditions
-
◆ getModuleFromValue()
const llvm::Module * retdec::llvmir2hll::LLVMSupport::getModuleFromValue |
( |
const llvm::Value * |
v | ) |
|
|
static |
Returns the LLVM module corresponding to the given value v.
If the module cannot be obtained, this function returns the null pointer.
- Preconditions
-
◆ getNumberOfUniquePredecessors()
std::size_t retdec::llvmir2hll::LLVMSupport::getNumberOfUniquePredecessors |
( |
llvm::BasicBlock * |
bb | ) |
|
|
static |
Returns the number of unique predecessors of the given basic block.
- Preconditions
-
◆ isBasicBlockLabel()
bool retdec::llvmir2hll::LLVMSupport::isBasicBlockLabel |
( |
const std::string & |
str | ) |
|
|
static |
Returns true
if str has the format of a basic block's label in LLVM IR, false
otherwise.
◆ isDirectAlloca()
const llvm::AllocaInst * retdec::llvmir2hll::LLVMSupport::isDirectAlloca |
( |
const llvm::Value * |
v | ) |
|
|
static |
If v is a direct alloca, it returns v converted into an alloca instruction. Otherwise, the null pointer is returned.
Define fixed sized allocas in the entry block as direct variables which are accessed with the & operator.
- Preconditions
-
◆ isInlinableInst()
bool retdec::llvmir2hll::LLVMSupport::isInlinableInst |
( |
const llvm::Instruction * |
i | ) |
|
|
static |
Returns true
if the given LLVM instruction i is inlinable, false
otherwise.
We attempt to inline instructions into their uses to reduce the generated "trees" as much as possible. To do this, we have to consistently decide what is acceptable to inline.
- Preconditions
-
◆ isInlineAsm()
bool retdec::llvmir2hll::LLVMSupport::isInlineAsm |
( |
const llvm::Instruction * |
i | ) |
|
|
static |
Returns true
if the given LLVM instruction i is a call to an inline asm chunk, false
otherwise.
- Preconditions
-
◆ isPredecessorOf()
bool retdec::llvmir2hll::LLVMSupport::isPredecessorOf |
( |
llvm::BasicBlock * |
pred, |
|
|
llvm::BasicBlock * |
bb |
|
) |
| |
|
static |
Returns true
if pred is a predecessor of bb, false
otherwise.
- Preconditions
- both pred and bb are non-null
◆ operator=()
◆ endsWithRetOrUnreachBBSet
The documentation for this class was generated from the following files:
- /var/cache/acbs/build/acbs.6bu6osb6/retdec/include/retdec/llvmir2hll/llvm/llvm_support.h
- /var/cache/acbs/build/acbs.6bu6osb6/retdec/src/llvmir2hll/llvm/llvm_support.cpp