LLVM  3.7.0
SimplifyIndVar.h
Go to the documentation of this file.
1 //===-- llvm/Transforms/Utils/SimplifyIndVar.h - Indvar Utils ---*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines in interface for induction variable simplification. It does
11 // not define any actual pass or policy, but provides a single function to
12 // simplify a loop's induction variables based on ScalarEvolution.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H
17 #define LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H
18 
19 #include "llvm/IR/ValueHandle.h"
21 
22 namespace llvm {
23 
24 class CastInst;
25 class DominatorTree;
26 class IVUsers;
27 class Loop;
28 class LPPassManager;
29 class PHINode;
30 class ScalarEvolution;
31 
32 /// Interface for visiting interesting IV users that are recognized but not
33 /// simplified by this utility.
34 class IVVisitor {
35 protected:
36  const DominatorTree *DT;
38 
39  virtual void anchor();
40 
41 public:
43  virtual ~IVVisitor() {}
44 
45  const DominatorTree *getDomTree() const { return DT; }
46 
49  }
52  assert(DT && "Splitting overflow intrinsics requires a DomTree.");
53  }
54 
55  virtual void visitCast(CastInst *Cast) = 0;
56 };
57 
58 /// simplifyUsersOfIV - Simplify instructions that use this induction variable
59 /// by using ScalarEvolution to analyze the IV's recurrence.
60 bool simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE, LPPassManager *LPM,
61  SmallVectorImpl<WeakVH> &Dead, IVVisitor *V = nullptr);
62 
63 /// SimplifyLoopIVs - Simplify users of induction variables within this
64 /// loop. This does not actually change or add IVs.
65 bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, LPPassManager *LPM,
66  SmallVectorImpl<WeakVH> &Dead);
67 
68 } // namespace llvm
69 
70 #endif
bool ShouldSplitOverflowIntrinsics
virtual void anchor()
const DominatorTree * getDomTree() const
Interface for visiting interesting IV users that are recognized but not simplified by this utility...
This is the base class for all instructions that perform data casts.
Definition: InstrTypes.h:389
bool shouldSplitOverflowInstrinsics() const
#define false
Definition: ConvertUTF.c:65
const DominatorTree * DT
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition: Dominators.h:67
bool simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE, LPPassManager *LPM, SmallVectorImpl< WeakVH > &Dead, IVVisitor *V=nullptr)
simplifyUsersOfIV - Simplify instructions that use this induction variable by using ScalarEvolution t...
bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, LPPassManager *LPM, SmallVectorImpl< WeakVH > &Dead)
SimplifyLoopIVs - Simplify users of induction variables within this loop.
void setSplitOverflowIntrinsics()
virtual ~IVVisitor()
virtual void visitCast(CastInst *Cast)=0