clang 24.0.0git
LoopUnrolling.h File Reference

This header contains the declarations of functions which are used to decide which loops should be completely unrolled and mark their corresponding CFGBlocks. More...

Go to the source code of this file.

Classes

struct  clang::ento::LoopUnrollingCache
 Memoizes the part of the loop unrolling decision that depends only on the AST of a loop (as opposed to the path that reached it), so that the AST matchers run once per loop instead of every time a path enters the loop. More...
struct  clang::ento::LoopUnrollingCache::Entry

Namespaces

namespace  clang
 Top level wrappers for InstallAPI frontend operations.
namespace  clang::ento

Functions

bool clang::ento::isUnrolledState (ProgramStateRef State)
 Returns if the given State indicates that is inside a completely unrolled loop.
ProgramStateRef clang::ento::updateLoopStack (const Stmt *LoopStmt, ASTContext &ASTCtx, ExplodedNode *Pred, unsigned maxVisitOnPath, LoopUnrollingCache &Cache)
 Updates the stack of loops contained by the ProgramState.
ProgramStateRef clang::ento::processLoopEnd (const Stmt *LoopStmt, ProgramStateRef State)
 Updates the given ProgramState.

Detailed Description

This header contains the declarations of functions which are used to decide which loops should be completely unrolled and mark their corresponding CFGBlocks.

It is done by tracking a stack of loops in the ProgramState. This way specific loops can be marked as completely unrolled. For considering a loop to be completely unrolled it has to fulfill the following requirements:

  • Currently only forStmts can be considered.
  • The bound has to be known.
  • The counter variable has not escaped before/in the body of the loop and changed only in the increment statement corresponding to the loop. It also has to be initialized by a literal in the corresponding initStmt.
  • Does not contain goto, switch and returnStmt.

Definition in file LoopUnrolling.h.