LinkAllPasses.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- llvm/LinkAllPasses.h ------------ Reference All Passes ---*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This header file pulls in all transformation and analysis passes for tools
  15. // like opt and bugpoint that need this functionality.
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_LINKALLPASSES_H
  19. #define LLVM_LINKALLPASSES_H
  20. #include "llvm/ADT/Statistic.h"
  21. #include "llvm/Analysis/AliasAnalysisEvaluator.h"
  22. #include "llvm/Analysis/AliasSetTracker.h"
  23. #include "llvm/Analysis/BasicAliasAnalysis.h"
  24. #include "llvm/Analysis/CFLAndersAliasAnalysis.h"
  25. #include "llvm/Analysis/CFLSteensAliasAnalysis.h"
  26. #include "llvm/Analysis/CallPrinter.h"
  27. #include "llvm/Analysis/DomPrinter.h"
  28. #include "llvm/Analysis/GlobalsModRef.h"
  29. #include "llvm/Analysis/IntervalPartition.h"
  30. #include "llvm/Analysis/Lint.h"
  31. #include "llvm/Analysis/Passes.h"
  32. #include "llvm/Analysis/PostDominators.h"
  33. #include "llvm/Analysis/RegionPass.h"
  34. #include "llvm/Analysis/RegionPrinter.h"
  35. #include "llvm/Analysis/ScalarEvolution.h"
  36. #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
  37. #include "llvm/Analysis/ScopedNoAliasAA.h"
  38. #include "llvm/Analysis/TargetLibraryInfo.h"
  39. #include "llvm/Analysis/TypeBasedAliasAnalysis.h"
  40. #include "llvm/CodeGen/Passes.h"
  41. #include "llvm/IR/Function.h"
  42. #include "llvm/IR/IRPrintingPasses.h"
  43. #include "llvm/Support/Valgrind.h"
  44. #include "llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h"
  45. #include "llvm/Transforms/IPO.h"
  46. #include "llvm/Transforms/IPO/AlwaysInliner.h"
  47. #include "llvm/Transforms/IPO/Attributor.h"
  48. #include "llvm/Transforms/IPO/FunctionAttrs.h"
  49. #include "llvm/Transforms/InstCombine/InstCombine.h"
  50. #include "llvm/Transforms/Instrumentation.h"
  51. #include "llvm/Transforms/Instrumentation/BoundsChecking.h"
  52. #include "llvm/Transforms/ObjCARC.h"
  53. #include "llvm/Transforms/Scalar.h"
  54. #include "llvm/Transforms/Scalar/GVN.h"
  55. #include "llvm/Transforms/Scalar/InstSimplifyPass.h"
  56. #include "llvm/Transforms/Scalar/Scalarizer.h"
  57. #include "llvm/Transforms/Utils.h"
  58. #include "llvm/Transforms/Utils/SymbolRewriter.h"
  59. #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
  60. #include "llvm/Transforms/Vectorize.h"
  61. #include <cstdlib>
  62. namespace {
  63. struct ForcePassLinking {
  64. ForcePassLinking() {
  65. // We must reference the passes in such a way that compilers will not
  66. // delete it all as dead code, even with whole program optimization,
  67. // yet is effectively a NO-OP. As the compiler isn't smart enough
  68. // to know that getenv() never returns -1, this will do the job.
  69. if (std::getenv("bar") != (char*) -1)
  70. return;
  71. (void) llvm::createAAEvalPass();
  72. (void) llvm::createAggressiveDCEPass();
  73. (void) llvm::createAggressiveInstCombinerPass();
  74. (void) llvm::createBitTrackingDCEPass();
  75. (void) llvm::createOpenMPOptLegacyPass();
  76. (void) llvm::createArgumentPromotionPass();
  77. (void) llvm::createAlignmentFromAssumptionsPass();
  78. (void) llvm::createBasicAAWrapperPass();
  79. (void) llvm::createSCEVAAWrapperPass();
  80. (void) llvm::createTypeBasedAAWrapperPass();
  81. (void) llvm::createScopedNoAliasAAWrapperPass();
  82. (void) llvm::createBoundsCheckingLegacyPass();
  83. (void) llvm::createBreakCriticalEdgesPass();
  84. (void) llvm::createCallGraphDOTPrinterPass();
  85. (void) llvm::createCallGraphViewerPass();
  86. (void) llvm::createCFGSimplificationPass();
  87. (void) llvm::createCFLAndersAAWrapperPass();
  88. (void) llvm::createCFLSteensAAWrapperPass();
  89. (void) llvm::createStructurizeCFGPass();
  90. (void) llvm::createLibCallsShrinkWrapPass();
  91. (void) llvm::createCalledValuePropagationPass();
  92. (void) llvm::createConstantMergePass();
  93. (void) llvm::createControlHeightReductionLegacyPass();
  94. (void) llvm::createCostModelAnalysisPass();
  95. (void) llvm::createDeadArgEliminationPass();
  96. (void) llvm::createDeadCodeEliminationPass();
  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::createIPSCCPPass();
  119. (void) llvm::createInductiveRangeCheckEliminationPass();
  120. (void) llvm::createIndVarSimplifyPass();
  121. (void) llvm::createInstSimplifyLegacyPass();
  122. (void) llvm::createInstructionCombiningPass();
  123. (void) llvm::createInternalizePass();
  124. (void) llvm::createLCSSAPass();
  125. (void) llvm::createLegacyDivergenceAnalysisPass();
  126. (void) llvm::createLICMPass();
  127. (void) llvm::createLoopSinkPass();
  128. (void) llvm::createLazyValueInfoPass();
  129. (void) llvm::createLoopExtractorPass();
  130. (void) llvm::createLoopInterchangePass();
  131. (void) llvm::createLoopFlattenPass();
  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::createRedundantDbgInstEliminationPass();
  163. (void) llvm::createRegionInfoPass();
  164. (void) llvm::createRegionOnlyPrinterPass();
  165. (void) llvm::createRegionOnlyViewerPass();
  166. (void) llvm::createRegionPrinterPass();
  167. (void) llvm::createRegionViewerPass();
  168. (void) llvm::createSCCPPass();
  169. (void) llvm::createSafeStackPass();
  170. (void) llvm::createSROAPass();
  171. (void) llvm::createSingleLoopExtractorPass();
  172. (void) llvm::createStripSymbolsPass();
  173. (void) llvm::createStripNonDebugSymbolsPass();
  174. (void) llvm::createStripDeadDebugInfoPass();
  175. (void) llvm::createStripDeadPrototypesPass();
  176. (void) llvm::createTailCallEliminationPass();
  177. (void) llvm::createJumpThreadingPass();
  178. (void) llvm::createUnifyFunctionExitNodesPass();
  179. (void) llvm::createInstCountPass();
  180. (void) llvm::createConstantHoistingPass();
  181. (void) llvm::createCodeGenPreparePass();
  182. (void) llvm::createEntryExitInstrumenterPass();
  183. (void) llvm::createPostInlineEntryExitInstrumenterPass();
  184. (void) llvm::createEarlyCSEPass();
  185. (void) llvm::createGVNHoistPass();
  186. (void) llvm::createMergedLoadStoreMotionPass();
  187. (void) llvm::createGVNPass();
  188. (void) llvm::createNewGVNPass();
  189. (void) llvm::createMemCpyOptPass();
  190. (void) llvm::createLoopDeletionPass();
  191. (void) llvm::createPostDomTree();
  192. (void) llvm::createInstructionNamerPass();
  193. (void) llvm::createMetaRenamerPass();
  194. (void) llvm::createAttributorLegacyPass();
  195. (void) llvm::createAttributorCGSCCLegacyPass();
  196. (void) llvm::createPostOrderFunctionAttrsLegacyPass();
  197. (void) llvm::createReversePostOrderFunctionAttrsPass();
  198. (void) llvm::createMergeFunctionsPass();
  199. (void) llvm::createMergeICmpsLegacyPass();
  200. (void) llvm::createExpandMemCmpPass();
  201. std::string buf;
  202. llvm::raw_string_ostream os(buf);
  203. (void) llvm::createPrintModulePass(os);
  204. (void) llvm::createPrintFunctionPass(os);
  205. (void) llvm::createModuleDebugInfoPrinterPass();
  206. (void) llvm::createPartialInliningPass();
  207. (void) llvm::createLintLegacyPassPass();
  208. (void) llvm::createSinkingPass();
  209. (void) llvm::createLowerAtomicPass();
  210. (void) llvm::createCorrelatedValuePropagationPass();
  211. (void) llvm::createMemDepPrinter();
  212. (void) llvm::createLoopVectorizePass();
  213. (void) llvm::createSLPVectorizerPass();
  214. (void) llvm::createLoadStoreVectorizerPass();
  215. (void) llvm::createVectorCombinePass();
  216. (void) llvm::createPartiallyInlineLibCallsPass();
  217. (void) llvm::createScalarizerPass();
  218. (void) llvm::createSeparateConstOffsetFromGEPPass();
  219. (void) llvm::createSpeculativeExecutionPass();
  220. (void) llvm::createSpeculativeExecutionIfHasBranchDivergencePass();
  221. (void) llvm::createRewriteSymbolsPass();
  222. (void) llvm::createStraightLineStrengthReducePass();
  223. (void) llvm::createMemDerefPrinter();
  224. (void) llvm::createMustExecutePrinter();
  225. (void) llvm::createMustBeExecutedContextPrinter();
  226. (void) llvm::createFloat2IntPass();
  227. (void) llvm::createEliminateAvailableExternallyPass();
  228. (void)llvm::createScalarizeMaskedMemIntrinLegacyPass();
  229. (void) llvm::createWarnMissedTransformationsPass();
  230. (void) llvm::createHardwareLoopsPass();
  231. (void) llvm::createInjectTLIMappingsLegacyPass();
  232. (void) llvm::createUnifyLoopExitsPass();
  233. (void) llvm::createFixIrreduciblePass();
  234. (void)new llvm::IntervalPartition();
  235. (void)new llvm::ScalarEvolutionWrapperPass();
  236. llvm::Function::Create(nullptr, llvm::GlobalValue::ExternalLinkage)->viewCFGOnly();
  237. llvm::RGPassManager RGM;
  238. llvm::TargetLibraryInfoImpl TLII;
  239. llvm::TargetLibraryInfo TLI(TLII);
  240. llvm::AliasAnalysis AA(TLI);
  241. llvm::AliasSetTracker X(AA);
  242. X.add(nullptr, llvm::LocationSize::beforeOrAfterPointer(),
  243. llvm::AAMDNodes()); // for -print-alias-sets
  244. (void) llvm::AreStatisticsEnabled();
  245. (void) llvm::sys::RunningOnValgrind();
  246. }
  247. } ForcePassLinking; // Force link by creating a global definition.
  248. }
  249. #endif
  250. #ifdef __GNUC__
  251. #pragma GCC diagnostic pop
  252. #endif