retdec
Public Member Functions | Private Member Functions | Private Attributes | List of all members
retdec::llvmir2hll::LabelsHandler Class Referencefinal

Handler of labels during conversion of LLVM IR to BIR. More...

#include <labels_handler.h>

Inheritance diagram for retdec::llvmir2hll::LabelsHandler:
Inheritance graph
[legend]
Collaboration diagram for retdec::llvmir2hll::LabelsHandler:
Collaboration graph
[legend]

Public Member Functions

 LabelsHandler ()=default
 
 ~LabelsHandler ()=default
 
std::string getLabel (const llvm::BasicBlock *bb) const
 Returns the label of the given basic block. More...
 
std::string getLabel (ShPtr< Statement > stmt) const
 
void removeLabel (const std::string &label)
 Removes the given label from the set of used labels. More...
 
void setGotoTargetLabel (ShPtr< Statement > target, const llvm::BasicBlock *targetBB)
 Sets a proper label of a goto target that is in the given basic block. More...
 

Private Member Functions

std::string createLabelFor (const llvm::BasicBlock *bb, ShPtr< Statement > stmt) const
 
std::string ensureLabelIsValid (const std::string &label) const
 
std::string ensureLabelIsUnique (const std::string &label) const
 
bool labelIsUsed (const std::string &label) const
 
std::string generateNewLabel (const std::string &origLabel, std::size_t i)
 
void markLabelAsUsed (const std::string &label)
 
- Private Member Functions inherited from retdec::utils::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Private Attributes

StringSet usedLabels
 

Detailed Description

Handler of labels during conversion of LLVM IR to BIR.

Constructor & Destructor Documentation

◆ LabelsHandler()

retdec::llvmir2hll::LabelsHandler::LabelsHandler ( )
default

◆ ~LabelsHandler()

retdec::llvmir2hll::LabelsHandler::~LabelsHandler ( )
default

Member Function Documentation

◆ createLabelFor()

std::string retdec::llvmir2hll::LabelsHandler::createLabelFor ( const llvm::BasicBlock *  bb,
ShPtr< Statement stmt 
) const
private

◆ ensureLabelIsUnique()

std::string retdec::llvmir2hll::LabelsHandler::ensureLabelIsUnique ( const std::string &  label) const
private

◆ ensureLabelIsValid()

std::string retdec::llvmir2hll::LabelsHandler::ensureLabelIsValid ( const std::string &  label) const
private

◆ generateNewLabel()

std::string retdec::llvmir2hll::LabelsHandler::generateNewLabel ( const std::string &  origLabel,
std::size_t  i 
)
private

◆ getLabel() [1/2]

std::string retdec::llvmir2hll::LabelsHandler::getLabel ( const llvm::BasicBlock *  bb) const

Returns the label of the given basic block.

If there is an address in the name of bb, it is returned. Otherwise, the name of bb is returned.

◆ getLabel() [2/2]

std::string retdec::llvmir2hll::LabelsHandler::getLabel ( ShPtr< Statement stmt) const

◆ labelIsUsed()

bool retdec::llvmir2hll::LabelsHandler::labelIsUsed ( const std::string &  label) const
private

◆ markLabelAsUsed()

void retdec::llvmir2hll::LabelsHandler::markLabelAsUsed ( const std::string &  label)
private

◆ removeLabel()

void retdec::llvmir2hll::LabelsHandler::removeLabel ( const std::string &  label)

Removes the given label from the set of used labels.

◆ setGotoTargetLabel()

void retdec::llvmir2hll::LabelsHandler::setGotoTargetLabel ( ShPtr< Statement target,
const llvm::BasicBlock *  targetBB 
)

Sets a proper label of a goto target that is in the given basic block.

Member Data Documentation

◆ usedLabels

StringSet retdec::llvmir2hll::LabelsHandler::usedLabels
private

The documentation for this class was generated from the following files: