1 //===- llvm/LinkAllPasses.h ------------ Reference All Passes ---*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This header file pulls in all transformation and analysis passes for tools
10 // like opt and bugpoint that need this functionality.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LINKALLPASSES_H
15 #define LLVM_LINKALLPASSES_H
17 #include "llvm/ADT/Statistic.h"
18 #include "llvm/Analysis/AliasAnalysisEvaluator.h"
19 #include "llvm/Analysis/AliasSetTracker.h"
20 #include "llvm/Analysis/BasicAliasAnalysis.h"
21 #include "llvm/Analysis/CFLAndersAliasAnalysis.h"
22 #include "llvm/Analysis/CFLSteensAliasAnalysis.h"
23 #include "llvm/Analysis/CallPrinter.h"
24 #include "llvm/Analysis/DomPrinter.h"
25 #include "llvm/Analysis/GlobalsModRef.h"
26 #include "llvm/Analysis/IntervalPartition.h"
27 #include "llvm/Analysis/Lint.h"
28 #include "llvm/Analysis/Passes.h"
29 #include "llvm/Analysis/PostDominators.h"
30 #include "llvm/Analysis/RegionPass.h"
31 #include "llvm/Analysis/RegionPrinter.h"
32 #include "llvm/Analysis/ScalarEvolution.h"
33 #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
34 #include "llvm/Analysis/ScopedNoAliasAA.h"
35 #include "llvm/Analysis/TargetLibraryInfo.h"
36 #include "llvm/Analysis/TypeBasedAliasAnalysis.h"
37 #include "llvm/CodeGen/Passes.h"
38 #include "llvm/IR/Function.h"
39 #include "llvm/IR/IRPrintingPasses.h"
40 #include "llvm/Support/Valgrind.h"
41 #include "llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h"
42 #include "llvm/Transforms/IPO.h"
43 #include "llvm/Transforms/IPO/AlwaysInliner.h"
44 #include "llvm/Transforms/IPO/Attributor.h"
45 #include "llvm/Transforms/IPO/FunctionAttrs.h"
46 #include "llvm/Transforms/InstCombine/InstCombine.h"
47 #include "llvm/Transforms/Instrumentation.h"
48 #include "llvm/Transforms/Instrumentation/BoundsChecking.h"
49 #include "llvm/Transforms/ObjCARC.h"
50 #include "llvm/Transforms/Scalar.h"
51 #include "llvm/Transforms/Scalar/GVN.h"
52 #include "llvm/Transforms/Scalar/InstSimplifyPass.h"
53 #include "llvm/Transforms/Scalar/Scalarizer.h"
54 #include "llvm/Transforms/Utils.h"
55 #include "llvm/Transforms/Utils/SymbolRewriter.h"
56 #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
57 #include "llvm/Transforms/Vectorize.h"
61 struct ForcePassLinking
{
63 // We must reference the passes in such a way that compilers will not
64 // delete it all as dead code, even with whole program optimization,
65 // yet is effectively a NO-OP. As the compiler isn't smart enough
66 // to know that getenv() never returns -1, this will do the job.
67 if (std::getenv("bar") != (char*) -1)
70 (void) llvm::createAAEvalPass();
71 (void) llvm::createAggressiveDCEPass();
72 (void) llvm::createAggressiveInstCombinerPass();
73 (void) llvm::createBitTrackingDCEPass();
74 (void) llvm::createArgumentPromotionPass();
75 (void) llvm::createAlignmentFromAssumptionsPass();
76 (void) llvm::createBasicAAWrapperPass();
77 (void) llvm::createSCEVAAWrapperPass();
78 (void) llvm::createTypeBasedAAWrapperPass();
79 (void) llvm::createScopedNoAliasAAWrapperPass();
80 (void) llvm::createBoundsCheckingLegacyPass();
81 (void) llvm::createBreakCriticalEdgesPass();
82 (void) llvm::createCallGraphDOTPrinterPass();
83 (void) llvm::createCallGraphViewerPass();
84 (void) llvm::createCFGSimplificationPass();
85 (void) llvm::createCFLAndersAAWrapperPass();
86 (void) llvm::createCFLSteensAAWrapperPass();
87 (void) llvm::createStructurizeCFGPass();
88 (void) llvm::createLibCallsShrinkWrapPass();
89 (void) llvm::createCalledValuePropagationPass();
90 (void) llvm::createConstantMergePass();
91 (void) llvm::createConstantPropagationPass();
92 (void) llvm::createControlHeightReductionLegacyPass();
93 (void) llvm::createCostModelAnalysisPass();
94 (void) llvm::createDeadArgEliminationPass();
95 (void) llvm::createDeadCodeEliminationPass();
96 (void) llvm::createDeadInstEliminationPass();
97 (void) llvm::createDeadStoreEliminationPass();
98 (void) llvm::createDependenceAnalysisWrapperPass();
99 (void) llvm::createDomOnlyPrinterPass();
100 (void) llvm::createDomPrinterPass();
101 (void) llvm::createDomOnlyViewerPass();
102 (void) llvm::createDomViewerPass();
103 (void) llvm::createGCOVProfilerPass();
104 (void) llvm::createPGOInstrumentationGenLegacyPass();
105 (void) llvm::createPGOInstrumentationUseLegacyPass();
106 (void) llvm::createPGOInstrumentationGenCreateVarLegacyPass();
107 (void) llvm::createPGOIndirectCallPromotionLegacyPass();
108 (void) llvm::createPGOMemOPSizeOptLegacyPass();
109 (void) llvm::createInstrProfilingLegacyPass();
110 (void) llvm::createFunctionImportPass();
111 (void) llvm::createFunctionInliningPass();
112 (void) llvm::createAlwaysInlinerLegacyPass();
113 (void) llvm::createGlobalDCEPass();
114 (void) llvm::createGlobalOptimizerPass();
115 (void) llvm::createGlobalsAAWrapperPass();
116 (void) llvm::createGuardWideningPass();
117 (void) llvm::createLoopGuardWideningPass();
118 (void) llvm::createIPConstantPropagationPass();
119 (void) llvm::createIPSCCPPass();
120 (void) llvm::createInductiveRangeCheckEliminationPass();
121 (void) llvm::createIndVarSimplifyPass();
122 (void) llvm::createInstSimplifyLegacyPass();
123 (void) llvm::createInstructionCombiningPass();
124 (void) llvm::createInternalizePass();
125 (void) llvm::createLCSSAPass();
126 (void) llvm::createLegacyDivergenceAnalysisPass();
127 (void) llvm::createLICMPass();
128 (void) llvm::createLoopSinkPass();
129 (void) llvm::createLazyValueInfoPass();
130 (void) llvm::createLoopExtractorPass();
131 (void) llvm::createLoopInterchangePass();
132 (void) llvm::createLoopPredicationPass();
133 (void) llvm::createLoopSimplifyPass();
134 (void) llvm::createLoopSimplifyCFGPass();
135 (void) llvm::createLoopStrengthReducePass();
136 (void) llvm::createLoopRerollPass();
137 (void) llvm::createLoopUnrollPass();
138 (void) llvm::createLoopUnrollAndJamPass();
139 (void) llvm::createLoopUnswitchPass();
140 (void) llvm::createLoopVersioningLICMPass();
141 (void) llvm::createLoopIdiomPass();
142 (void) llvm::createLoopRotatePass();
143 (void) llvm::createLowerConstantIntrinsicsPass();
144 (void) llvm::createLowerExpectIntrinsicPass();
145 (void) llvm::createLowerInvokePass();
146 (void) llvm::createLowerSwitchPass();
147 (void) llvm::createNaryReassociatePass();
148 (void) llvm::createObjCARCAAWrapperPass();
149 (void) llvm::createObjCARCAPElimPass();
150 (void) llvm::createObjCARCExpandPass();
151 (void) llvm::createObjCARCContractPass();
152 (void) llvm::createObjCARCOptPass();
153 (void) llvm::createPAEvalPass();
154 (void) llvm::createPromoteMemoryToRegisterPass();
155 (void) llvm::createDemoteRegisterToMemoryPass();
156 (void) llvm::createPruneEHPass();
157 (void) llvm::createPostDomOnlyPrinterPass();
158 (void) llvm::createPostDomPrinterPass();
159 (void) llvm::createPostDomOnlyViewerPass();
160 (void) llvm::createPostDomViewerPass();
161 (void) llvm::createReassociatePass();
162 (void) llvm::createRegionInfoPass();
163 (void) llvm::createRegionOnlyPrinterPass();
164 (void) llvm::createRegionOnlyViewerPass();
165 (void) llvm::createRegionPrinterPass();
166 (void) llvm::createRegionViewerPass();
167 (void) llvm::createSCCPPass();
168 (void) llvm::createSafeStackPass();
169 (void) llvm::createSROAPass();
170 (void) llvm::createSingleLoopExtractorPass();
171 (void) llvm::createStripSymbolsPass();
172 (void) llvm::createStripNonDebugSymbolsPass();
173 (void) llvm::createStripDeadDebugInfoPass();
174 (void) llvm::createStripDeadPrototypesPass();
175 (void) llvm::createTailCallEliminationPass();
176 (void) llvm::createJumpThreadingPass();
177 (void) llvm::createUnifyFunctionExitNodesPass();
178 (void) llvm::createInstCountPass();
179 (void) llvm::createConstantHoistingPass();
180 (void) llvm::createCodeGenPreparePass();
181 (void) llvm::createEntryExitInstrumenterPass();
182 (void) llvm::createPostInlineEntryExitInstrumenterPass();
183 (void) llvm::createEarlyCSEPass();
184 (void) llvm::createGVNHoistPass();
185 (void) llvm::createMergedLoadStoreMotionPass();
186 (void) llvm::createGVNPass();
187 (void) llvm::createNewGVNPass();
188 (void) llvm::createMemCpyOptPass();
189 (void) llvm::createLoopDeletionPass();
190 (void) llvm::createPostDomTree();
191 (void) llvm::createInstructionNamerPass();
192 (void) llvm::createMetaRenamerPass();
193 (void) llvm::createAttributorLegacyPass();
194 (void) llvm::createPostOrderFunctionAttrsLegacyPass();
195 (void) llvm::createReversePostOrderFunctionAttrsPass();
196 (void) llvm::createMergeFunctionsPass();
197 (void) llvm::createMergeICmpsLegacyPass();
198 (void) llvm::createExpandMemCmpPass();
200 llvm::raw_string_ostream
os(buf
);
201 (void) llvm::createPrintModulePass(os
);
202 (void) llvm::createPrintFunctionPass(os
);
203 (void) llvm::createPrintBasicBlockPass(os
);
204 (void) llvm::createModuleDebugInfoPrinterPass();
205 (void) llvm::createPartialInliningPass();
206 (void) llvm::createLintPass();
207 (void) llvm::createSinkingPass();
208 (void) llvm::createLowerAtomicPass();
209 (void) llvm::createCorrelatedValuePropagationPass();
210 (void) llvm::createMemDepPrinter();
211 (void) llvm::createLoopVectorizePass();
212 (void) llvm::createSLPVectorizerPass();
213 (void) llvm::createLoadStoreVectorizerPass();
214 (void) llvm::createPartiallyInlineLibCallsPass();
215 (void) llvm::createScalarizerPass();
216 (void) llvm::createSeparateConstOffsetFromGEPPass();
217 (void) llvm::createSpeculativeExecutionPass();
218 (void) llvm::createSpeculativeExecutionIfHasBranchDivergencePass();
219 (void) llvm::createRewriteSymbolsPass();
220 (void) llvm::createStraightLineStrengthReducePass();
221 (void) llvm::createMemDerefPrinter();
222 (void) llvm::createMustExecutePrinter();
223 (void) llvm::createMustBeExecutedContextPrinter();
224 (void) llvm::createFloat2IntPass();
225 (void) llvm::createEliminateAvailableExternallyPass();
226 (void) llvm::createScalarizeMaskedMemIntrinPass();
227 (void) llvm::createWarnMissedTransformationsPass();
228 (void) llvm::createHardwareLoopsPass();
230 (void)new llvm::IntervalPartition();
231 (void)new llvm::ScalarEvolutionWrapperPass();
232 llvm::Function::Create(nullptr, llvm::GlobalValue::ExternalLinkage
)->viewCFGOnly();
233 llvm::RGPassManager RGM
;
234 llvm::TargetLibraryInfoImpl TLII
;
235 llvm::TargetLibraryInfo
TLI(TLII
);
236 llvm::AliasAnalysis
AA(TLI
);
237 llvm::AliasSetTracker
X(AA
);
238 X
.add(nullptr, llvm::LocationSize::unknown(),
239 llvm::AAMDNodes()); // for -print-alias-sets
240 (void) llvm::AreStatisticsEnabled();
241 (void) llvm::sys::RunningOnValgrind();
243 } ForcePassLinking
; // Force link by creating a global definition.