Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix compilation on LLVM 3.2

LP #1080123
  • Loading branch information...
commit 9a9a270423820ae87d54935d60dcb35ac2bf9ea5 1 parent ee8fb79
@aajanki aajanki authored
View
17 conf/FindLLVM.cmake
@@ -156,6 +156,23 @@ else (LLVM_INCLUDE_DIR)
IF(HAVE_SUPPORT_TARGETSELECT_H)
ADD_DEFINITIONS(-DHAVE_SUPPORT_TARGETSELECT_H)
ENDIF(HAVE_SUPPORT_TARGETSELECT_H)
+
+ set(CMAKE_REQUIRED_INCLUDES ${LLVM_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_DEFINITIONS -D__STDC_LIMIT_MACROS=1 -D__STDC_CONSTANT_MACROS=1)
+ check_include_file_cxx("llvm/IRBuilder.h" HAVE_IRBUILDER_H)
+ unset(CMAKE_REQUIRED_INCLUDES)
+ MESSAGE(STATUS "HAVE_IRBUILDER_H: " ${HAVE_IRBUILDER_H})
+ IF(HAVE_IRBUILDER_H)
+ ADD_DEFINITIONS(-DHAVE_IRBUILDER_H)
+ ENDIF(HAVE_IRBUILDER_H)
+
+ set(CMAKE_REQUIRED_INCLUDES ${LLVM_INCLUDE_DIR})
+ check_include_file_cxx("llvm/DataLayout.h" HAVE_DATALAYOUT_H)
+ unset(CMAKE_REQUIRED_INCLUDES)
+ MESSAGE(STATUS "HAVE_DATALAYOUT_H: " ${HAVE_DATALAYOUT_H})
+ IF(HAVE_DATALAYOUT_H)
+ ADD_DEFINITIONS(-DHAVE_DATALAYOUT_H)
+ ENDIF(HAVE_DATALAYOUT_H)
exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --cxxflags OUTPUT_VARIABLE LLVM_COMPILE_FLAGS )
MESSAGE(STATUS "LLVM CXX flags: " ${LLVM_COMPILE_FLAGS})
View
10 src/scripting/abc.cpp
@@ -28,7 +28,11 @@
#include <llvm/ExecutionEngine/JIT.h>
#include <llvm/PassManager.h>
#include <llvm/LLVMContext.h>
-#include <llvm/Target/TargetData.h>
+#ifdef HAVE_DATALAYOUT_H
+# include <llvm/DataLayout.h>
+#else
+# include <llvm/Target/TargetData.h>
+#endif
#ifdef HAVE_SUPPORT_TARGETSELECT_H
#include <llvm/Support/TargetSelect.h>
#else
@@ -1459,7 +1463,11 @@ void ABCVm::Run(ABCVm* th)
assert_and_throw(th->ex);
th->FPM=new llvm::FunctionPassManager(th->module);
+#ifdef HAVE_DATALAYOUT_H
+ th->FPM->add(new llvm::DataLayout(*th->ex->getDataLayout()));
+#else
th->FPM->add(new llvm::TargetData(*th->ex->getTargetData()));
+#endif
#ifdef EXPENSIVE_DEBUG
//This is pretty heavy, do not enable in release
th->FPM->add(llvm::createVerifierPass());
View
18 src/scripting/abc_codesynt.cpp
@@ -29,10 +29,18 @@
#include <llvm/DerivedTypes.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/PassManager.h>
-#include <llvm/Constants.h>
-#include <llvm/Support/IRBuilder.h>
+#include <llvm/Constants.h>
+#ifdef HAVE_IRBUILDER_H
+# include <llvm/IRBuilder.h>
+#else
+# include <llvm/Support/IRBuilder.h>
+#endif
#include <llvm/LLVMContext.h>
-#include <llvm/Target/TargetData.h>
+#ifdef HAVE_DATALAYOUT_H
+# include <llvm/DataLayout.h>
+#else
+# include <llvm/Target/TargetData.h>
+#endif
#include <sstream>
#include "scripting/abc.h"
#include "swftypes.h"
@@ -271,7 +279,11 @@ void ABCVm::registerFunctions()
llvm::FunctionType* FT=NULL;
//Create types
+#ifdef HAVE_DATALAYOUT_H
+ ptr_type=ex->getDataLayout()->getIntPtrType(llvm_context());
+#else
ptr_type=ex->getTargetData()->getIntPtrType(llvm_context());
+#endif
//Pointer to 8 bit type, needed for pointer arithmetic
voidptr_type=llvm::IntegerType::get(getVm()->llvm_context(),8)->getPointerTo();
number_type=llvm::Type::getDoubleTy(llvm_context());
Please sign in to comment.
Something went wrong with that request. Please try again.