7 #ifndef RETDEC_LLVMIR2HLL_UTILS_IR_H
8 #define RETDEC_LLVMIR2HLL_UTILS_IR_H
31 ShPtr<Expression>
skipCasts(ShPtr<Expression> expr);
32 ShPtr<Expression>
skipDerefs(ShPtr<Expression> expr);
35 ShPtr<Expression>
getLhs(ShPtr<Statement> stmt);
36 ShPtr<Expression>
getRhs(ShPtr<Statement> stmt);
38 ShPtr<Function> func =
nullptr);
40 ShPtr<Expression> expr, ShPtr<Statement> stmt);
42 bool isLoop(ShPtr<Statement> stmt);
50 bool isDefOfVar(ShPtr<Statement> stmt, ShPtr<Variable> var);
52 ShPtr<Expression> init =
nullptr);
54 ShPtr<Function> func, ShPtr<Expression> init =
nullptr);
ShPtr< Module > module
The current module.
Definition: hll_writer.cpp:100
A library providing API for working with back-end IR.
ShPtr< Statement > getInnermostLoop(ShPtr< Statement > stmt)
Returns the innermost loop inside which stmt is.
Definition: ir.cpp:440
ShPtr< Statement > skipEmptyStmts(ShPtr< Statement > stmts)
Skips empty statements in stmt.
Definition: ir.cpp:129
ShPtr< Expression > skipCasts(ShPtr< Expression > expr)
Skips casts in the given expression and returns the first non-cast expression.
Definition: ir.cpp:141
std::vector< ShPtr< Statement > > StmtVector
Vector of statements.
Definition: types.h:96
void replaceVarWithExprInStmt(ShPtr< Variable > var, ShPtr< Expression > expr, ShPtr< Statement > stmt)
Replaces var with expr in stmt.
Definition: ir.cpp:288
bool isLoop(ShPtr< Statement > stmt)
Returns true if stmt is a loop, false otherwise.
Definition: ir.cpp:351
bool isInfiniteEmptyLoop(ShPtr< WhileLoopStmt > stmt)
Returns true if the given loop is both empty and infinite, false otherwise.
Definition: ir.cpp:367
ShPtr< Statement > getInnermostLoopOrSwitch(ShPtr< Statement > stmt)
Returns the innermost loop or switch inside which stmt is.
Definition: ir.cpp:458
std::vector< ShPtr< Function > > FuncVector
Vector of functions.
Definition: types.h:105
ShPtr< Function > getCalledFunc(ShPtr< CallExpr > callExpr, ShPtr< Module > module)
Returns the function called in call.
Definition: ir.cpp:396
bool endsWithRetOrUnreach(ShPtr< Statement > stmts)
Returns true if the sequence of statements stmts ends with a return or unreachable statement,...
Definition: ir.cpp:167
void convertGlobalVarToLocalVarInFunc(ShPtr< Variable > var, ShPtr< Function > func, ShPtr< Expression > init=nullptr)
Converts the given global variable var into a local variable of func, possibly with the given initial...
Definition: ir.cpp:534
bool isWhileTrueLoop(ShPtr< WhileLoopStmt > stmt)
Returns true if stmt is a while True loop, false otherwise.
Definition: ir.cpp:386
bool isDefOfVar(ShPtr< Statement > stmt, ShPtr< Variable > var)
Returns true if stmt defines var, false otherwise.
Definition: ir.cpp:475
void sortByName(FuncVector &vec)
Sorts the given vector by the name of its elements (case-insensitively).
Definition: ir.cpp:96
bool isCallByPointer(ShPtr< Expression > callExpr, ShPtr< Module > module)
Returns true if the given call expression callExpr in the given module is indirect (by a pointer),...
Definition: ir.cpp:421
std::vector< VarInitPair > VarInitPairVector
List of variables with their initializers.
Definition: types.h:117
StmtVector removeVarDefOrAssignStatement(ShPtr< Statement > stmt, ShPtr< Function > func=nullptr)
Removes the given variable definition/assignment statement.
Definition: ir.cpp:231
bool isVarDefOrAssignStmt(ShPtr< Statement > stmt)
Returns true if stmt is a VarDefStmt or AssignStmt, false otherwise.
Definition: ir.cpp:342
ShPtr< Expression > getLhs(ShPtr< Statement > stmt)
Returns the left-hand side of the given variable definition/assign statement.
Definition: ir.cpp:183
void addLocalVarToFunc(ShPtr< Variable > var, ShPtr< Function > func, ShPtr< Expression > init=nullptr)
Adds var as a new local variable of func, possibly with an initializer init.
Definition: ir.cpp:498
ShPtr< Expression > getRhs(ShPtr< Statement > stmt)
Returns the right-hand side of the given variable definition/assign statement.
Definition: ir.cpp:202
std::string getNameOfCalledFunc(ShPtr< CallExpr > callExpr, ShPtr< Module > module)
Returns the name of the function called in call.
Definition: ir.cpp:412
std::vector< ShPtr< Variable > > VarVector
Vector of variables.
Definition: types.h:93
ShPtr< Expression > skipDerefs(ShPtr< Expression > expr)
Skips dereferences in the given expression and returns the first non-dereference expression.
Definition: ir.cpp:149
ShPtr< Expression > skipAddresses(ShPtr< Expression > expr)
Skips addresses in the given expression and returns the first non-address expression.
Definition: ir.cpp:157
Definition: archive_wrapper.h:19
Aliases for several useful types.