From 11112e0d7b1fb2741ed65a5085037918d1425916 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sat, 7 Aug 2010 00:43:20 +0000 Subject: [PATCH] Tidy some #includes and forward-declarations, and move the C binding code out of PassManager.cpp and into Core.cpp with the rest of the C binding code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110494 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/AsmPrinter.h | 1 + include/llvm/PassManager.h | 1 - include/llvm/PassSupport.h | 2 -- lib/CodeGen/ELFWriter.h | 1 + lib/VMCore/Core.cpp | 37 +++++++++++++++++++++++++++++++++++++ lib/VMCore/Pass.cpp | 5 ----- lib/VMCore/PassManager.cpp | 36 ------------------------------------ 7 files changed, 39 insertions(+), 44 deletions(-) diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 27248de1616..62a18fe2511 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -54,6 +54,7 @@ namespace llvm { class Mangler; class TargetLoweringObjectFile; class TargetData; + class TargetMachine; class Twine; class Type; diff --git a/include/llvm/PassManager.h b/include/llvm/PassManager.h index 8de0f8342d7..c8b5dcaf0f2 100644 --- a/include/llvm/PassManager.h +++ b/include/llvm/PassManager.h @@ -22,7 +22,6 @@ namespace llvm { class Pass; -class ModulePass; class Module; class PassManagerImpl; diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 0ca955ba6b8..0f559d6df73 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -26,8 +26,6 @@ namespace llvm { -class TargetMachine; - //===--------------------------------------------------------------------------- /// PassInfo class - An instance of this class exists for every pass known by /// the system, and can be obtained from a live Pass by calling its diff --git a/lib/CodeGen/ELFWriter.h b/lib/CodeGen/ELFWriter.h index fb036f2adac..b8bac5598ec 100644 --- a/lib/CodeGen/ELFWriter.h +++ b/lib/CodeGen/ELFWriter.h @@ -39,6 +39,7 @@ namespace llvm { class raw_ostream; class SectionKind; class MCContext; + class TargetMachine; typedef std::vector::iterator ELFSymIter; typedef std::vector::iterator ELFSectionIter; diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index 39f3d591a78..e42a68baff9 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -22,6 +22,7 @@ #include "llvm/TypeSymbolTable.h" #include "llvm/InlineAsm.h" #include "llvm/IntrinsicInst.h" +#include "llvm/PassManager.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" @@ -2231,3 +2232,39 @@ LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf) { delete unwrap(MemBuf); } + + +/*===-- Pass Manager ------------------------------------------------------===*/ + +LLVMPassManagerRef LLVMCreatePassManager() { + return wrap(new PassManager()); +} + +LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M) { + return wrap(new FunctionPassManager(unwrap(M))); +} + +LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P) { + return LLVMCreateFunctionPassManagerForModule( + reinterpret_cast(P)); +} + +LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M) { + return unwrap(PM)->run(*unwrap(M)); +} + +LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM) { + return unwrap(FPM)->doInitialization(); +} + +LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F) { + return unwrap(FPM)->run(*unwrap(F)); +} + +LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM) { + return unwrap(FPM)->doFinalization(); +} + +void LLVMDisposePassManager(LLVMPassManagerRef PM) { + delete unwrap(PM); +} diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index fb23fbfbe15..41a87d60ad6 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -17,19 +17,14 @@ #include "llvm/PassManager.h" #include "llvm/PassRegistry.h" #include "llvm/Module.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/Assembly/PrintModulePass.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PassNameParser.h" #include "llvm/Support/raw_ostream.h" #include "llvm/System/Atomic.h" #include "llvm/System/Mutex.h" #include "llvm/System/Threading.h" -#include -#include -#include using namespace llvm; //===----------------------------------------------------------------------===// diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 675fb2cafe9..ae10b4c200a 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -25,7 +25,6 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/System/Mutex.h" #include "llvm/System/Threading.h" -#include "llvm-c/Core.h" #include #include #include @@ -1814,38 +1813,3 @@ void BasicBlockPass::assignPassManager(PMStack &PMS, } PassManagerBase::~PassManagerBase() {} - -/*===-- C Bindings --------------------------------------------------------===*/ - -LLVMPassManagerRef LLVMCreatePassManager() { - return wrap(new PassManager()); -} - -LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M) { - return wrap(new FunctionPassManager(unwrap(M))); -} - -LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P) { - return LLVMCreateFunctionPassManagerForModule( - reinterpret_cast(P)); -} - -LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M) { - return unwrap(PM)->run(*unwrap(M)); -} - -LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM) { - return unwrap(FPM)->doInitialization(); -} - -LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F) { - return unwrap(FPM)->run(*unwrap(F)); -} - -LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM) { - return unwrap(FPM)->doFinalization(); -} - -void LLVMDisposePassManager(LLVMPassManagerRef PM) { - delete unwrap(PM); -} -- 2.11.0