LLVM: lib/Analysis/RegionInfo.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

15#ifndef NDEBUG

17#endif

20#include "llvm/Config/llvm-config.h"

24

25using namespace llvm;

26

27#define DEBUG_TYPE "region"

28

29namespace llvm {

30

34

35}

36

38STATISTIC(numSimpleRegions, "The # of simple regions");

39

40

41

44 "verify-region-info",

46 cl::desc("Verify region info (time consuming)"));

47

51 cl::desc("style of printing regions"),

53 clEnumValN(Region::PrintNone, "none", "print no details"),

55 "print regions in detail with block_iterator"),

57 "print regions in detail with element_iterator")));

58

59

60

61

62

67

68}

69

71

72

73

74

75

77

79

82

83

87}

88

90 ++numRegions;

91

92

93 if (R->isSimple())

94 ++numSimpleRegions;

95}

96

99 DT = DT_;

100 PDT = PDT_;

101 DF = DF_;

102

103 TopLevelRegion = new Region(&F.getEntryBlock(), nullptr,

104 this, DT, nullptr);

106 calculate(F);

107}

108

109#ifndef NDEBUG

111

113#endif

114

115

116

117

118

121}

122

124

127

128 auto DT = &getAnalysis().getDomTree();

129 auto PDT = &getAnalysis().getPostDomTree();

130 auto DF = &getAnalysis().getDominanceFrontier();

131

133 return false;

134}

135

138}

139

142}

143

149}

150

153}

154

155#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

158}

159#endif

160

162

164 "Detect single entry single exit regions", true, true)

170

171

172

173

174

175namespace llvm {

176

179 }

180

181}

182

183

184

185

186

188

194

196 return RI;

197}

198

201

204 OS << "Region Tree for function: " << F.getName() << "\n";

206

208}

209

213

215}

#define clEnumValN(ENUMVAL, FLAGNAME, DESC)

#define LLVM_DUMP_METHOD

Mark debug helper function definitions like dump() that should not be stripped from debug builds.

static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")

#define INITIALIZE_PASS_DEPENDENCY(depName)

#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)

#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)

static cl::opt< bool, true > VerifyRegionInfoX("verify-region-info", cl::location(RegionInfoBase< RegionTraits< Function > >::VerifyRegionInfo), cl::desc("Verify region info (time consuming)"))

static cl::opt< Region::PrintStyle, true > printStyleX("print-region-style", cl::location(RegionInfo::printStyle), cl::Hidden, cl::desc("style of printing regions"), cl::values(clEnumValN(Region::PrintNone, "none", "print no details"), clEnumValN(Region::PrintBB, "bb", "print regions in detail with block_iterator"), clEnumValN(Region::PrintRN, "rn", "print regions in detail with element_iterator")))

This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...

#define STATISTIC(VARNAME, DESC)

This templated class represents "all analyses that operate over " (e....

API to communicate dependencies between analyses during invalidation.

A container for analyses that lazily runs them and caches their results.

PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)

Get the result of an analysis pass for a given IR unit.

Represent the analysis usage information of a pass.

AnalysisUsage & addRequired()

void setPreservesAll()

Set by analyses that do not transform their input at all.

AnalysisUsage & addRequiredTransitive()

LLVM Basic Block Representation.

Represents analyses that only rely on functions' control flow.

Analysis pass which computes a DominanceFrontier.

Analysis pass which computes a DominatorTree.

Legacy analysis pass which computes a DominatorTree.

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

FunctionPass class - This class is used to implement most global optimizations.

A Module instance is used to store all the information related to an LLVM module.

static PassRegistry * getPassRegistry()

getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...

Analysis pass which computes a PostDominatorTree.

PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...

A set of analyses that are preserved following a run of a transformation pass.

static PreservedAnalyses all()

Construct a special preserved set that preserves all passes.

PreservedAnalysisChecker getChecker() const

Build a checker for this PreservedAnalyses and the specified analysis type.

A single entry single exit Region.

Analysis pass that exposes the RegionInfo for a function.

RegionInfo run(Function &F, FunctionAnalysisManager &AM)

Analysis that detects all canonical Regions.

void print(raw_ostream &OS) const

void verifyAnalysis() const

void releaseMemory() override

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...

bool runOnFunction(Function &F) override

runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.

~RegionInfoPass() override

void verifyAnalysis() const override

verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...

void print(raw_ostream &OS, const Module *) const override

print - Print out the internal state of the pass.

void getAnalysisUsage(AnalysisUsage &AU) const override

getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)

RegionInfoPrinterPass(raw_ostream &OS)

void view()

Opens a viewer to show the GraphViz visualization of the regions.

void viewOnly()

Opens a viewer to show the GraphViz visualization of this region without instructions in the BasicBlo...

void recalculate(Function &F, DominatorTree *DT, PostDominatorTree *PDT, DominanceFrontier *DF)

void updateStatistics(Region *R) final

bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)

Handle invalidation explicitly.

A RegionNode represents a subregion or a BasicBlock that is part of a Region.

Region(BasicBlock *Entry, BasicBlock *Exit, RegionInfo *RI, DominatorTree *DT, Region *Parent=nullptr)

This class implements an extremely fast bulk output stream that can only output to a stream.

ValuesClass values(OptsTy... Options)

Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...

LocationClass< Ty > location(Ty &L)

This is an optimization pass for GlobalISel generic memory operations.

Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr)

void initializeRegionInfoPassPass(PassRegistry &)

FunctionPass * createRegionInfoPass()

void viewRegion(llvm::RegionInfo *RI)

Open a viewer to display the GraphViz vizualization of the analysis result.

void viewRegionOnly(llvm::RegionInfo *RI)

Open a viewer to display the GraphViz vizualization of the analysis result.

A special type used by analysis passes to provide an address that identifies that particular analysis...

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)