LLVM: include/llvm/Transforms/Utils/LoopConstrainer.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_TRANSFORMS_UTILS_LOOP_CONSTRAINER_H

10#define LLVM_TRANSFORMS_UTILS_LOOP_CONSTRAINER_H

11

14#include

15

16namespace llvm {

17

28

29

30

31

32

33

35 const char *Tag = "";

36

39

40

41

44 unsigned LatchBrExitIdx = std::numeric_limits::max();

45

46

47

48

49

50

51

52

53

54

62

64

67 Result.Tag = Tag;

80 return Result;

81 }

82

83 static std::optional

85};

86

87

88

89

90

91

92

93

94

96public:

97

98

99

100

101

102

103

108

109private:

110

111 struct ClonedLoop {

112

113 std::vector<BasicBlock *> Blocks;

114

115

117

118

120 };

121

122

123

124 struct RewrittenRangeInfo {

127 std::vector<PHINode *> PHIValuesAtPseudoExit;

128 PHINode *IndVarEnd = nullptr;

129

130 RewrittenRangeInfo() = default;

131 };

132

133

134

135

136

137 void cloneLoop(ClonedLoop &CLResult, const char *Tag) const;

138

139

140

141 Loop *createClonedLoopStructure(Loop *Original, Loop *Parent,

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165 RewrittenRangeInfo

166 changeIterationSpaceEnd(const LoopStructure &LS, BasicBlock *Preheader,

167 Value *ExitLoopAt,

168 BasicBlock *ContinuationBlock) const;

169

170

171

172 BasicBlock *createPreheader(const LoopStructure &LS, BasicBlock *OldPreheader,

173 const char *Tag) const;

174

175

176

177

178

179 void rewriteIncomingValuesForPHIs(

180 LoopStructure &LS, BasicBlock *ContinuationBlockAndPreheader,

181 const LoopConstrainer::RewrittenRangeInfo &RRI) const;

182

183

184

185

186

188

189

190 Function &F;

191 LLVMContext &Ctx;

192 ScalarEvolution &SE;

193 DominatorTree &DT;

194 LoopInfo &LI;

195 function_ref<void(Loop *, bool)> LPMAddNewLoop;

196

197

198 Loop &OriginalLoop;

199

200 BasicBlock *OriginalPreheader = nullptr;

201

202

203

204 BasicBlock *MainLoopPreheader = nullptr;

205

206

207 Type *RangeTy;

208

209

210

211 LoopStructure MainLoopStructure;

212

213 SubRanges SR;

214

215public:

217 function_ref<void(Loop *, bool)> LPMAddNewLoop,

218 const LoopStructure &LS, ScalarEvolution &SE,

219 DominatorTree &DT, Type *T, SubRanges SR);

220

221

222 bool run();

223};

224}

225

226#endif

LLVM Basic Block Representation.

Conditional or Unconditional Branch instruction.

Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.

Class to represent integer types.

LoopConstrainer(Loop &L, LoopInfo &LI, function_ref< void(Loop *, bool)> LPMAddNewLoop, const LoopStructure &LS, ScalarEvolution &SE, DominatorTree &DT, Type *T, SubRanges SR)

Represents a single loop in the control flow graph.

This class represents an analyzed expression in the program.

The main scalar evolution driver.

LLVM Value Representation.

This is an optimization pass for GlobalISel generic memory operations.

ArrayRef(const T &OneElt) -> ArrayRef< T >

ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

Definition LoopConstrainer.h:104

std::optional< const SCEV * > LowLimit

Definition LoopConstrainer.h:105

std::optional< const SCEV * > HighLimit

Definition LoopConstrainer.h:106

Definition LoopConstrainer.h:34

BasicBlock * LatchExit

Definition LoopConstrainer.h:43

Value * IndVarBase

Definition LoopConstrainer.h:55

LoopStructure map(M Map) const

Definition LoopConstrainer.h:65

BranchInst * LatchBr

Definition LoopConstrainer.h:42

Value * IndVarStart

Definition LoopConstrainer.h:56

const char * Tag

Definition LoopConstrainer.h:35

bool IndVarIncreasing

Definition LoopConstrainer.h:59

IntegerType * ExitCountTy

Definition LoopConstrainer.h:61

BasicBlock * Header

Definition LoopConstrainer.h:37

bool IsSignedPredicate

Definition LoopConstrainer.h:60

BasicBlock * Latch

Definition LoopConstrainer.h:38

Value * LoopExitAt

Definition LoopConstrainer.h:58

Value * IndVarStep

Definition LoopConstrainer.h:57

static std::optional< LoopStructure > parseLoopStructure(ScalarEvolution &, Loop &, bool, const char *&)

unsigned LatchBrExitIdx

Definition LoopConstrainer.h:44