Update optimisation to work with LLVM trunk, remove the Makefile and use CMake for building the passes (out of tree builds are now easier).

main
theraven 14 years ago
parent 2d835cffa6
commit 8cf5e0412f

@ -1,3 +1,11 @@
find_package(LLVM)
include(AddLLVM)
add_definitions(${LLVM_DEFINITIONS})
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})
add_llvm_loadable_module( libGNUObjCRuntime add_llvm_loadable_module( libGNUObjCRuntime
ClassIMPCache.cpp ClassIMPCache.cpp
ClassMethodInliner.cpp ClassMethodInliner.cpp
@ -10,13 +18,15 @@ add_llvm_loadable_module( libGNUObjCRuntime
TypeFeedback.cpp TypeFeedback.cpp
) )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-variadic-macros -DLLVM_MAJOR=3 -DLLVM_MINOR=0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-variadic-macros -DLLVM_MAJOR=3 -DLLVM_MINOR=2")
set(CMAKE_CXX "clang++")
EXEC_PROGRAM(llvm-config
ARGS --src-root
OUTPUT_VARIABLE LLVM_SRC)
EXEC_PROGRAM(llvm-config
ARGS --obj-root
OUTPUT_VARIABLE LLVM_OBJ)
include_directories( ${LLVM_INCLUDE_DIRS} "${LLVM_SRC}/include/" "${LLVM_OBJ}/include/")
add_llvm_library_dependencies( libGNUObjCRuntime
LLVMAnalysis
LLVMCore
LLVMSupport
LLVMTarget
LLVMipa
LLVMipo
)

@ -6,7 +6,6 @@
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/GlobalVariable.h" #include "llvm/GlobalVariable.h"
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#include "llvm/Support/IRBuilder.h"
#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopInfo.h"
#include "llvm/DefaultPasses.h" #include "llvm/DefaultPasses.h"
#include "ObjectiveCOpts.h" #include "ObjectiveCOpts.h"

@ -4,7 +4,6 @@
#include "llvm/Instructions.h" #include "llvm/Instructions.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/GlobalVariable.h" #include "llvm/GlobalVariable.h"
#include "llvm/Support/IRBuilder.h"
#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringMap.h"
#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopInfo.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h"

@ -6,7 +6,6 @@
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/LLVMContext.h" #include "llvm/LLVMContext.h"
#include "llvm/GlobalVariable.h" #include "llvm/GlobalVariable.h"
#include "llvm/Support/IRBuilder.h"
#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/InlineCost.h" #include "llvm/Analysis/InlineCost.h"
#include "llvm/DefaultPasses.h" #include "llvm/DefaultPasses.h"

@ -7,7 +7,6 @@
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/LLVMContext.h" #include "llvm/LLVMContext.h"
#include "llvm/Metadata.h" #include "llvm/Metadata.h"
#include "llvm/Support/IRBuilder.h"
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/Cloning.h"

@ -10,7 +10,11 @@
#include <llvm/Instructions.h> #include <llvm/Instructions.h>
#include <llvm/Metadata.h> #include <llvm/Metadata.h>
#include <llvm/Intrinsics.h> #include <llvm/Intrinsics.h>
#if LLVM_MAJOR < 3 || (LLVM_MAJOR >=3 && LLVM_MINOR < 2)
#include <llvm/Support/IRBuilder.h> #include <llvm/Support/IRBuilder.h>
#else
#include <llvm/IRBuilder.h>
#endif
// Only preserve names in a debug build. This simplifies the // Only preserve names in a debug build. This simplifies the

@ -4,7 +4,6 @@
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Instructions.h" #include "llvm/Instructions.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/Support/IRBuilder.h"
#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/Verifier.h" #include "llvm/Analysis/Verifier.h"
#include "llvm/DefaultPasses.h" #include "llvm/DefaultPasses.h"

@ -1,8 +0,0 @@
LEVEL = ../../../
LIBRARYNAME = libGNUObjCRuntime
LOADABLE_MODULE = 1
USEDLIBS =
CPPFLAGS += `llvm-config --version | sed 's/\([0-9]*\).\([0-9]*\).*/-DLLVM_MAJOR=\1 -DLLVM_MINOR=\2/'`
CPPFLAGS += -Wno-variadic-macros
include $(LEVEL)/Makefile.common

@ -4,7 +4,6 @@
#include "llvm/Function.h" #include "llvm/Function.h"
#include "llvm/Instructions.h" #include "llvm/Instructions.h"
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#include "llvm/Support/IRBuilder.h"
#include "llvm/Linker.h" #include "llvm/Linker.h"
#include <vector> #include <vector>
@ -131,7 +130,12 @@ namespace {
ctors.size()), ctors)); ctors.size()), ctors));
// Create the new global and replace the old one // Create the new global and replace the old one
GlobalVariable *NGV = new GlobalVariable(CA->getType(), GlobalVariable *NGV = new GlobalVariable(CA->getType(),
GCL->isConstant(), GCL->getLinkage(), CA, "", GCL->isThreadLocal()); GCL->isConstant(), GCL->getLinkage(), CA, "",
#if LLVM_MAJOR < 3 || (LLVM_MAJOR == 3 && LLVM_MINOR < 2)
GCL->isThreadLocal());
#else
GCL-> getThreadLocalMode());
#endif
GCL->getParent()->getGlobalList().insert(GCL, NGV); GCL->getParent()->getGlobalList().insert(GCL, NGV);
NGV->takeName(GCL); NGV->takeName(GCL);
GCL->replaceAllUsesWith(NGV); GCL->replaceAllUsesWith(NGV);

@ -3,7 +3,6 @@
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Function.h" #include "llvm/Function.h"
#include "llvm/Instructions.h" #include "llvm/Instructions.h"
#include "llvm/Support/IRBuilder.h"
#include "llvm/Analysis/InlineCost.h" #include "llvm/Analysis/InlineCost.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Linker.h" #include "llvm/Linker.h"

@ -6,7 +6,6 @@
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/LLVMContext.h" #include "llvm/LLVMContext.h"
#include "llvm/Metadata.h" #include "llvm/Metadata.h"
#include "llvm/Support/IRBuilder.h"
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/Cloning.h"

Loading…
Cancel
Save