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   initializeDAEPass(Registry);
00028   initializeDAHPass(Registry);
00029   initializeFunctionAttrsPass(Registry);
00030   initializeGlobalDCEPass(Registry);
00031   initializeGlobalOptPass(Registry);
00032   initializeIPCPPass(Registry);
00033   initializeAlwaysInlinerPass(Registry);
00034   initializeSimpleInlinerPass(Registry);
00035   initializeInternalizePassPass(Registry);
00036   initializeLoopExtractorPass(Registry);
00037   initializeBlockExtractorPassPass(Registry);
00038   initializeSingleLoopExtractorPass(Registry);
00039   initializeLowerBitSetsPass(Registry);
00040   initializeMergeFunctionsPass(Registry);
00041   initializePartialInlinerPass(Registry);
00042   initializePruneEHPass(Registry);
00043   initializeStripDeadPrototypesPassPass(Registry);
00044   initializeStripSymbolsPass(Registry);
00045   initializeStripDebugDeclarePass(Registry);
00046   initializeStripDeadDebugInfoPass(Registry);
00047   initializeStripNonDebugSymbolsPass(Registry);
00048   initializeBarrierNoopPass(Registry);
00049 }
00050 
00051 void LLVMInitializeIPO(LLVMPassRegistryRef R) {
00052   initializeIPO(*unwrap(R));
00053 }
00054 
00055 void LLVMAddArgumentPromotionPass(LLVMPassManagerRef PM) {
00056   unwrap(PM)->add(createArgumentPromotionPass());
00057 }
00058 
00059 void LLVMAddConstantMergePass(LLVMPassManagerRef PM) {
00060   unwrap(PM)->add(createConstantMergePass());
00061 }
00062 
00063 void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM) {
00064   unwrap(PM)->add(createDeadArgEliminationPass());
00065 }
00066 
00067 void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM) {
00068   unwrap(PM)->add(createFunctionAttrsPass());
00069 }
00070 
00071 void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM) {
00072   unwrap(PM)->add(createFunctionInliningPass());
00073 }
00074 
00075 void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM) {
00076   unwrap(PM)->add(llvm::createAlwaysInlinerPass());
00077 }
00078 
00079 void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM) {
00080   unwrap(PM)->add(createGlobalDCEPass());
00081 }
00082 
00083 void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM) {
00084   unwrap(PM)->add(createGlobalOptimizerPass());
00085 }
00086 
00087 void LLVMAddIPConstantPropagationPass(LLVMPassManagerRef PM) {
00088   unwrap(PM)->add(createIPConstantPropagationPass());
00089 }
00090 
00091 void LLVMAddPruneEHPass(LLVMPassManagerRef PM) {
00092   unwrap(PM)->add(createPruneEHPass());
00093 }
00094 
00095 void LLVMAddIPSCCPPass(LLVMPassManagerRef PM) {
00096   unwrap(PM)->add(createIPSCCPPass());
00097 }
00098 
00099 void LLVMAddInternalizePass(LLVMPassManagerRef PM, unsigned AllButMain) {
00100   std::vector<const char *> Export;
00101   if (AllButMain)
00102     Export.push_back("main");
00103   unwrap(PM)->add(createInternalizePass(Export));
00104 }
00105 
00106 void LLVMAddStripDeadPrototypesPass(LLVMPassManagerRef PM) {
00107   unwrap(PM)->add(createStripDeadPrototypesPass());
00108 }
00109 
00110 void LLVMAddStripSymbolsPass(LLVMPassManagerRef PM) {
00111   unwrap(PM)->add(createStripSymbolsPass());
00112 }