1 //===- llvm/LinkAllPasses.h ------------ Reference All Passes ---*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This header file pulls in all transformation and analysis passes for tools 11 // like opt and bugpoint that need this functionality. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_LINKALLPASSES_H 16 #define LLVM_LINKALLPASSES_H 17 18 #include "llvm/ADT/Statistic.h" 19 #include "llvm/Analysis/AliasSetTracker.h" 20 #include "llvm/Analysis/BasicAliasAnalysis.h" 21 #include "llvm/Analysis/CFLAliasAnalysis.h" 22 #include "llvm/Analysis/CallPrinter.h" 23 #include "llvm/Analysis/DomPrinter.h" 24 #include "llvm/Analysis/GlobalsModRef.h" 25 #include "llvm/Analysis/IntervalPartition.h" 26 #include "llvm/Analysis/Lint.h" 27 #include "llvm/Analysis/Passes.h" 28 #include "llvm/Analysis/PostDominators.h" 29 #include "llvm/Analysis/RegionPass.h" 30 #include "llvm/Analysis/RegionPrinter.h" 31 #include "llvm/Analysis/ScalarEvolution.h" 32 #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" 33 #include "llvm/Analysis/ScopedNoAliasAA.h" 34 #include "llvm/Analysis/TypeBasedAliasAnalysis.h" 35 #include "llvm/CodeGen/Passes.h" 36 #include "llvm/IR/Function.h" 37 #include "llvm/IR/IRPrintingPasses.h" 38 #include "llvm/Transforms/IPO.h" 39 #include "llvm/Transforms/Instrumentation.h" 40 #include "llvm/Transforms/ObjCARC.h" 41 #include "llvm/Transforms/Scalar.h" 42 #include "llvm/Transforms/Utils/SymbolRewriter.h" 43 #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" 44 #include "llvm/Transforms/Vectorize.h" 45 #include "llvm/Support/Valgrind.h" 46 #include <cstdlib> 47 48 namespace { 49 struct ForcePassLinking { 50 ForcePassLinking() { 51 // We must reference the passes in such a way that compilers will not 52 // delete it all as dead code, even with whole program optimization, 53 // yet is effectively a NO-OP. As the compiler isn't smart enough 54 // to know that getenv() never returns -1, this will do the job. 55 if (std::getenv("bar") != (char*) -1) 56 return; 57 58 (void) llvm::createAAEvalPass(); 59 (void) llvm::createAggressiveDCEPass(); 60 (void) llvm::createBitTrackingDCEPass(); 61 (void) llvm::createArgumentPromotionPass(); 62 (void) llvm::createAlignmentFromAssumptionsPass(); 63 (void) llvm::createBasicAAWrapperPass(); 64 (void) llvm::createSCEVAAWrapperPass(); 65 (void) llvm::createTypeBasedAAWrapperPass(); 66 (void) llvm::createScopedNoAliasAAWrapperPass(); 67 (void) llvm::createBoundsCheckingPass(); 68 (void) llvm::createBreakCriticalEdgesPass(); 69 (void) llvm::createCallGraphPrinterPass(); 70 (void) llvm::createCallGraphViewerPass(); 71 (void) llvm::createCFGSimplificationPass(); 72 (void) llvm::createCFLAAWrapperPass(); 73 (void) llvm::createStructurizeCFGPass(); 74 (void) llvm::createConstantMergePass(); 75 (void) llvm::createConstantPropagationPass(); 76 (void) llvm::createCostModelAnalysisPass(); 77 (void) llvm::createDeadArgEliminationPass(); 78 (void) llvm::createDeadCodeEliminationPass(); 79 (void) llvm::createDeadInstEliminationPass(); 80 (void) llvm::createDeadStoreEliminationPass(); 81 (void) llvm::createDependenceAnalysisPass(); 82 (void) llvm::createDivergenceAnalysisPass(); 83 (void) llvm::createDomOnlyPrinterPass(); 84 (void) llvm::createDomPrinterPass(); 85 (void) llvm::createDomOnlyViewerPass(); 86 (void) llvm::createDomViewerPass(); 87 (void) llvm::createGCOVProfilerPass(); 88 (void) llvm::createPGOInstrumentationGenPass(); 89 (void) llvm::createPGOInstrumentationUsePass(); 90 (void) llvm::createInstrProfilingPass(); 91 (void) llvm::createFunctionImportPass(); 92 (void) llvm::createFunctionInliningPass(); 93 (void) llvm::createAlwaysInlinerPass(); 94 (void) llvm::createGlobalDCEPass(); 95 (void) llvm::createGlobalOptimizerPass(); 96 (void) llvm::createGlobalsAAWrapperPass(); 97 (void) llvm::createIPConstantPropagationPass(); 98 (void) llvm::createIPSCCPPass(); 99 (void) llvm::createInductiveRangeCheckEliminationPass(); 100 (void) llvm::createIndVarSimplifyPass(); 101 (void) llvm::createInstructionCombiningPass(); 102 (void) llvm::createInternalizePass(); 103 (void) llvm::createLCSSAPass(); 104 (void) llvm::createLICMPass(); 105 (void) llvm::createLazyValueInfoPass(); 106 (void) llvm::createLoopExtractorPass(); 107 (void) llvm::createLoopInterchangePass(); 108 (void) llvm::createLoopSimplifyPass(); 109 (void) llvm::createLoopStrengthReducePass(); 110 (void) llvm::createLoopRerollPass(); 111 (void) llvm::createLoopUnrollPass(); 112 (void) llvm::createLoopUnswitchPass(); 113 (void) llvm::createLoopIdiomPass(); 114 (void) llvm::createLoopRotatePass(); 115 (void) llvm::createLowerExpectIntrinsicPass(); 116 (void) llvm::createLowerInvokePass(); 117 (void) llvm::createLowerSwitchPass(); 118 (void) llvm::createNaryReassociatePass(); 119 (void) llvm::createObjCARCAAWrapperPass(); 120 (void) llvm::createObjCARCAPElimPass(); 121 (void) llvm::createObjCARCExpandPass(); 122 (void) llvm::createObjCARCContractPass(); 123 (void) llvm::createObjCARCOptPass(); 124 (void) llvm::createPAEvalPass(); 125 (void) llvm::createPromoteMemoryToRegisterPass(); 126 (void) llvm::createDemoteRegisterToMemoryPass(); 127 (void) llvm::createPruneEHPass(); 128 (void) llvm::createPostDomOnlyPrinterPass(); 129 (void) llvm::createPostDomPrinterPass(); 130 (void) llvm::createPostDomOnlyViewerPass(); 131 (void) llvm::createPostDomViewerPass(); 132 (void) llvm::createReassociatePass(); 133 (void) llvm::createRegionInfoPass(); 134 (void) llvm::createRegionOnlyPrinterPass(); 135 (void) llvm::createRegionOnlyViewerPass(); 136 (void) llvm::createRegionPrinterPass(); 137 (void) llvm::createRegionViewerPass(); 138 (void) llvm::createSCCPPass(); 139 (void) llvm::createSafeStackPass(); 140 (void) llvm::createScalarReplAggregatesPass(); 141 (void) llvm::createSingleLoopExtractorPass(); 142 (void) llvm::createStripSymbolsPass(); 143 (void) llvm::createStripNonDebugSymbolsPass(); 144 (void) llvm::createStripDeadDebugInfoPass(); 145 (void) llvm::createStripDeadPrototypesPass(); 146 (void) llvm::createTailCallEliminationPass(); 147 (void) llvm::createJumpThreadingPass(); 148 (void) llvm::createUnifyFunctionExitNodesPass(); 149 (void) llvm::createInstCountPass(); 150 (void) llvm::createConstantHoistingPass(); 151 (void) llvm::createCodeGenPreparePass(); 152 (void) llvm::createEarlyCSEPass(); 153 (void) llvm::createMergedLoadStoreMotionPass(); 154 (void) llvm::createGVNPass(); 155 (void) llvm::createMemCpyOptPass(); 156 (void) llvm::createLoopDeletionPass(); 157 (void) llvm::createPostDomTree(); 158 (void) llvm::createInstructionNamerPass(); 159 (void) llvm::createMetaRenamerPass(); 160 (void) llvm::createFunctionAttrsPass(); 161 (void) llvm::createMergeFunctionsPass(); 162 (void) llvm::createPrintModulePass(*(llvm::raw_ostream*)nullptr); 163 (void) llvm::createPrintFunctionPass(*(llvm::raw_ostream*)nullptr); 164 (void) llvm::createPrintBasicBlockPass(*(llvm::raw_ostream*)nullptr); 165 (void) llvm::createModuleDebugInfoPrinterPass(); 166 (void) llvm::createPartialInliningPass(); 167 (void) llvm::createLintPass(); 168 (void) llvm::createSinkingPass(); 169 (void) llvm::createLowerAtomicPass(); 170 (void) llvm::createCorrelatedValuePropagationPass(); 171 (void) llvm::createMemDepPrinter(); 172 (void) llvm::createInstructionSimplifierPass(); 173 (void) llvm::createLoopVectorizePass(); 174 (void) llvm::createSLPVectorizerPass(); 175 (void) llvm::createBBVectorizePass(); 176 (void) llvm::createPartiallyInlineLibCallsPass(); 177 (void) llvm::createScalarizerPass(); 178 (void) llvm::createSeparateConstOffsetFromGEPPass(); 179 (void) llvm::createSpeculativeExecutionPass(); 180 (void) llvm::createRewriteSymbolsPass(); 181 (void) llvm::createStraightLineStrengthReducePass(); 182 (void) llvm::createMemDerefPrinter(); 183 (void) llvm::createFloat2IntPass(); 184 (void) llvm::createEliminateAvailableExternallyPass(); 185 186 (void)new llvm::IntervalPartition(); 187 (void)new llvm::ScalarEvolutionWrapperPass(); 188 ((llvm::Function*)nullptr)->viewCFGOnly(); 189 llvm::RGPassManager RGM; 190 ((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM); 191 llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)nullptr); 192 X.add(nullptr, 0, llvm::AAMDNodes()); // for -print-alias-sets 193 (void) llvm::AreStatisticsEnabled(); 194 (void) llvm::sys::RunningOnValgrind(); 195 } 196 } ForcePassLinking; // Force link by creating a global definition. 197 } 198 199 #endif 200