2008-03-16 16:32:40 +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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the C bindings for libLLVMScalarOpts.a, which implements
|
|
|
|
// several scalar transformations over the LLVM intermediate representation.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm-c/Transforms/Scalar.h"
|
|
|
|
#include "llvm/PassManager.h"
|
2010-03-11 23:06:07 +00:00
|
|
|
#include "llvm/Analysis/Verifier.h"
|
|
|
|
#include "llvm/Target/TargetData.h"
|
2008-03-16 16:32:40 +00:00
|
|
|
#include "llvm/Transforms/Scalar.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-03-06 16:52:18 +00:00
|
|
|
void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createAggressiveDCEPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createCFGSimplificationPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createDeadStoreEliminationPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddGVNPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createGVNPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createIndVarSimplifyPass());
|
2008-03-16 16:32:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createInstructionCombiningPass());
|
|
|
|
}
|
|
|
|
|
2009-03-06 16:52:18 +00:00
|
|
|
void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createJumpThreadingPass());
|
2008-03-20 17:16:03 +00:00
|
|
|
}
|
|
|
|
|
2009-03-06 16:52:18 +00:00
|
|
|
void LLVMAddLICMPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createLICMPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddLoopDeletionPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createLoopDeletionPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddLoopIndexSplitPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createLoopIndexSplitPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddLoopRotatePass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createLoopRotatePass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddLoopUnrollPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createLoopUnrollPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddLoopUnswitchPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createLoopUnswitchPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createMemCpyOptPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createPromoteMemoryToRegisterPass());
|
2008-03-20 17:16:03 +00:00
|
|
|
}
|
|
|
|
|
2008-03-16 16:32:40 +00:00
|
|
|
void LLVMAddReassociatePass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createReassociatePass());
|
|
|
|
}
|
|
|
|
|
2009-03-06 16:52:18 +00:00
|
|
|
void LLVMAddSCCPPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createSCCPPass());
|
2008-03-16 16:32:40 +00:00
|
|
|
}
|
|
|
|
|
2009-03-06 16:52:18 +00:00
|
|
|
void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createScalarReplAggregatesPass());
|
|
|
|
}
|
|
|
|
|
2010-03-11 23:06:07 +00:00
|
|
|
void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM,
|
|
|
|
int Threshold) {
|
|
|
|
unwrap(PM)->add(createScalarReplAggregatesPass(Threshold));
|
|
|
|
}
|
|
|
|
|
2009-03-06 16:52:18 +00:00
|
|
|
void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createSimplifyLibCallsPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createTailCallEliminationPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddConstantPropagationPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createConstantPropagationPass());
|
|
|
|
}
|
|
|
|
|
|
|
|
void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createDemoteRegisterToMemoryPass());
|
2008-03-16 16:32:40 +00:00
|
|
|
}
|
2010-03-11 23:06:07 +00:00
|
|
|
|
|
|
|
void LLVMAddVerifierPass(LLVMPassManagerRef PM) {
|
|
|
|
unwrap(PM)->add(createVerifierPass());
|
|
|
|
}
|