From 2c8039b3a2abf467c5eefa9fc8d1408766ab877d Mon Sep 17 00:00:00 2001 From: Micah Villmow Date: Mon, 8 Oct 2012 16:50:13 +0000 Subject: Make the changes in r165394 be conditional on post LLVM 3.1 changes. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@165405 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Core/Executor.cpp | 14 +++++++++++++- lib/Core/Executor.h | 4 ++++ lib/Core/ExecutorUtil.cpp | 6 +++++- 3 files changed, 22 insertions(+), 2 deletions(-) (limited to 'lib/Core') diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index cd66c0c3..8478ea67 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -64,7 +64,11 @@ #else #include "llvm/Support/Process.h" #endif -#include "llvm/Target/DataLayout.h" +#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1) +#include "llvm/Target/TargetData.h" +#else +#include "llvm/DataLayout.h" +#endif #include #include @@ -346,7 +350,11 @@ const Module *Executor::setModule(llvm::Module *module, kmodule = new KModule(module); // Initialize the context. +#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1) + TargetData *TD = kmodule->targetData; +#else DataLayout *TD = kmodule->targetData; +#endif Context::initialize(TD->isLittleEndian(), (Expr::Width) TD->getPointerSizeInBits()); @@ -384,7 +392,11 @@ Executor::~Executor() { void Executor::initializeGlobalObject(ExecutionState &state, ObjectState *os, const Constant *c, unsigned offset) { +#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1) + TargetData *targetData = kmodule->targetData; +#else DataLayout *targetData = kmodule->targetData; +#endif if (const ConstantVector *cp = dyn_cast(c)) { unsigned elementSize = targetData->getTypeStoreSize(cp->getType()->getElementType()); diff --git a/lib/Core/Executor.h b/lib/Core/Executor.h index d47a3364..7e6b79cd 100644 --- a/lib/Core/Executor.h +++ b/lib/Core/Executor.h @@ -37,7 +37,11 @@ namespace llvm { class Function; class GlobalValue; class Instruction; +#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1) + class TargetData; +#else class DataLayout; +#endif class Twine; class Value; } diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp index c42b0810..0d85afee 100644 --- a/lib/Core/ExecutorUtil.cpp +++ b/lib/Core/ExecutorUtil.cpp @@ -28,7 +28,11 @@ #include "llvm/ModuleProvider.h" #endif #include "llvm/Support/CallSite.h" -#include "llvm/Target/DataLayout.h" +#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1) +#include "llvm/Target/TargetData.h" +#else +#include "llvm/DataLayout.h" +#endif #include #include -- cgit 1.4.1