Silence -Wunused-variable in release builds.
[llvm/stm8.git] / lib / Transforms / Scalar / Scalar.cpp
blob302c287d3cbdfb9d286b0a34d3db86ae558d8606
1 //===-- Scalar.cpp --------------------------------------------------------===//
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 implements common infrastructure for libLLVMScalarOpts.a, which
11 // implements several scalar transformations over the LLVM intermediate
12 // representation, including the C bindings for that library.
14 //===----------------------------------------------------------------------===//
16 #include "llvm-c/Transforms/Scalar.h"
17 #include "llvm-c/Initialization.h"
18 #include "llvm/InitializePasses.h"
19 #include "llvm/PassManager.h"
20 #include "llvm/Analysis/Passes.h"
21 #include "llvm/Analysis/Verifier.h"
22 #include "llvm/Target/TargetData.h"
23 #include "llvm/Transforms/Scalar.h"
25 using namespace llvm;
27 /// initializeScalarOptsPasses - Initialize all passes linked into the
28 /// ScalarOpts library.
29 void llvm::initializeScalarOpts(PassRegistry &Registry) {
30 initializeADCEPass(Registry);
31 initializeBlockPlacementPass(Registry);
32 initializeCodeGenPreparePass(Registry);
33 initializeConstantPropagationPass(Registry);
34 initializeCorrelatedValuePropagationPass(Registry);
35 initializeDCEPass(Registry);
36 initializeDeadInstEliminationPass(Registry);
37 initializeDSEPass(Registry);
38 initializeGVNPass(Registry);
39 initializeEarlyCSEPass(Registry);
40 initializeIndVarSimplifyPass(Registry);
41 initializeJumpThreadingPass(Registry);
42 initializeLICMPass(Registry);
43 initializeLoopDeletionPass(Registry);
44 initializeLoopInstSimplifyPass(Registry);
45 initializeLoopRotatePass(Registry);
46 initializeLoopStrengthReducePass(Registry);
47 initializeLoopUnrollPass(Registry);
48 initializeLoopUnswitchPass(Registry);
49 initializeLoopIdiomRecognizePass(Registry);
50 initializeLowerAtomicPass(Registry);
51 initializeLowerExpectIntrinsicPass(Registry);
52 initializeMemCpyOptPass(Registry);
53 initializeObjCARCAliasAnalysisPass(Registry);
54 initializeObjCARCExpandPass(Registry);
55 initializeObjCARCContractPass(Registry);
56 initializeObjCARCOptPass(Registry);
57 initializeReassociatePass(Registry);
58 initializeRegToMemPass(Registry);
59 initializeSCCPPass(Registry);
60 initializeIPSCCPPass(Registry);
61 initializeSROA_DTPass(Registry);
62 initializeSROA_SSAUpPass(Registry);
63 initializeCFGSimplifyPassPass(Registry);
64 initializeSimplifyLibCallsPass(Registry);
65 initializeSinkingPass(Registry);
66 initializeTailDupPass(Registry);
67 initializeTailCallElimPass(Registry);
70 void LLVMInitializeScalarOpts(LLVMPassRegistryRef R) {
71 initializeScalarOpts(*unwrap(R));
74 void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM) {
75 unwrap(PM)->add(createAggressiveDCEPass());
78 void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM) {
79 unwrap(PM)->add(createCFGSimplificationPass());
82 void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM) {
83 unwrap(PM)->add(createDeadStoreEliminationPass());
86 void LLVMAddGVNPass(LLVMPassManagerRef PM) {
87 unwrap(PM)->add(createGVNPass());
90 void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM) {
91 unwrap(PM)->add(createIndVarSimplifyPass());
94 void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM) {
95 unwrap(PM)->add(createInstructionCombiningPass());
98 void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM) {
99 unwrap(PM)->add(createJumpThreadingPass());
102 void LLVMAddLICMPass(LLVMPassManagerRef PM) {
103 unwrap(PM)->add(createLICMPass());
106 void LLVMAddLoopDeletionPass(LLVMPassManagerRef PM) {
107 unwrap(PM)->add(createLoopDeletionPass());
110 void LLVMAddLoopIdiomPass(LLVMPassManagerRef PM) {
111 unwrap(PM)->add(createLoopIdiomPass());
114 void LLVMAddLoopRotatePass(LLVMPassManagerRef PM) {
115 unwrap(PM)->add(createLoopRotatePass());
118 void LLVMAddLoopUnrollPass(LLVMPassManagerRef PM) {
119 unwrap(PM)->add(createLoopUnrollPass());
122 void LLVMAddLoopUnswitchPass(LLVMPassManagerRef PM) {
123 unwrap(PM)->add(createLoopUnswitchPass());
126 void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM) {
127 unwrap(PM)->add(createMemCpyOptPass());
130 void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) {
131 unwrap(PM)->add(createPromoteMemoryToRegisterPass());
134 void LLVMAddReassociatePass(LLVMPassManagerRef PM) {
135 unwrap(PM)->add(createReassociatePass());
138 void LLVMAddSCCPPass(LLVMPassManagerRef PM) {
139 unwrap(PM)->add(createSCCPPass());
142 void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM) {
143 unwrap(PM)->add(createScalarReplAggregatesPass());
146 void LLVMAddScalarReplAggregatesPassSSA(LLVMPassManagerRef PM) {
147 unwrap(PM)->add(createScalarReplAggregatesPass(-1, false));
150 void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM,
151 int Threshold) {
152 unwrap(PM)->add(createScalarReplAggregatesPass(Threshold));
155 void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM) {
156 unwrap(PM)->add(createSimplifyLibCallsPass());
159 void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM) {
160 unwrap(PM)->add(createTailCallEliminationPass());
163 void LLVMAddConstantPropagationPass(LLVMPassManagerRef PM) {
164 unwrap(PM)->add(createConstantPropagationPass());
167 void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM) {
168 unwrap(PM)->add(createDemoteRegisterToMemoryPass());
171 void LLVMAddVerifierPass(LLVMPassManagerRef PM) {
172 unwrap(PM)->add(createVerifierPass());
175 void LLVMAddCorrelatedValuePropagationPass(LLVMPassManagerRef PM) {
176 unwrap(PM)->add(createCorrelatedValuePropagationPass());
179 void LLVMAddEarlyCSEPass(LLVMPassManagerRef PM) {
180 unwrap(PM)->add(createEarlyCSEPass());
183 void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM) {
184 unwrap(PM)->add(createTypeBasedAliasAnalysisPass());
187 void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM) {
188 unwrap(PM)->add(createBasicAliasAnalysisPass());