LLVM: include/llvm/Analysis/CFG.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_ANALYSIS_CFG_H

15#define LLVM_ANALYSIS_CFG_H

16

20#include

21

22namespace llvm {

23

30

31

32

33

34

35

38 SmallVectorImpl<std::pair<const BasicBlock *, const BasicBlock *>> &Result);

39

40

41

42

45

46

47

48

49

51 bool AllowIdenticalEdges = false);

53 bool AllowIdenticalEdges = false);

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

74

75

76

77

78

79

80

85

86

87

88

89

90

91

92

93

94

99

100

101

102

103

104

105

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147template <class NodeT, class RPOTraversalT, class LoopInfoT,

150

151

152

153 auto isProperBackedge = [&](NodeT Src, NodeT Dst) {

154 for (const auto *Lp = LI.getLoopFor(Src); Lp; Lp = Lp->getParentLoop()) {

155 if (Lp->getHeader() == Dst)

156 return true;

157 }

158 return false;

159 };

160

162 for (NodeT Node : RPOTraversal) {

164 for (NodeT Succ : make_range(GT::child_begin(Node), GT::child_end(Node))) {

165

166 if (!Visited.count(Succ))

167 continue;

168

169

170

171 if (!isProperBackedge(Node, Succ))

172 return true;

173 }

174 }

175

176 return false;

177}

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

196 const BasicBlock &Dest);

197

198

199

201}

202

203#endif

This file defines the little GraphTraits template class that should be specialized by classes that...

This file defines the SmallPtrSet class.

LLVM Basic Block Representation.

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

A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...

size_type count(ConstPtrType Ptr) const

count - Return 1 if the specified pointer is in the set, 0 otherwise.

std::pair< iterator, bool > insert(PtrType Ptr)

Inserts Ptr if and only if there is no element in the container equal to Ptr.

SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI unsigned GetSuccessorNumber(const BasicBlock *BB, const BasicBlock *Succ)

Search for the specified successor of basic block BB and return its position in the terminator instru...

LLVM_ABI bool isPotentiallyReachableFromMany(SmallVectorImpl< BasicBlock * > &Worklist, const BasicBlock *StopBB, const SmallPtrSetImpl< BasicBlock * > *ExclusionSet, const DominatorTree *DT=nullptr, const LoopInfo *LI=nullptr)

Determine whether there is at least one path from a block in 'Worklist' to 'StopBB' without passing t...

iterator_range< T > make_range(T x, T y)

Convenience function for iterating over sub-ranges.

bool containsIrreducibleCFG(RPOTraversalT &RPOTraversal, const LoopInfoT &LI)

Return true if the control flow in RPOTraversal is irreducible.

Definition CFG.h:149

LLVM_ABI bool isManyPotentiallyReachableFromMany(SmallVectorImpl< BasicBlock * > &Worklist, const SmallPtrSetImpl< const BasicBlock * > &StopSet, const SmallPtrSetImpl< BasicBlock * > *ExclusionSet, const DominatorTree *DT=nullptr, const LoopInfo *LI=nullptr)

Determine whether there is a potentially a path from at least one block in 'Worklist' to at least one...

LLVM_ABI bool isCriticalEdge(const Instruction *TI, unsigned SuccNum, bool AllowIdenticalEdges=false)

Return true if the specified edge is a critical edge.

LLVM_ABI bool isPresplitCoroSuspendExitEdge(const BasicBlock &Src, const BasicBlock &Dest)

LLVM_ABI void FindFunctionBackedges(const Function &F, SmallVectorImpl< std::pair< const BasicBlock *, const BasicBlock * > > &Result)

Analyze the specified function to find all of the loop backedges in the function and return them.

LLVM_ABI bool canReturn(const Function &F)

Return true if there is at least a path through which F can return, false if there is no such path.

LLVM_ABI bool isPotentiallyReachable(const Instruction *From, const Instruction *To, const SmallPtrSetImpl< BasicBlock * > *ExclusionSet=nullptr, const DominatorTree *DT=nullptr, const LoopInfo *LI=nullptr)

Determine whether instruction 'To' is reachable from 'From', without passing through any blocks in Ex...