summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <mulk@minimulk.mst-plus>2008-08-19 17:31:45 +0200
committerMatthias Benkard <mulk@minimulk.mst-plus>2008-08-19 17:31:45 +0200
commit54961d09a75b3b7c3dc411c47567caf0d963dfbf (patch)
tree595deda2e64d3eab421fae8c5f032386ff385e01
parentae57d7eefdb5c22882c6572d5369fa30428efe98 (diff)
Make Toilet Lisp compile with LLVM 2.3.
-rw-r--r--GNUmakefile8
-rw-r--r--MLKLLVMCompiler.mm4
-rw-r--r--Toilet Lisp.xcodeproj/project.pbxproj14
3 files changed, 22 insertions, 4 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 7fb8754..24bfd8f 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -72,11 +72,11 @@ ToiletKit_LDFLAGS = -lgmp -lffi -ldl
USE_LLVM := YES
ifeq ($(USE_LLVM),YES)
-ADDITIONAL_OBJCCFLAGS = $(ADDITIONAL_OBJCFLAGS)
+ADDITIONAL_OBJCCFLAGS += $(ADDITIONAL_OBJCFLAGS)
ToiletKit_OBJC_FILES += MLKLexicalContext-MLKLLVMCompilation.m
-ToiletKit_OBJCC_FILES = MLKLLVMCompiler.mm
-ToiletKit_OBJCFLAGS = -DUSE_LLVM
-ToiletKit_OBJCCFLAGS = -DUSE_LLVM `llvm-config --cxxflags` $(ToiletKit_OBJCFLAGS)
+ToiletKit_OBJCC_FILES += MLKLLVMCompiler.mm
+ToiletKit_OBJCFLAGS += -DUSE_LLVM -DLLVM_MAJOR_VERSION=`llvm-config --version | cut -f 1 -d.` -DLLVM_MINOR_VERSION=`llvm-config --version | cut -f 2 -d. | sed s/svn//`
+ToiletKit_OBJCCFLAGS += `llvm-config --cxxflags` $(ToiletKit_OBJCFLAGS)
ToiletKit_LDFLAGS += `llvm-config --ldflags` `llvm-config --libs backend engine linker codegen transformutils scalaropts analysis ipo`
endif
diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm
index aa0ab79..745be44 100644
--- a/MLKLLVMCompiler.mm
+++ b/MLKLLVMCompiler.mm
@@ -51,7 +51,11 @@ using namespace llvm;
static ExecutionEngine *execution_engine;
static llvm::Module *module;
+#if defined(LLVM_MAJOR_VERSION) && (LLVM_MAJOR_VERSION <= 2) && (LLVM_MINOR_VERSION <= 3)
+static IRBuilder builder;
+#else
static IRBuilder<true, ConstantFolder> builder;
+#endif
static FunctionPassManager *fpm;
static PointerType *PointerTy;
static ModuleProvider *module_provider;
diff --git a/Toilet Lisp.xcodeproj/project.pbxproj b/Toilet Lisp.xcodeproj/project.pbxproj
index 038bebb..acb9d51 100644
--- a/Toilet Lisp.xcodeproj/project.pbxproj
+++ b/Toilet Lisp.xcodeproj/project.pbxproj
@@ -308,6 +308,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ A720D3670E5B1CB700734638 /* GNUmakefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; languageSpecificationIdentifier = make; path = GNUmakefile; sourceTree = "<group>"; };
A72E9E370E51CB0500BDE40F /* MLKCompiledClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLKCompiledClosure.h; sourceTree = "<group>"; };
A72E9E390E51CB1300BDE40F /* MLKCompiledClosure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLKCompiledClosure.m; sourceTree = "<group>"; };
A72E9E6B0E5220A200BDE40F /* MLKLexicalContext-MLKLLVMCompilation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "MLKLexicalContext-MLKLLVMCompilation.mm"; sourceTree = "<group>"; };
@@ -543,6 +544,7 @@
A7E5C3CC0E21682800A01D81 = {
isa = PBXGroup;
children = (
+ A720D3670E5B1CB700734638 /* GNUmakefile */,
A7A834A40E477B86005D64E0 /* Lisp Files */,
A7E5C55B0E21740C00A01D81 /* Foundation.framework */,
A7E5C48D0E216A0E00A01D81 /* Source Files */,
@@ -885,6 +887,8 @@
OTHER_CFLAGS = (
"-DHAVE_FFI_H",
"-DUSE_LLVM",
+ "-DLLVM_MAJOR_VERSION=2",
+ "-DLLVM_MINOR_VERSION=3",
);
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
@@ -989,6 +993,8 @@
OTHER_CFLAGS = (
"-DHAVE_FFI_H",
"-DUSE_LLVM",
+ "-DLLVM_MAJOR_VERSION=2",
+ "-DLLVM_MINOR_VERSION=3",
);
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
@@ -1097,6 +1103,8 @@
OTHER_CFLAGS = (
"-DHAVE_FFI_H",
"-DUSE_LLVM",
+ "-DLLVM_MAJOR_VERSION=2",
+ "-DLLVM_MINOR_VERSION=3",
);
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
@@ -1167,6 +1175,8 @@
OTHER_CFLAGS = (
"-DHAVE_FFI_H",
"-DUSE_LLVM",
+ "-DLLVM_MAJOR_VERSION=2",
+ "-DLLVM_MINOR_VERSION=3",
);
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
@@ -1330,6 +1340,8 @@
OTHER_CFLAGS = (
"-DHAVE_FFI_H",
"-DUSE_LLVM",
+ "-DLLVM_MAJOR_VERSION=2",
+ "-DLLVM_MINOR_VERSION=3",
);
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
@@ -1398,6 +1410,8 @@
OTHER_CFLAGS = (
"-DHAVE_FFI_H",
"-DUSE_LLVM",
+ "-DLLVM_MAJOR_VERSION=2",
+ "-DLLVM_MINOR_VERSION=3",
);
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",