summaryrefslogtreecommitdiff
blob: 292ace7f64972872d2c1b1fb3f5838832dd460de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
From eaed71005f8cfc1a421790ea2def20882e7d25c3 Mon Sep 17 00:00:00 2001
From: Alessandro Pignotti <a.pignotti@sssup.it>
Date: Mon, 21 May 2012 13:05:36 +0200
Subject: [PATCH] Add support for LLVM 3.1

---
 CMakeLists.txt        |    9 ++++++---
 src/scripting/abc.cpp |   14 +++++++++++++-
 src/scripting/abc.h   |    2 +-
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index be30cb1..6de575b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -229,9 +229,12 @@ ENDIF(${LLVM_STRING_VERSION} VERSION_EQUAL 2.9)
 IF(${LLVM_STRING_VERSION} VERSION_EQUAL 2.8)
 	ADD_DEFINITIONS(-DLLVM_28)
 ENDIF(${LLVM_STRING_VERSION} VERSION_EQUAL 2.8)
-IF(${LLVM_STRING_VERSION} VERSION_GREATER 2.9)
-	ADD_DEFINITIONS(-DLLVM_3)
-ENDIF(${LLVM_STRING_VERSION} VERSION_GREATER 2.9)
+IF(${LLVM_STRING_VERSION} VERSION_EQUAL 3.0)
+	ADD_DEFINITIONS(-DLLVM_30)
+ENDIF(${LLVM_STRING_VERSION} VERSION_EQUAL 3.0)
+IF(${LLVM_STRING_VERSION} VERSION_GREATER 3.0)
+	ADD_DEFINITIONS(-DLLVM_31)
+ENDIF(${LLVM_STRING_VERSION} VERSION_GREATER 3.0)
 INCLUDE(FindZLIB REQUIRED)
 INCLUDE(FindFreetype REQUIRED)
 IF(NOT(ENABLE_GLES2))
diff --git a/src/scripting/abc.cpp b/src/scripting/abc.cpp
index 59700f6..e1d2834 100644
--- a/src/scripting/abc.cpp
+++ b/src/scripting/abc.cpp
@@ -23,7 +23,7 @@
 #include <llvm/ExecutionEngine/JIT.h>
 #include <llvm/LLVMContext.h>
 #include <llvm/Target/TargetData.h>
-#ifdef LLVM_3
+#ifdef LLVM_30
 #include <llvm/Support/TargetSelect.h>
 #else
 #include <llvm/Target/TargetSelect.h>
@@ -1442,14 +1442,26 @@ void ABCVm::Run(ABCVm* th)
 
 	if(th->m_sys->useJit)
 	{
+#ifdef LLVM_31
+		llvm::TargetOptions Opts;
+		Opts.JITExceptionHandling = true;
+#else
 		llvm::JITExceptionHandling = true;
+#endif
 #ifndef NDEBUG
+#ifdef LLVM_31
+		Opts.JITEmitDebugInfo = true;
+#else
 		llvm::JITEmitDebugInfo = true;
 #endif
+#endif
 		llvm::InitializeNativeTarget();
 		th->module=new llvm::Module(llvm::StringRef("abc jit"),th->llvm_context);
 		llvm::EngineBuilder eb(th->module);
 		eb.setEngineKind(llvm::EngineKind::JIT);
+#ifdef LLVM_31
+		eb.setTargetOptions(Opts);
+#endif
 		eb.setOptLevel(llvm::CodeGenOpt::Default);
 		th->ex=eb.create();
 		assert_and_throw(th->ex);
diff --git a/src/scripting/abc.h b/src/scripting/abc.h
index f56a2a7..d3adfeb 100644
--- a/src/scripting/abc.h
+++ b/src/scripting/abc.h
@@ -23,7 +23,7 @@
 #ifdef LLVM_28
 #define alignof alignOf
 #endif
-#ifdef LLVM_3
+#ifdef LLVM_30
 #define LLVMTYPE llvm::Type*
 #define LLVMMAKEARRAYREF(T) makeArrayRef(T)
 #else
-- 
1.7.10