]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Transforms/Utils/Utils.cpp
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Transforms / Utils / Utils.cpp
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   initializeMetaRenamerPass(Registry);
40   initializeStripGCRelocatesPass(Registry);
41   initializePredicateInfoPrinterLegacyPassPass(Registry);
42 }
43
44 /// LLVMInitializeTransformUtils - C binding for initializeTransformUtilsPasses.
45 void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) {
46   initializeTransformUtils(*unwrap(R));
47 }
48
49 void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM) {
50   unwrap(PM)->add(createLowerSwitchPass());
51 }
52
53 void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) {
54   unwrap(PM)->add(createPromoteMemoryToRegisterPass());
55 }
56