LLVM  mainline
IPO.cpp
Go to the documentation of this file.
00001 //===-- IPO.cpp -----------------------------------------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file implements the common infrastructure (including C bindings) for
00011 // libLLVMIPO.a, which implements several transformations over the LLVM
00012 // intermediate representation.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #include "llvm-c/Initialization.h"
00017 #include "llvm-c/Transforms/IPO.h"
00018 #include "llvm/InitializePasses.h"
00019 #include "llvm/IR/LegacyPassManager.h"
00020 #include "llvm/Transforms/IPO.h"
00021 
00022 using namespace llvm;
00023 
00024 void llvm::initializeIPO(PassRegistry &Registry) {
00025   initializeArgPromotionPass(Registry);
00026   initializeConstantMergePass(Registry);
00027   initializeCrossDSOCFIPass(Registry);
00028   initializeDAEPass(Registry);
00029   initializeDAHPass(Registry);
00030   initializeForceFunctionAttrsLegacyPassPass(Registry);
00031   initializeGlobalDCEPass(Registry);
00032   initializeGlobalOptPass(Registry);
00033   initializeIPCPPass(Registry);
00034   initializeAlwaysInlinerPass(Registry);
00035   initializeSimpleInlinerPass(Registry);
00036   initializeInferFunctionAttrsLegacyPassPass(Registry);
00037   initializeInternalizePassPass(Registry);
00038   initializeLoopExtractorPass(Registry);
00039   initializeBlockExtractorPassPass(Registry);
00040   initializeSingleLoopExtractorPass(Registry);
00041   initializeLowerBitSetsPass(Registry);
00042   initializeMergeFunctionsPass(Registry);
00043   initializePartialInlinerPass(Registry);
00044   initializePostOrderFunctionAttrsPass(Registry);
00045   initializeReversePostOrderFunctionAttrsPass(Registry);
00046   initializePruneEHPass(Registry);
00047   initializeStripDeadPrototypesLegacyPassPass(Registry);
00048   initializeStripSymbolsPass(Registry);
00049   initializeStripDebugDeclarePass(Registry);
00050   initializeStripDeadDebugInfoPass(Registry);
00051   initializeStripNonDebugSymbolsPass(Registry);
00052   initializeBarrierNoopPass(Registry);
00053   initializeEliminateAvailableExternallyPass(Registry);
00054   initializeSampleProfileLoaderPass(Registry);
00055   initializeFunctionImportPassPass(Registry);
00056 }
00057 
00058 void LLVMInitializeIPO(LLVMPassRegistryRef R) {
00059   initializeIPO(*unwrap(R));
00060 }
00061 
00062 void LLVMAddArgumentPromotionPass(LLVMPassManagerRef PM) {
00063   unwrap(PM)->add(createArgumentPromotionPass());
00064 }
00065 
00066 void LLVMAddConstantMergePass(LLVMPassManagerRef PM) {
00067   unwrap(PM)->add(createConstantMergePass());
00068 }
00069 
00070 void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM) {
00071   unwrap(PM)->add(createDeadArgEliminationPass());
00072 }
00073 
00074 void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM) {
00075   unwrap(PM)->add(createPostOrderFunctionAttrsPass());
00076 }
00077 
00078 void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM) {
00079   unwrap(PM)->add(createFunctionInliningPass());
00080 }
00081 
00082 void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM) {
00083   unwrap(PM)->add(llvm::createAlwaysInlinerPass());
00084 }
00085 
00086 void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM) {
00087   unwrap(PM)->add(createGlobalDCEPass());
00088 }
00089 
00090 void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM) {
00091   unwrap(PM)->add(createGlobalOptimizerPass());
00092 }
00093 
00094 void LLVMAddIPConstantPropagationPass(LLVMPassManagerRef PM) {
00095   unwrap(PM)->add(createIPConstantPropagationPass());
00096 }
00097 
00098 void LLVMAddPruneEHPass(LLVMPassManagerRef PM) {
00099   unwrap(PM)->add(createPruneEHPass());
00100 }
00101 
00102 void LLVMAddIPSCCPPass(LLVMPassManagerRef PM) {
00103   unwrap(PM)->add(createIPSCCPPass());
00104 }
00105 
00106 void LLVMAddInternalizePass(LLVMPassManagerRef PM, unsigned AllButMain) {
00107   std::vector<const char *> Export;
00108   if (AllButMain)
00109     Export.push_back("main");
00110   unwrap(PM)->add(createInternalizePass(Export));
00111 }
00112 
00113 void LLVMAddStripDeadPrototypesPass(LLVMPassManagerRef PM) {
00114   unwrap(PM)->add(createStripDeadPrototypesPass());
00115 }
00116 
00117 void LLVMAddStripSymbolsPass(LLVMPassManagerRef PM) {
00118   unwrap(PM)->add(createStripSymbolsPass());
00119 }