Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:08

0001 //===--- LoopUnrolling.h - Unroll loops -------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 /// \file
0009 /// This header contains the declarations of functions which are used to decide
0010 /// which loops should be completely unrolled and mark their corresponding
0011 /// CFGBlocks. It is done by tracking a stack of loops in the ProgramState. This
0012 /// way specific loops can be marked as completely unrolled. For considering a
0013 /// loop to be completely unrolled it has to fulfill the following requirements:
0014 /// - Currently only forStmts can be considered.
0015 /// - The bound has to be known.
0016 /// - The counter variable has not escaped before/in the body of the loop and
0017 ///   changed only in the increment statement corresponding to the loop. It also
0018 ///   has to be initialized by a literal in the corresponding initStmt.
0019 /// - Does not contain goto, switch and returnStmt.
0020 ///
0021 //===----------------------------------------------------------------------===//
0022 
0023 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_LOOPUNROLLING_H
0024 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_LOOPUNROLLING_H
0025 
0026 #include "clang/Analysis/CFG.h"
0027 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
0028 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
0029 namespace clang {
0030 namespace ento {
0031 
0032 /// Returns if the given State indicates that is inside a completely unrolled
0033 /// loop.
0034 bool isUnrolledState(ProgramStateRef State);
0035 
0036 /// Updates the stack of loops contained by the ProgramState.
0037 ProgramStateRef updateLoopStack(const Stmt *LoopStmt, ASTContext &ASTCtx,
0038                                 ExplodedNode* Pred, unsigned maxVisitOnPath);
0039 
0040 /// Updates the given ProgramState. In current implementation it removes the top
0041 /// element of the stack of loops.
0042 ProgramStateRef processLoopEnd(const Stmt *LoopStmt, ProgramStateRef State);
0043 
0044 } // end namespace ento
0045 } // end namespace clang
0046 
0047 #endif