LinkAllPasses.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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/CallPrinter.h"
  25. #include "llvm/Analysis/DomPrinter.h"
  26. #include "llvm/Analysis/GlobalsModRef.h"
  27. #include "llvm/Analysis/IntervalPartition.h"
  28. #include "llvm/Analysis/Lint.h"
  29. #include "llvm/Analysis/Passes.h"
  30. #include "llvm/Analysis/PostDominators.h"
  31. #include "llvm/Analysis/RegionPass.h"
  32. #include "llvm/Analysis/RegionPrinter.h"
  33. #include "llvm/Analysis/ScalarEvolution.h"
  34. #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
  35. #include "llvm/Analysis/ScopedNoAliasAA.h"
  36. #include "llvm/Analysis/TargetLibraryInfo.h"
  37. #include "llvm/Analysis/TypeBasedAliasAnalysis.h"
  38. #include "llvm/CodeGen/Passes.h"
  39. #include "llvm/IR/Function.h"
  40. #include "llvm/IR/IRPrintingPasses.h"
  41. #include "llvm/Support/Valgrind.h"
  42. #include "llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h"
  43. #include "llvm/Transforms/IPO.h"
  44. #include "llvm/Transforms/IPO/AlwaysInliner.h"
  45. #include "llvm/Transforms/IPO/Attributor.h"
  46. #include "llvm/Transforms/IPO/FunctionAttrs.h"
  47. #include "llvm/Transforms/InstCombine/InstCombine.h"
  48. #include "llvm/Transforms/Instrumentation.h"
  49. #include "llvm/Transforms/Instrumentation/BoundsChecking.h"
  50. #include "llvm/Transforms/ObjCARC.h"
  51. #include "llvm/Transforms/Scalar.h"
  52. #include "llvm/Transforms/Scalar/GVN.h"
  53. #include "llvm/Transforms/Scalar/InstSimplifyPass.h"
  54. #include "llvm/Transforms/Scalar/Scalarizer.h"
  55. #include "llvm/Transforms/Utils.h"
  56. #include "llvm/Transforms/Utils/SymbolRewriter.h"
  57. #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
  58. #include "llvm/Transforms/Vectorize.h"
  59. #include <cstdlib>
  60. namespace {
  61. struct ForcePassLinking {
  62. 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. // This is so that globals in the translation units where these functions
  68. // are defined are forced to be initialized, populating various
  69. // registries.
  70. if (std::getenv("bar") != (char*) -1)
  71. return;
  72. (void) llvm::createAAEvalPass();
  73. (void) llvm::createAggressiveDCEPass();
  74. (void)llvm::createBitTrackingDCEPass();
  75. (void) llvm::createAlignmentFromAssumptionsPass();
  76. (void) llvm::createBasicAAWrapperPass();
  77. (void) llvm::createSCEVAAWrapperPass();
  78. (void) llvm::createTypeBasedAAWrapperPass();
  79. (void) llvm::createScopedNoAliasAAWrapperPass();
  80. (void) llvm::createBreakCriticalEdgesPass();
  81. (void) llvm::createCallGraphDOTPrinterPass();
  82. (void) llvm::createCallGraphViewerPass();
  83. (void) llvm::createCFGSimplificationPass();
  84. (void) llvm::createStructurizeCFGPass();
  85. (void) llvm::createLibCallsShrinkWrapPass();
  86. (void) llvm::createCalledValuePropagationPass();
  87. (void) llvm::createConstantMergePass();
  88. (void) llvm::createCostModelAnalysisPass();
  89. (void) llvm::createDeadArgEliminationPass();
  90. (void) llvm::createDeadCodeEliminationPass();
  91. (void) llvm::createDeadStoreEliminationPass();
  92. (void) llvm::createDependenceAnalysisWrapperPass();
  93. (void) llvm::createDomOnlyPrinterWrapperPassPass();
  94. (void) llvm::createDomPrinterWrapperPassPass();
  95. (void) llvm::createDomOnlyViewerWrapperPassPass();
  96. (void) llvm::createDomViewerWrapperPassPass();
  97. (void) llvm::createFunctionInliningPass();
  98. (void) llvm::createAlwaysInlinerLegacyPass();
  99. (void) llvm::createGlobalDCEPass();
  100. (void) llvm::createGlobalOptimizerPass();
  101. (void) llvm::createGlobalsAAWrapperPass();
  102. (void) llvm::createGuardWideningPass();
  103. (void) llvm::createLoopGuardWideningPass();
  104. (void) llvm::createIPSCCPPass();
  105. (void) llvm::createInductiveRangeCheckEliminationPass();
  106. (void) llvm::createIndVarSimplifyPass();
  107. (void) llvm::createInstSimplifyLegacyPass();
  108. (void) llvm::createInstructionCombiningPass();
  109. (void) llvm::createInternalizePass();
  110. (void) llvm::createJMCInstrumenterPass();
  111. (void) llvm::createLCSSAPass();
  112. (void) llvm::createLegacyDivergenceAnalysisPass();
  113. (void) llvm::createLICMPass();
  114. (void) llvm::createLoopSinkPass();
  115. (void) llvm::createLazyValueInfoPass();
  116. (void) llvm::createLoopExtractorPass();
  117. (void) llvm::createLoopInterchangePass();
  118. (void) llvm::createLoopFlattenPass();
  119. (void) llvm::createLoopPredicationPass();
  120. (void) llvm::createLoopSimplifyPass();
  121. (void) llvm::createLoopSimplifyCFGPass();
  122. (void) llvm::createLoopStrengthReducePass();
  123. (void) llvm::createLoopRerollPass();
  124. (void) llvm::createLoopUnrollPass();
  125. (void) llvm::createLoopUnrollAndJamPass();
  126. (void) llvm::createLoopVersioningLICMPass();
  127. (void) llvm::createLoopIdiomPass();
  128. (void) llvm::createLoopRotatePass();
  129. (void) llvm::createLowerConstantIntrinsicsPass();
  130. (void) llvm::createLowerExpectIntrinsicPass();
  131. (void) llvm::createLowerGlobalDtorsLegacyPass();
  132. (void) llvm::createLowerInvokePass();
  133. (void) llvm::createLowerSwitchPass();
  134. (void) llvm::createNaryReassociatePass();
  135. (void) llvm::createObjCARCContractPass();
  136. (void) llvm::createPromoteMemoryToRegisterPass();
  137. (void) llvm::createDemoteRegisterToMemoryPass();
  138. (void)llvm::createPostDomOnlyPrinterWrapperPassPass();
  139. (void)llvm::createPostDomPrinterWrapperPassPass();
  140. (void)llvm::createPostDomOnlyViewerWrapperPassPass();
  141. (void)llvm::createPostDomViewerWrapperPassPass();
  142. (void) llvm::createReassociatePass();
  143. (void) llvm::createRedundantDbgInstEliminationPass();
  144. (void) llvm::createRegionInfoPass();
  145. (void) llvm::createRegionOnlyPrinterPass();
  146. (void) llvm::createRegionOnlyViewerPass();
  147. (void) llvm::createRegionPrinterPass();
  148. (void) llvm::createRegionViewerPass();
  149. (void) llvm::createSCCPPass();
  150. (void) llvm::createSafeStackPass();
  151. (void) llvm::createSROAPass();
  152. (void) llvm::createSingleLoopExtractorPass();
  153. (void) llvm::createStripSymbolsPass();
  154. (void) llvm::createStripNonDebugSymbolsPass();
  155. (void) llvm::createStripDeadDebugInfoPass();
  156. (void) llvm::createStripDeadPrototypesPass();
  157. (void) llvm::createTailCallEliminationPass();
  158. (void)llvm::createTLSVariableHoistPass();
  159. (void) llvm::createJumpThreadingPass();
  160. (void) llvm::createDFAJumpThreadingPass();
  161. (void) llvm::createUnifyFunctionExitNodesPass();
  162. (void) llvm::createInstCountPass();
  163. (void) llvm::createConstantHoistingPass();
  164. (void) llvm::createCodeGenPreparePass();
  165. (void) llvm::createEarlyCSEPass();
  166. (void) llvm::createGVNHoistPass();
  167. (void) llvm::createMergedLoadStoreMotionPass();
  168. (void) llvm::createGVNPass();
  169. (void) llvm::createNewGVNPass();
  170. (void) llvm::createMemCpyOptPass();
  171. (void) llvm::createLoopDeletionPass();
  172. (void) llvm::createPostDomTree();
  173. (void) llvm::createInstructionNamerPass();
  174. (void) llvm::createMetaRenamerPass();
  175. (void) llvm::createAttributorLegacyPass();
  176. (void) llvm::createAttributorCGSCCLegacyPass();
  177. (void) llvm::createPostOrderFunctionAttrsLegacyPass();
  178. (void) llvm::createReversePostOrderFunctionAttrsPass();
  179. (void) llvm::createMergeFunctionsPass();
  180. (void) llvm::createMergeICmpsLegacyPass();
  181. (void) llvm::createExpandLargeDivRemPass();
  182. (void) llvm::createExpandMemCmpPass();
  183. (void) llvm::createExpandVectorPredicationPass();
  184. std::string buf;
  185. llvm::raw_string_ostream os(buf);
  186. (void) llvm::createPrintModulePass(os);
  187. (void) llvm::createPrintFunctionPass(os);
  188. (void) llvm::createModuleDebugInfoPrinterPass();
  189. (void) llvm::createPartialInliningPass();
  190. (void) llvm::createLintLegacyPassPass();
  191. (void) llvm::createSinkingPass();
  192. (void) llvm::createLowerAtomicPass();
  193. (void) llvm::createCorrelatedValuePropagationPass();
  194. (void) llvm::createMemDepPrinter();
  195. (void) llvm::createLoopVectorizePass();
  196. (void) llvm::createSLPVectorizerPass();
  197. (void) llvm::createLoadStoreVectorizerPass();
  198. (void) llvm::createVectorCombinePass();
  199. (void) llvm::createPartiallyInlineLibCallsPass();
  200. (void) llvm::createScalarizerPass();
  201. (void) llvm::createSeparateConstOffsetFromGEPPass();
  202. (void) llvm::createSpeculativeExecutionPass();
  203. (void) llvm::createSpeculativeExecutionIfHasBranchDivergencePass();
  204. (void) llvm::createRewriteSymbolsPass();
  205. (void) llvm::createStraightLineStrengthReducePass();
  206. (void) llvm::createMemDerefPrinter();
  207. (void) llvm::createMustExecutePrinter();
  208. (void) llvm::createMustBeExecutedContextPrinter();
  209. (void) llvm::createFloat2IntPass();
  210. (void) llvm::createEliminateAvailableExternallyPass();
  211. (void)llvm::createScalarizeMaskedMemIntrinLegacyPass();
  212. (void) llvm::createWarnMissedTransformationsPass();
  213. (void) llvm::createHardwareLoopsPass();
  214. (void) llvm::createInjectTLIMappingsLegacyPass();
  215. (void) llvm::createUnifyLoopExitsPass();
  216. (void) llvm::createFixIrreduciblePass();
  217. (void)llvm::createSelectOptimizePass();
  218. (void)new llvm::IntervalPartition();
  219. (void)new llvm::ScalarEvolutionWrapperPass();
  220. llvm::Function::Create(nullptr, llvm::GlobalValue::ExternalLinkage)->viewCFGOnly();
  221. llvm::RGPassManager RGM;
  222. llvm::TargetLibraryInfoImpl TLII;
  223. llvm::TargetLibraryInfo TLI(TLII);
  224. llvm::AliasAnalysis AA(TLI);
  225. llvm::BatchAAResults BAA(AA);
  226. llvm::AliasSetTracker X(BAA);
  227. X.add(nullptr, llvm::LocationSize::beforeOrAfterPointer(),
  228. llvm::AAMDNodes()); // for -print-alias-sets
  229. (void) llvm::AreStatisticsEnabled();
  230. (void) llvm::sys::RunningOnValgrind();
  231. }
  232. } ForcePassLinking; // Force link by creating a global definition.
  233. }
  234. #endif
  235. #ifdef __GNUC__
  236. #pragma GCC diagnostic pop
  237. #endif