LLVM API Documentation

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