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 initializeBreakCriticalEdgesPass(Registry); 28 initializeCanonicalizeAliasesLegacyPassPass(Registry); 29 initializeInstNamerPass(Registry); 30 initializeLCSSAWrapperPassPass(Registry); 31 initializeLibCallsShrinkWrapLegacyPassPass(Registry); 32 initializeLoopSimplifyPass(Registry); 33 initializeLowerInvokeLegacyPassPass(Registry); 34 initializeLowerSwitchPass(Registry); 35 initializeNameAnonGlobalLegacyPassPass(Registry); 36 initializePromoteLegacyPassPass(Registry); 37 initializeStripNonLineTableDebugInfoPass(Registry); 38 initializeUnifyFunctionExitNodesPass(Registry); 39 initializeMetaRenamerPass(Registry); 40 initializeStripGCRelocatesPass(Registry); 41 initializePredicateInfoPrinterLegacyPassPass(Registry); 42 initializeInjectTLIMappingsLegacyPass(Registry); 43 } 44 45 /// LLVMInitializeTransformUtils - C binding for initializeTransformUtilsPasses. 46 void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) { 47 initializeTransformUtils(*unwrap(R)); 48 } 49 50 void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM) { 51 unwrap(PM)->add(createLowerSwitchPass()); 52 } 53 54 void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) { 55 unwrap(PM)->add(createPromoteMemoryToRegisterPass()); 56 } 57 58 void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM) { 59 unwrap(PM)->add(createAddDiscriminatorsPass()); 60 } 61