1 //===-- Utils.cpp - TransformUtils Infrastructure -------------------------===// 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 file defines the common initialization infrastructure for the 11 // TransformUtils library. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #include "llvm/Transforms/Utils.h" 16 #include "llvm-c/Initialization.h" 17 #include "llvm-c/Transforms/Utils.h" 18 #include "llvm/IR/LegacyPassManager.h" 19 #include "llvm/InitializePasses.h" 20 #include "llvm/PassRegistry.h" 21 22 using namespace llvm; 23 24 /// initializeTransformUtils - Initialize all passes in the TransformUtils 25 /// library. 26 void llvm::initializeTransformUtils(PassRegistry &Registry) { 27 initializeAddDiscriminatorsLegacyPassPass(Registry); 28 initializeBreakCriticalEdgesPass(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 initializeInstSimplifierPass(Registry); 40 initializeMetaRenamerPass(Registry); 41 initializeStripGCRelocatesPass(Registry); 42 initializePredicateInfoPrinterLegacyPassPass(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