Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 1 | //===-- Utils.cpp - TransformUtils Infrastructure -------------------------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame^] | 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 |
Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file defines the common initialization infrastructure for the |
| 10 | // TransformUtils library. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
David Blaikie | a373d18 | 2018-03-28 17:44:36 +0000 | [diff] [blame] | 14 | #include "llvm/Transforms/Utils.h" |
Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 15 | #include "llvm-c/Initialization.h" |
David Blaikie | c90289b | 2018-03-29 22:31:38 +0000 | [diff] [blame] | 16 | #include "llvm-c/Transforms/Utils.h" |
David Blaikie | a373d18 | 2018-03-28 17:44:36 +0000 | [diff] [blame] | 17 | #include "llvm/IR/LegacyPassManager.h" |
Chandler Carruth | 6bda14b | 2017-06-06 11:49:48 +0000 | [diff] [blame] | 18 | #include "llvm/InitializePasses.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 19 | #include "llvm/PassRegistry.h" |
Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 20 | |
| 21 | using namespace llvm; |
| 22 | |
| 23 | /// initializeTransformUtils - Initialize all passes in the TransformUtils |
| 24 | /// library. |
| 25 | void llvm::initializeTransformUtils(PassRegistry &Registry) { |
Xinliang David Li | 1eaecef | 2016-06-15 21:51:30 +0000 | [diff] [blame] | 26 | initializeAddDiscriminatorsLegacyPassPass(Registry); |
Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 27 | initializeBreakCriticalEdgesPass(Registry); |
Teresa Johnson | 853b962 | 2019-01-04 19:04:54 +0000 | [diff] [blame] | 28 | initializeCanonicalizeAliasesLegacyPassPass(Registry); |
Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 29 | initializeInstNamerPass(Registry); |
Easwaran Raman | e12c487 | 2016-06-09 19:44:46 +0000 | [diff] [blame] | 30 | initializeLCSSAWrapperPassPass(Registry); |
Rong Xu | 1c0e9b9 | 2016-10-18 21:36:27 +0000 | [diff] [blame] | 31 | initializeLibCallsShrinkWrapLegacyPassPass(Registry); |
Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 32 | initializeLoopSimplifyPass(Registry); |
Michael Kuperstein | 31b8399 | 2016-08-12 17:28:27 +0000 | [diff] [blame] | 33 | initializeLowerInvokeLegacyPassPass(Registry); |
Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 34 | initializeLowerSwitchPass(Registry); |
Mehdi Amini | 27d2379 | 2016-09-16 16:56:30 +0000 | [diff] [blame] | 35 | initializeNameAnonGlobalLegacyPassPass(Registry); |
Davide Italiano | cccf4f0 | 2016-06-14 03:22:22 +0000 | [diff] [blame] | 36 | initializePromoteLegacyPassPass(Registry); |
Michael Ilseman | e542804 | 2016-10-25 18:44:13 +0000 | [diff] [blame] | 37 | initializeStripNonLineTableDebugInfoPass(Registry); |
Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 38 | initializeUnifyFunctionExitNodesPass(Registry); |
David Blaikie | a373d18 | 2018-03-28 17:44:36 +0000 | [diff] [blame] | 39 | initializeMetaRenamerPass(Registry); |
Anna Thomas | 0860259 | 2016-10-21 18:43:16 +0000 | [diff] [blame] | 40 | initializeStripGCRelocatesPass(Registry); |
Daniel Berlin | 439042b | 2017-02-07 21:10:46 +0000 | [diff] [blame] | 41 | initializePredicateInfoPrinterLegacyPassPass(Registry); |
Owen Anderson | 4698c5d | 2010-10-07 17:55:47 +0000 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | /// LLVMInitializeTransformUtils - C binding for initializeTransformUtilsPasses. |
| 45 | void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) { |
| 46 | initializeTransformUtils(*unwrap(R)); |
| 47 | } |
David Blaikie | a373d18 | 2018-03-28 17:44:36 +0000 | [diff] [blame] | 48 | |
David Blaikie | a373d18 | 2018-03-28 17:44:36 +0000 | [diff] [blame] | 49 | void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM) { |
| 50 | unwrap(PM)->add(createLowerSwitchPass()); |
| 51 | } |
| 52 | |
| 53 | void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) { |
| 54 | unwrap(PM)->add(createPromoteMemoryToRegisterPass()); |
| 55 | } |
| 56 | |