retdec
Public Member Functions | Private Attributes | Friends | List of all members
retdec::llvmir2hll::CFG::Node Class Reference

A node of a CFG (represents a basic block). More...

#include <cfg.h>

Inheritance diagram for retdec::llvmir2hll::CFG::Node:
Inheritance graph
[legend]
Collaboration diagram for retdec::llvmir2hll::CFG::Node:
Collaboration graph
[legend]

Public Member Functions

 Node ()
 Constructs a new node. More...
 
 Node (const std::string &label)
 Constructs a new node with the selected label. More...
 
std::string getLabel () const
 Returns the node's label. More...
 
Statements Accessors
bool hasStmts () const
 Returns true if the node has some statements, false otherwise. More...
 
std::size_t getNumberOfStmts () const
 Returns the number of statements in the node. More...
 
void addStmt (ShPtr< Statement > stmt)
 Adds stmt to the statements in the node. More...
 
void replaceStmt (ShPtr< Statement > stmt, const StmtVector &stmts)
 Replaces stmt with stmts. More...
 
void removeStmt (ShPtr< Statement > stmt)
 Removes the given statement from the node. More...
 
stmt_iterator stmt_begin () const
 Returns an iterator to the first statement in the basic block. More...
 
stmt_iterator stmt_end () const
 Returns an iterator past the last statement in the basic block. More...
 
stmt_reverse_iterator stmt_rbegin () const
 Returns a constant reverse iterator to the last statement in the basic block. More...
 
stmt_reverse_iterator stmt_rend () const
 Returns a constant reverse iterator before the first statement in the basic block. More...
 
Successors Accessors
bool hasSuccs () const
 Returns true if the node has some successors, false otherwise. More...
 
bool hasSucc (ShPtr< Edge > edge) const
 Returns true if the node has the given successor, false otherwise. More...
 
std::size_t getNumberOfSuccs () const
 Returns the number of successors. More...
 
void addSucc (ShPtr< Edge > succ)
 Adds the given successor to the node. More...
 
ShPtr< EdgegetFirstSucc () const
 Returns the first successor of the node. More...
 
void removeSucc (ShPtr< Edge > succ)
 Removes the given successor from the node. More...
 
succ_iterator succ_begin () const
 Returns an iterator to the first edge leaving the node. More...
 
succ_iterator succ_end () const
 Returns an iterator past the last edge leaving the node. More...
 
Predecessors Accessors
bool hasPreds () const
 Returns true if the node has some predecessors, false otherwise. More...
 
bool hasPred (ShPtr< Edge > edge) const
 Returns true if the node has the given predecessor, false otherwise. More...
 
std::size_t getNumberOfPreds () const
 Returns the number of predecessors. More...
 
void addPred (ShPtr< Edge > pred)
 Adds the given predecessor to the node. More...
 
void removePred (ShPtr< Edge > succ)
 Removes the given predecessor from the node. More...
 
pred_iterator pred_begin () const
 Returns an iterator to the first edge entering the node. More...
 
pred_iterator pred_end () const
 Returns an iterator past the last edge entering the node. More...
 

Private Attributes

std::string label
 Label. More...
 
StmtVector stmts
 Vector of statements forming a basic block. More...
 
EdgeVector succs
 Vector of edges leaving the node. More...
 
EdgeVector preds
 Vector of edges entering the node. More...
 

Friends

class RecursiveCFGBuilder
 
class NonRecursiveCFGBuilder
 

Additional Inherited Members

- Private Member Functions inherited from retdec::utils::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Detailed Description

A node of a CFG (represents a basic block).

Instances of this class have reference object semantics.

Constructor & Destructor Documentation

◆ Node() [1/2]

retdec::llvmir2hll::CFG::Node::Node ( )

Constructs a new node.

◆ Node() [2/2]

retdec::llvmir2hll::CFG::Node::Node ( const std::string &  label)
explicit

Constructs a new node with the selected label.

Member Function Documentation

◆ addPred()

void retdec::llvmir2hll::CFG::Node::addPred ( ShPtr< Edge pred)

Adds the given predecessor to the node.

Preconditions
  • pred is non-null

◆ addStmt()

void retdec::llvmir2hll::CFG::Node::addStmt ( ShPtr< Statement stmt)

Adds stmt to the statements in the node.

Preconditions
  • stmt is non-null

◆ addSucc()

void retdec::llvmir2hll::CFG::Node::addSucc ( ShPtr< Edge succ)

Adds the given successor to the node.

Preconditions
  • succ is non-null

◆ getFirstSucc()

ShPtr< CFG::Edge > retdec::llvmir2hll::CFG::Node::getFirstSucc ( ) const

Returns the first successor of the node.

If there are no successors, the null pointer is returned.

◆ getLabel()

std::string retdec::llvmir2hll::CFG::Node::getLabel ( ) const

Returns the node's label.

If the node has no label, the label or metadata of its first statement is returned. Otherwise, if the node has no statements, the empty string is returned.

◆ getNumberOfPreds()

std::size_t retdec::llvmir2hll::CFG::Node::getNumberOfPreds ( ) const

Returns the number of predecessors.

◆ getNumberOfStmts()

std::size_t retdec::llvmir2hll::CFG::Node::getNumberOfStmts ( ) const

Returns the number of statements in the node.

◆ getNumberOfSuccs()

std::size_t retdec::llvmir2hll::CFG::Node::getNumberOfSuccs ( ) const

Returns the number of successors.

◆ hasPred()

bool retdec::llvmir2hll::CFG::Node::hasPred ( ShPtr< Edge edge) const

Returns true if the node has the given predecessor, false otherwise.

Preconditions
  • edge is non-null

◆ hasPreds()

bool retdec::llvmir2hll::CFG::Node::hasPreds ( ) const

Returns true if the node has some predecessors, false otherwise.

◆ hasStmts()

bool retdec::llvmir2hll::CFG::Node::hasStmts ( ) const

Returns true if the node has some statements, false otherwise.

◆ hasSucc()

bool retdec::llvmir2hll::CFG::Node::hasSucc ( ShPtr< Edge edge) const

Returns true if the node has the given successor, false otherwise.

Preconditions
  • edge is non-null

◆ hasSuccs()

bool retdec::llvmir2hll::CFG::Node::hasSuccs ( ) const

Returns true if the node has some successors, false otherwise.

◆ pred_begin()

CFG::pred_iterator retdec::llvmir2hll::CFG::Node::pred_begin ( ) const

Returns an iterator to the first edge entering the node.

◆ pred_end()

CFG::pred_iterator retdec::llvmir2hll::CFG::Node::pred_end ( ) const

Returns an iterator past the last edge entering the node.

◆ removePred()

void retdec::llvmir2hll::CFG::Node::removePred ( ShPtr< Edge pred)

Removes the given predecessor from the node.

If the given predecessor doesn't exist in the node, this function does nothing.

Preconditions
  • pred is non-null

◆ removeStmt()

void retdec::llvmir2hll::CFG::Node::removeStmt ( ShPtr< Statement stmt)

Removes the given statement from the node.

If there is no such statement in the node, this function does nothing.

Preconditions
  • stmt is non-null

◆ removeSucc()

void retdec::llvmir2hll::CFG::Node::removeSucc ( ShPtr< Edge succ)

Removes the given successor from the node.

If the given successor doesn't exist in the node, this function does nothing.

Preconditions
  • succ is non-null

◆ replaceStmt()

void retdec::llvmir2hll::CFG::Node::replaceStmt ( ShPtr< Statement stmt,
const StmtVector stmts 
)

Replaces stmt with stmts.

If stmt does not exist in the node, this function does nothing.

Preconditions
  • both stmt and stmts are non-null

◆ stmt_begin()

CFG::stmt_iterator retdec::llvmir2hll::CFG::Node::stmt_begin ( ) const

Returns an iterator to the first statement in the basic block.

◆ stmt_end()

CFG::stmt_iterator retdec::llvmir2hll::CFG::Node::stmt_end ( ) const

Returns an iterator past the last statement in the basic block.

◆ stmt_rbegin()

CFG::stmt_reverse_iterator retdec::llvmir2hll::CFG::Node::stmt_rbegin ( ) const

Returns a constant reverse iterator to the last statement in the basic block.

◆ stmt_rend()

CFG::stmt_reverse_iterator retdec::llvmir2hll::CFG::Node::stmt_rend ( ) const

Returns a constant reverse iterator before the first statement in the basic block.

◆ succ_begin()

CFG::succ_iterator retdec::llvmir2hll::CFG::Node::succ_begin ( ) const

Returns an iterator to the first edge leaving the node.

◆ succ_end()

CFG::succ_iterator retdec::llvmir2hll::CFG::Node::succ_end ( ) const

Returns an iterator past the last edge leaving the node.

Friends And Related Function Documentation

◆ NonRecursiveCFGBuilder

friend class NonRecursiveCFGBuilder
friend

◆ RecursiveCFGBuilder

friend class RecursiveCFGBuilder
friend

Member Data Documentation

◆ label

std::string retdec::llvmir2hll::CFG::Node::label
private

Label.

◆ preds

EdgeVector retdec::llvmir2hll::CFG::Node::preds
private

Vector of edges entering the node.

◆ stmts

StmtVector retdec::llvmir2hll::CFG::Node::stmts
private

Vector of statements forming a basic block.

◆ succs

EdgeVector retdec::llvmir2hll::CFG::Node::succs
private

Vector of edges leaving the node.


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