blob: bcacd191b794b2d1d2cb5cbc6e9d03b6b188478f [file] [log] [blame]
Owen Anderson4698c5d2010-10-07 17:55:47 +00001//===-- Utils.cpp - TransformUtils Infrastructure -------------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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 Anderson4698c5d2010-10-07 17:55:47 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the common initialization infrastructure for the
10// TransformUtils library.
11//
12//===----------------------------------------------------------------------===//
13
David Blaikiea373d182018-03-28 17:44:36 +000014#include "llvm/Transforms/Utils.h"
Owen Anderson4698c5d2010-10-07 17:55:47 +000015#include "llvm-c/Initialization.h"
David Blaikiec90289b2018-03-29 22:31:38 +000016#include "llvm-c/Transforms/Utils.h"
David Blaikiea373d182018-03-28 17:44:36 +000017#include "llvm/IR/LegacyPassManager.h"
Chandler Carruth6bda14b2017-06-06 11:49:48 +000018#include "llvm/InitializePasses.h"
Chandler Carruth8a8cd2b2014-01-07 11:48:04 +000019#include "llvm/PassRegistry.h"
Owen Anderson4698c5d2010-10-07 17:55:47 +000020
21using namespace llvm;
22
23/// initializeTransformUtils - Initialize all passes in the TransformUtils
24/// library.
25void llvm::initializeTransformUtils(PassRegistry &Registry) {
Xinliang David Li1eaecef2016-06-15 21:51:30 +000026 initializeAddDiscriminatorsLegacyPassPass(Registry);
Owen Anderson4698c5d2010-10-07 17:55:47 +000027 initializeBreakCriticalEdgesPass(Registry);
Teresa Johnson853b9622019-01-04 19:04:54 +000028 initializeCanonicalizeAliasesLegacyPassPass(Registry);
Owen Anderson4698c5d2010-10-07 17:55:47 +000029 initializeInstNamerPass(Registry);
Easwaran Ramane12c4872016-06-09 19:44:46 +000030 initializeLCSSAWrapperPassPass(Registry);
Rong Xu1c0e9b92016-10-18 21:36:27 +000031 initializeLibCallsShrinkWrapLegacyPassPass(Registry);
Owen Anderson4698c5d2010-10-07 17:55:47 +000032 initializeLoopSimplifyPass(Registry);
Michael Kuperstein31b83992016-08-12 17:28:27 +000033 initializeLowerInvokeLegacyPassPass(Registry);
Owen Anderson4698c5d2010-10-07 17:55:47 +000034 initializeLowerSwitchPass(Registry);
Mehdi Amini27d23792016-09-16 16:56:30 +000035 initializeNameAnonGlobalLegacyPassPass(Registry);
Davide Italianocccf4f02016-06-14 03:22:22 +000036 initializePromoteLegacyPassPass(Registry);
Michael Ilsemane5428042016-10-25 18:44:13 +000037 initializeStripNonLineTableDebugInfoPass(Registry);
Owen Anderson4698c5d2010-10-07 17:55:47 +000038 initializeUnifyFunctionExitNodesPass(Registry);
David Blaikiea373d182018-03-28 17:44:36 +000039 initializeMetaRenamerPass(Registry);
Anna Thomas08602592016-10-21 18:43:16 +000040 initializeStripGCRelocatesPass(Registry);
Daniel Berlin439042b2017-02-07 21:10:46 +000041 initializePredicateInfoPrinterLegacyPassPass(Registry);
Owen Anderson4698c5d2010-10-07 17:55:47 +000042}
43
44/// LLVMInitializeTransformUtils - C binding for initializeTransformUtilsPasses.
45void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) {
46 initializeTransformUtils(*unwrap(R));
47}
David Blaikiea373d182018-03-28 17:44:36 +000048
David Blaikiea373d182018-03-28 17:44:36 +000049void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM) {
50 unwrap(PM)->add(createLowerSwitchPass());
51}
52
53void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) {
54 unwrap(PM)->add(createPromoteMemoryToRegisterPass());
55}
56