1 //===- llvm/LinkAllPasses.h ------------ Reference All Passes ---*- C++ -*-===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This header file pulls in all transformation and analysis passes for tools 10 // like opt and bugpoint that need this functionality. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_LINKALLPASSES_H 15 #define LLVM_LINKALLPASSES_H 16 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/CallPrinter.h" 22 #include "llvm/Analysis/DomPrinter.h" 23 #include "llvm/Analysis/GlobalsModRef.h" 24 #include "llvm/Analysis/Passes.h" 25 #include "llvm/Analysis/PostDominators.h" 26 #include "llvm/Analysis/RegionPass.h" 27 #include "llvm/Analysis/RegionPrinter.h" 28 #include "llvm/Analysis/ScalarEvolution.h" 29 #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" 30 #include "llvm/Analysis/ScopedNoAliasAA.h" 31 #include "llvm/Analysis/TargetLibraryInfo.h" 32 #include "llvm/Analysis/TypeBasedAliasAnalysis.h" 33 #include "llvm/CodeGen/Passes.h" 34 #include "llvm/IR/Function.h" 35 #include "llvm/IR/IRPrintingPasses.h" 36 #include "llvm/Support/Valgrind.h" 37 #include "llvm/Transforms/IPO.h" 38 #include "llvm/Transforms/IPO/AlwaysInliner.h" 39 #include "llvm/Transforms/InstCombine/InstCombine.h" 40 #include "llvm/Transforms/ObjCARC.h" 41 #include "llvm/Transforms/Scalar.h" 42 #include "llvm/Transforms/Scalar/GVN.h" 43 #include "llvm/Transforms/Scalar/Scalarizer.h" 44 #include "llvm/Transforms/Utils.h" 45 #include "llvm/Transforms/Utils/SymbolRewriter.h" 46 #include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h" 47 #include <cstdlib> 48 49 namespace { 50 struct ForcePassLinking { ForcePassLinkingForcePassLinking51 ForcePassLinking() { 52 // We must reference the passes in such a way that compilers will not 53 // delete it all as dead code, even with whole program optimization, 54 // yet is effectively a NO-OP. As the compiler isn't smart enough 55 // to know that getenv() never returns -1, this will do the job. 56 // This is so that globals in the translation units where these functions 57 // are defined are forced to be initialized, populating various 58 // registries. 59 if (std::getenv("bar") != (char*) -1) 60 return; 61 62 (void)llvm::createAtomicExpandLegacyPass(); 63 (void) llvm::createBasicAAWrapperPass(); 64 (void) llvm::createSCEVAAWrapperPass(); 65 (void) llvm::createTypeBasedAAWrapperPass(); 66 (void) llvm::createScopedNoAliasAAWrapperPass(); 67 (void) llvm::createBreakCriticalEdgesPass(); 68 (void) llvm::createCallGraphDOTPrinterPass(); 69 (void) llvm::createCallGraphViewerPass(); 70 (void) llvm::createCFGSimplificationPass(); 71 (void) llvm::createStructurizeCFGPass(); 72 (void) llvm::createDeadArgEliminationPass(); 73 (void) llvm::createDeadCodeEliminationPass(); 74 (void) llvm::createDependenceAnalysisWrapperPass(); 75 (void) llvm::createDomOnlyPrinterWrapperPassPass(); 76 (void) llvm::createDomPrinterWrapperPassPass(); 77 (void) llvm::createDomOnlyViewerWrapperPassPass(); 78 (void) llvm::createDomViewerWrapperPassPass(); 79 (void) llvm::createAlwaysInlinerLegacyPass(); 80 (void) llvm::createGlobalsAAWrapperPass(); 81 (void) llvm::createInstSimplifyLegacyPass(); 82 (void) llvm::createInstructionCombiningPass(); 83 (void) llvm::createJMCInstrumenterPass(); 84 (void) llvm::createKCFIPass(); 85 (void) llvm::createLCSSAPass(); 86 (void) llvm::createLICMPass(); 87 (void) llvm::createLazyValueInfoPass(); 88 (void) llvm::createLoopExtractorPass(); 89 (void) llvm::createLoopSimplifyPass(); 90 (void) llvm::createLoopStrengthReducePass(); 91 (void) llvm::createLoopUnrollPass(); 92 (void) llvm::createLowerConstantIntrinsicsPass(); 93 (void) llvm::createLowerGlobalDtorsLegacyPass(); 94 (void) llvm::createLowerInvokePass(); 95 (void) llvm::createLowerSwitchPass(); 96 (void) llvm::createNaryReassociatePass(); 97 (void) llvm::createObjCARCContractPass(); 98 (void) llvm::createPromoteMemoryToRegisterPass(); 99 (void)llvm::createPostDomOnlyPrinterWrapperPassPass(); 100 (void)llvm::createPostDomPrinterWrapperPassPass(); 101 (void)llvm::createPostDomOnlyViewerWrapperPassPass(); 102 (void)llvm::createPostDomViewerWrapperPassPass(); 103 (void) llvm::createReassociatePass(); 104 (void) llvm::createRegionInfoPass(); 105 (void) llvm::createRegionOnlyPrinterPass(); 106 (void) llvm::createRegionOnlyViewerPass(); 107 (void) llvm::createRegionPrinterPass(); 108 (void) llvm::createRegionViewerPass(); 109 (void) llvm::createSafeStackPass(); 110 (void) llvm::createSROAPass(); 111 (void) llvm::createSingleLoopExtractorPass(); 112 (void) llvm::createTailCallEliminationPass(); 113 (void)llvm::createTLSVariableHoistPass(); 114 (void) llvm::createConstantHoistingPass(); 115 (void)llvm::createCodeGenPrepareLegacyPass(); 116 (void) llvm::createPostInlineEntryExitInstrumenterPass(); 117 (void) llvm::createEarlyCSEPass(); 118 (void) llvm::createGVNPass(); 119 (void) llvm::createPostDomTree(); 120 (void) llvm::createMergeICmpsLegacyPass(); 121 (void) llvm::createExpandLargeDivRemPass(); 122 (void)llvm::createExpandMemCmpLegacyPass(); 123 (void) llvm::createExpandVectorPredicationPass(); 124 std::string buf; 125 llvm::raw_string_ostream os(buf); 126 (void) llvm::createPrintModulePass(os); 127 (void) llvm::createPrintFunctionPass(os); 128 (void) llvm::createSinkingPass(); 129 (void) llvm::createLowerAtomicPass(); 130 (void) llvm::createLoadStoreVectorizerPass(); 131 (void) llvm::createPartiallyInlineLibCallsPass(); 132 (void) llvm::createSeparateConstOffsetFromGEPPass(); 133 (void) llvm::createSpeculativeExecutionPass(); 134 (void) llvm::createSpeculativeExecutionIfHasBranchDivergencePass(); 135 (void) llvm::createStraightLineStrengthReducePass(); 136 (void)llvm::createScalarizeMaskedMemIntrinLegacyPass(); 137 (void) llvm::createHardwareLoopsLegacyPass(); 138 (void) llvm::createUnifyLoopExitsPass(); 139 (void) llvm::createFixIrreduciblePass(); 140 (void)llvm::createSelectOptimizePass(); 141 142 (void)new llvm::ScalarEvolutionWrapperPass(); 143 llvm::Function::Create(nullptr, llvm::GlobalValue::ExternalLinkage)->viewCFGOnly(); 144 llvm::RGPassManager RGM; 145 llvm::TargetLibraryInfoImpl TLII; 146 llvm::TargetLibraryInfo TLI(TLII); 147 llvm::AliasAnalysis AA(TLI); 148 llvm::BatchAAResults BAA(AA); 149 llvm::AliasSetTracker X(BAA); 150 X.add(llvm::MemoryLocation()); // for -print-alias-sets 151 (void) llvm::AreStatisticsEnabled(); 152 (void) llvm::sys::RunningOnValgrind(); 153 } 154 } ForcePassLinking; // Force link by creating a global definition. 155 } 156 157 #endif 158