From 347795c5d2dbc2815d395e60a08ad3debca68102 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Fri, 7 Feb 2014 21:04:22 +0100 Subject: Use SmallString and llvm::sys::path/fs API of LLVM 3.4 because Old Path API was removed --- lib/Module/KModule.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/Module') diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index 2ecb14b8..5f03728b 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -375,6 +375,11 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, // FIXME: Find a way that we can test programs without requiring // this to be linked in, it makes low level debugging much more // annoying. +#if LLVM_VERSION_CODE >= LLVM_VERSION(3,4) + SmallString<128> LibPath(opts.LibraryDir); + llvm::sys::path::append(LibPath, "kleeRuntimeIntrinsic.bc"); + module = linkWithLibrary(module, LibPath.str()); +#else llvm::sys::Path path(opts.LibraryDir); #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3) path.appendComponent("kleeRuntimeIntrinsic.bc"); @@ -382,6 +387,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, path.appendComponent("libkleeRuntimeIntrinsic.bca"); #endif module = linkWithLibrary(module, path.c_str()); +#endif // Add internal functions which are not used to check if instructions // have been already visited -- cgit v1.2.3 From f2ce7b5b53d78c370b01f5f219df0ea0021c7bb2 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Mon, 10 Feb 2014 08:56:56 +0100 Subject: Add missing include file for LLVM 3.4 --- lib/Module/ModuleUtil.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/Module') diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp index 58096de4..4f65d0e7 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -13,6 +13,10 @@ #include "../Core/Common.h" #include "../Core/SpecialFunctionHandler.h" +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 4) +#include "llvm/IR/LLVMContext.h" +#endif + #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3) #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/IR/Function.h" -- cgit v1.2.3 From 4a9a908739d7d7c833e7985ea7465d95c0dd0b82 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Wed, 2 Apr 2014 21:44:51 +0100 Subject: Tidy up code by using LLVM's V2 path API only and removing uses of old V1 path API. LLVM2.9 supports LLVM's V2 path API. Because that is the minimum version we support we should just use this API everywhere so we reduce the number of #if LLVM_VERSION_CODE macros and duplicated code. --- lib/Module/KModule.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'lib/Module') diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index 5f03728b..e06e722a 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -375,19 +375,16 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, // FIXME: Find a way that we can test programs without requiring // this to be linked in, it makes low level debugging much more // annoying. -#if LLVM_VERSION_CODE >= LLVM_VERSION(3,4) + SmallString<128> LibPath(opts.LibraryDir); - llvm::sys::path::append(LibPath, "kleeRuntimeIntrinsic.bc"); - module = linkWithLibrary(module, LibPath.str()); -#else - llvm::sys::Path path(opts.LibraryDir); -#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3) - path.appendComponent("kleeRuntimeIntrinsic.bc"); + llvm::sys::path::append(LibPath, +#if LLVM_VERSION_CODE >= LLVM_VERSION(3,3) + "kleeRuntimeIntrinsic.bc" #else - path.appendComponent("libkleeRuntimeIntrinsic.bca"); -#endif - module = linkWithLibrary(module, path.c_str()); + "libkleeRuntimeIntrinsic.bca" #endif + ); + module = linkWithLibrary(module, LibPath.str()); // Add internal functions which are not used to check if instructions // have been already visited -- cgit v1.2.3 From f8f8da3c374ac926e8d0eca4cca83d8a8a095b26 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Thu, 3 Apr 2014 15:30:52 +0100 Subject: Do not add SimplifyLibCallsPass for LLVM 3.4 and newer because it has been removed. From the LLVM 3.4 release notes: " The library call simplification pass has been removed. Its functionality has been integrated into the instruction combiner and function attribute marking passes. " --- lib/Module/Optimize.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/Module') diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp index 41a106f1..9c200bc8 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp @@ -124,7 +124,9 @@ static void AddStandardCompilePasses(PassManager &PM) { addPass(PM, createFunctionInliningPass()); // Inline small functions addPass(PM, createArgumentPromotionPass()); // Scalarize uninlined fn args +#if LLVM_VERSION_CODE < LLVM_VERSION(3, 4) addPass(PM, createSimplifyLibCallsPass()); // Library Call Optimizations +#endif addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl. addPass(PM, createJumpThreadingPass()); // Thread jumps. addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs -- cgit v1.2.3