7 #ifndef RETDEC_LLVMIR2HLL_IR_STATEMENT_H
8 #define RETDEC_LLVMIR2HLL_IR_STATEMENT_H
108 void setLabel(
const std::string &newLabel);
static const uint64_t Undefined
Definition: address.h:47
A representation of a program statement.
Definition: statement.h:39
ShPtr< Statement > getUniquePredecessor() const
Returns the unique predecessor of the current statement.
Definition: statement.cpp:257
Address getAddress() const
Returns statement's address.
Definition: statement.cpp:679
bool isGotoTarget() const
Returns true if the statement is the target of a goto statement, false otherwise.
Definition: statement.cpp:687
static void removeLastStatement(ShPtr< Statement > stmts)
Removes the last statements in the sequence of statements stmts.
Definition: statement.cpp:438
static ShPtr< Statement > mergeStatements(ShPtr< Statement > stmt1, ShPtr< Statement > stmt2)
Merges the two given statements.
Definition: statement.cpp:520
void removeSuccessor()
Removes the successor of the statement (if there is any).
Definition: statement.cpp:78
void addPredecessor(ShPtr< Statement > stmt)
Adds a new predecessor: stmt.
Definition: statement.cpp:237
bool targetIsCurrentStatement(ShPtr< GotoStmt > gotoStmt) const
Does gotoStmt target the current statement?
Definition: statement.cpp:776
void setSuccessor(ShPtr< Statement > newSucc)
Sets newSucc as the current statement's successor.
Definition: statement.cpp:57
void prependStatement(ShPtr< Statement > stmt)
Prepends stmt to the statement.
Definition: statement.cpp:129
std::string getLabel() const
Returns the statement's label.
Definition: statement.cpp:734
bool hasLabel() const
Does the statement has a label set?
Definition: statement.cpp:727
void transferLabelTo(ShPtr< Statement > stmt)
Transfers the label from the current statement to the given statement.
Definition: statement.cpp:768
void setLabel(const std::string &newLabel)
Sets a new label of the statement.
Definition: statement.cpp:751
std::size_t getNumberOfPredecessors() const
Returns the number of predecessors of the current statement.
Definition: statement.cpp:247
virtual void replace(ShPtr< Expression > oldExpr, ShPtr< Expression > newExpr)=0
Replaces all occurrences of oldExpr with newExpr in the current statement.
bool containsJustGotosToCurrentStatement(const StmtSet &stmts) const
Returns true if stmts contains just goto statements to the current statement (or it is empty),...
Definition: statement.cpp:792
static bool areEqualStatements(ShPtr< Statement > stmts1, ShPtr< Statement > stmts2)
Returns true if stmts1 and stmts are equal, false otherwise.
Definition: statement.cpp:387
Statement(Address a=Address::Undefined)
Constructs a new statement.
Definition: statement.cpp:33
void removePredecessor(ShPtr< Statement > stmt)
Removes the predecessor stmt.
Definition: statement.cpp:589
static void replaceStatement(ShPtr< Statement > oldStmt, ShPtr< Statement > newStmt)
Replaces oldStmt with newStmt.
Definition: statement.cpp:462
ShPtr< Statement > succ
Successor statement.
Definition: statement.h:141
ShPtr< Statement > getSuccessor() const
Returns the successor of statement.
Definition: statement.cpp:87
std::string label
Label.
Definition: statement.h:147
Address address
Address of ASM instruction from which this statement was created from.
Definition: statement.h:150
static void removeStatementButKeepDebugComment(ShPtr< Statement > stmt)
Removes the given statement, but keeps its debug comment (if any).
Definition: statement.cpp:353
ShPtr< Statement > getParent() const
Returns the parent of the given statement.
Definition: statement.cpp:642
static bool isStatementInStatements(ShPtr< Statement > stmt, ShPtr< Statement > stmts)
Returns true if statement stmt is in the sequence of statements stmts, false otherwise.
Definition: statement.cpp:421
void removeLabel()
Removes the statement's label (if any).
Definition: statement.cpp:741
bool hasPredecessors() const
Returns true if the statement has any predecessor, false otherwise.
Definition: statement.cpp:204
predecessor_iterator predecessor_begin() const
Returns an iterator to the first predecessor (if any).
Definition: statement.cpp:267
StmtSet preds
Predecessor statements.
Definition: statement.h:144
virtual bool isCompound()=0
Returns true if the statement is a compound statement, false otherwise.
static ShPtr< Statement > getLastStatement(ShPtr< Statement > stmts)
Returns the last statement in stmts.
Definition: statement.cpp:569
void redirectGotosTo(ShPtr< Statement > stmt)
Redirects gotos to the statement to the given statement stmt.
Definition: statement.cpp:708
predecessor_iterator predecessor_end() const
Returns an iterator past the last predecessor.
Definition: statement.cpp:274
void removePredecessors(bool onlyNonGoto=false)
Removes all predecessors of the statement.
Definition: statement.cpp:601
virtual ShPtr< Expression > asExpression() const =0
Returns the statement as an expression.
StmtSet::const_iterator predecessor_iterator
Predecessor iterator.
Definition: statement.h:42
void transferLabelFrom(ShPtr< Statement > stmt)
Transfers the label from the given statement to the current statement.
Definition: statement.cpp:760
void appendStatement(ShPtr< Statement > stmt)
Appends stmt to the statement.
Definition: statement.cpp:187
static ShPtr< Statement > cloneStatements(ShPtr< Statement > stmts)
Clones the given list of statements.
Definition: statement.cpp:548
static void removeStatement(ShPtr< Statement > stmt)
Removes this statement from a block which contains it.
Definition: statement.cpp:289
bool hasSuccessor() const
Returns true if the statement has a successor, false otherwise.
Definition: statement.cpp:94
A base class of all objects a module can contain.
Definition: value.h:32
A library providing API for working with back-end IR.
std::shared_ptr< T > ShPtr
An alias for a shared pointer.
Definition: smart_ptr.h:18
std::set< ShPtr< Statement > > StmtSet
Set of statements.
Definition: types.h:69
Definition: archive_wrapper.h:19
Declarations, aliases, macros, etc. for the use of smart pointers.
Aliases for several useful types.
A base class of all objects a module can contain.