2009-03-06 16:52:18 +00:00
|
|
|
//===-- Scalar.cpp --------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2010-10-07 18:09:59 +00:00
|
|
|
// This file implements the common infrastructure (including C bindings) for
|
|
|
|
// libLLVMIPO.a, which implements several transformations over the LLVM
|
|
|
|
// intermediate representation.
|
2009-03-06 16:52:18 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm-c/Transforms/IPO.h"
|
2010-10-07 18:09:59 +00:00
|
|
|
#include "llvm/InitializePasses.h"
|
2009-03-06 16:52:18 +00:00
|
|
|
#include "llvm/PassManager.h"
|
|
|
|
#include "llvm/Transforms/IPO.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2010-10-07 18:09:59 +00:00
|
|
|
void llvm::initializeIPO(PassRegistry &Registry) {
|
|
|
|
initializeArgPromotionPass(Registry);
|
|
|
|
initializeConstantMergePass(Registry);
|
|
|
|
initializeDAEPass(Registry);
|
|
|
|
initializeDAHPass(Registry);
|
|
|
|
initializeFunctionAttrsPass(Registry);
|
|
|
|
initializeGlobalDCEPass(Registry);
|
|
|
|
initializeGlobalOptPass(Registry);
|
|
|
|
initializeIPCPPass(Registry);
|
|
|
|
initializeAlwaysInlinerPass(Registry);
|
|
|
|
initializeSimpleInlinerPass(Registry);
|
|
|
|
initializeInternalizePassPass(Registry);
|
|
|
|
initializeLoopExtractorPass(Registry);
|
|
|
|
initializeBlockExtractorPassPass(Registry);
|
|
|
|
initializeSingleLoopExtractorPass(Registry);
|
|
|
|
initializeMergeFunctionsPass(Registry);
|
|
|
|
initializePartialInlinerPass(Registry);
|
|
|
|
initializePruneEHPass(Registry);
|
|
|
|
initializeStripDeadPrototypesPassPass(Registry);
|
|
|
|
initializeStripSymbolsPass(Registry);
|
|
|
|
initializeStripDebugDeclarePass(Registry);
|
|
|
|
initializeStripDeadDebugInfoPass(Registry);
|
|
|
|
initializeStripNonDebugSymbolsPass(Registry);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMInitializeIPO(LLVMPassRegistryRef R) {
|
|
|
|
initializeIPO(*unwrap(R));
|
|
|
|
}
|
|
|
|
|
2009-03-06 16:52:18 +00:00
|
|
|
void LLVMAddArgumentPromotionPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createArgumentPromotionPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddConstantMergePass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createConstantMergePass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createDeadArgEliminationPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createFunctionAttrsPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createFunctionInliningPass());
|
|
|
|
}
|
|
|
|
|
2011-07-26 15:23:23 +00:00
|
|
|
void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(llvm::createAlwaysInlinerPass());
|
|
|
|
}
|
|
|
|
|
2009-03-06 16:52:18 +00:00
|
|
|
void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createGlobalDCEPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createGlobalOptimizerPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddIPConstantPropagationPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createIPConstantPropagationPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddPruneEHPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createPruneEHPass());
|
|
|
|
}
|
|
|
|
|
2010-04-09 20:43:20 +00:00
|
|
|
void LLVMAddIPSCCPPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createIPSCCPPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddInternalizePass(LLVMPassManagerRef PM, unsigned AllButMain) {
|
|
|
|
unwrap(PM)->add(createInternalizePass(AllButMain != 0));
|
|
|
|
}
|
|
|
|
|
2009-03-06 16:52:18 +00:00
|
|
|
void LLVMAddStripDeadPrototypesPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createStripDeadPrototypesPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddStripSymbolsPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createStripSymbolsPass());
|
|
|
|
}
|