//===- LoopConstrainer.h ----------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_TRANSFORMS_UTILS_LOOP_CONSTRAINER_H #define LLVM_TRANSFORMS_UTILS_LOOP_CONSTRAINER_H #include "llvm/Support/Casting.h" #include "llvm/Transforms/Utils/ValueMapper.h" #include <optional> namespace llvm { class BasicBlock; class BranchInst; class DominatorTree; class IntegerType; class Loop; class LoopInfo; class PHINode; class ScalarEvolution; class SCEV; class Value; // Keeps track of the structure of a loop. This is similar to llvm::Loop, // except that it is more lightweight and can track the state of a loop through // changing and potentially invalid IR. This structure also formalizes the // kinds of loops we can deal with -- ones that have a single latch that is also // an exiting block *and* have a canonical induction variable. struct LoopStructure { … }; /// This class is used to constrain loops to run within a given iteration space. /// The algorithm this class implements is given a Loop and a range [Begin, /// End). The algorithm then tries to break out a "main loop" out of the loop /// it is given in a way that the "main loop" runs with the induction variable /// in a subset of [Begin, End). The algorithm emits appropriate pre and post /// loops to run any remaining iterations. The pre loop runs any iterations in /// which the induction variable is < Begin, and the post loop runs any /// iterations in which the induction variable is >= End. class LoopConstrainer { … }; } // namespace llvm #endif // LLVM_TRANSFORMS_UTILS_LOOP_CONSTRAINER_H