1 //===-- Utils.cpp - TransformUtils Infrastructure -------------------------===// 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 file defines the common initialization infrastructure for the 10 // TransformUtils library. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "llvm/Transforms/Utils.h" 15 #include "llvm-c/Initialization.h" 16 #include "llvm-c/Transforms/Utils.h" 17 #include "llvm/IR/LegacyPassManager.h" 18 #include "llvm/InitializePasses.h" 19 #include "llvm/PassRegistry.h" 20 21 using namespace llvm; 22 23 /// initializeTransformUtils - Initialize all passes in the TransformUtils 24 /// library. 25 void llvm::initializeTransformUtils(PassRegistry &Registry) { 26 initializeAddDiscriminatorsLegacyPassPass(Registry); 27 initializeAssumeSimplifyPassLegacyPassPass(Registry); 28 initializeAssumeBuilderPassLegacyPassPass(Registry); 29 initializeBreakCriticalEdgesPass(Registry); 30 initializeCanonicalizeAliasesLegacyPassPass(Registry); 31 initializeCanonicalizeFreezeInLoopsPass(Registry); 32 initializeInstNamerPass(Registry); 33 initializeLCSSAWrapperPassPass(Registry); 34 initializeLibCallsShrinkWrapLegacyPassPass(Registry); 35 initializeLoopSimplifyPass(Registry); 36 initializeLowerInvokeLegacyPassPass(Registry); 37 initializeLowerSwitchPass(Registry); 38 initializeNameAnonGlobalLegacyPassPass(Registry); 39 initializePromoteLegacyPassPass(Registry); 40 initializeStripNonLineTableDebugInfoPass(Registry); 41 initializeUnifyFunctionExitNodesPass(Registry); 42 initializeMetaRenamerPass(Registry); 43 initializeStripGCRelocatesPass(Registry); 44 initializePredicateInfoPrinterLegacyPassPass(Registry); 45 initializeInjectTLIMappingsLegacyPass(Registry); 46 initializeFixIrreduciblePass(Registry); 47 initializeUnifyLoopExitsPass(Registry); 48 initializeUniqueInternalLinkageNamesLegacyPassPass(Registry); 49 } 50 51 /// LLVMInitializeTransformUtils - C binding for initializeTransformUtilsPasses. 52 void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) { 53 initializeTransformUtils(*unwrap(R)); 54 } 55 56 void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM) { 57 unwrap(PM)->add(createLowerSwitchPass()); 58 } 59 60 void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) { 61 unwrap(PM)->add(createPromoteMemoryToRegisterPass()); 62 } 63 64 void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM) { 65 unwrap(PM)->add(createAddDiscriminatorsPass()); 66 } 67