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