clang 10.0.0git

LoopUnrolling.h
Go to the documentation of this file.
1 //===--- LoopUnrolling.h - Unroll loops -------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// This header contains the declarations of functions which are used to decide
10 /// which loops should be completely unrolled and mark their corresponding
11 /// CFGBlocks. It is done by tracking a stack of loops in the ProgramState. This
12 /// way specific loops can be marked as completely unrolled. For considering a
13 /// loop to be completely unrolled it has to fulfill the following requirements:
14 /// - Currently only forStmts can be considered.
15 /// - The bound has to be known.
16 /// - The counter variable has not escaped before/in the body of the loop and
17 /// changed only in the increment statement corresponding to the loop. It also
18 /// has to be initialized by a literal in the corresponding initStmt.
19 /// - Does not contain goto, switch and returnStmt.
20 ///
21 ///
22 //===----------------------------------------------------------------------===//
23
24 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_LOOPUNROLLING_H
25 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_LOOPUNROLLING_H
26
27 #include "clang/Analysis/CFG.h"
28 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
29 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
30 namespace clang {
31 namespace ento {
32 class AnalysisManager;
33
34 /// Returns if the given State indicates that is inside a completely unrolled
35 /// loop.
36 bool isUnrolledState(ProgramStateRef State);
37
38 /// Updates the stack of loops contained by the ProgramState.
39 ProgramStateRef updateLoopStack(const Stmt *LoopStmt, ASTContext &ASTCtx,
40 ExplodedNode* Pred, unsigned maxVisitOnPath);
41
42 /// Updates the given ProgramState. In current implementation it removes the top
43 /// element of the stack of loops.
44 ProgramStateRef processLoopEnd(const Stmt *LoopStmt, ProgramStateRef State);
45
46 } // end namespace ento
47 } // end namespace clang
48
49 #endif
ento
clang::ento::ProgramStateRef
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
Definition: ProgramState_Fwd.h:37
clang::ento::isUnrolledState
bool isUnrolledState(ProgramStateRef State)
Returns if the given State indicates that is inside a completely unrolled loop.
Definition: LoopUnrolling.cpp:288
State
LineState State
Definition: UnwrappedLineFormatter.cpp:932
clang::ento::processLoopEnd
ProgramStateRef processLoopEnd(const Stmt *LoopStmt, ProgramStateRef State)
Updates the given ProgramState.
Definition: LoopUnrolling.cpp:75
clang::ento::updateLoopStack
ProgramStateRef updateLoopStack(const Stmt *LoopStmt, ASTContext &ASTCtx, ExplodedNode *Pred, unsigned maxVisitOnPath)
Updates the stack of loops contained by the ProgramState.
Definition: LoopUnrolling.cpp:251
ProgramState.h
ExplodedGraph.h
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
CFG.h