1 //===- llvm/Transforms/Utils/LoopPeel.h ----- Peeling utilities -*- 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 file defines some loop peeling utilities. It does not define any
10 // actual pass or policy.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_TRANSFORMS_UTILS_LOOPPEEL_H
15 #define LLVM_TRANSFORMS_UTILS_LOOPPEEL_H
16 
17 #include "llvm/Analysis/TargetTransformInfo.h"
18 
19 namespace llvm {
20 
21 bool canPeel(Loop *L);
22 
23 bool peelLoop(Loop *L, unsigned PeelCount, LoopInfo *LI, ScalarEvolution *SE,
24               DominatorTree *DT, AssumptionCache *AC, bool PreserveLCSSA);
25 
26 TargetTransformInfo::PeelingPreferences
27 gatherPeelingPreferences(Loop *L, ScalarEvolution &SE,
28                          const TargetTransformInfo &TTI,
29                          Optional<bool> UserAllowPeeling,
30                          Optional<bool> UserAllowProfileBasedPeeling,
31                          bool UnrollingSpecficValues = false);
32 
33 void computePeelCount(Loop *L, unsigned LoopSize,
34                       TargetTransformInfo::PeelingPreferences &PP,
35                       unsigned &TripCount, ScalarEvolution &SE,
36                       unsigned Threshold = UINT_MAX);
37 
38 } // end namespace llvm
39 
40 #endif // LLVM_TRANSFORMS_UTILS_LOOPPEEL_H
41