1 From 7cd248aa7938a068663fcd605169b7d4e21636bf Mon Sep 17 00:00:00 2001
2 From: Tom Stellard <thomas.stellard@amd.com>
3 Date: Wed, 13 Feb 2013 20:59:41 +0000
4 Subject: radeon/llvm: Fix build with LLVM 3.3
7 diff --git a/src/gallium/drivers/r600/llvm_wrapper.cpp b/src/gallium/drivers/r600/llvm_wrapper.cpp
8 index 81f5397..ae2f4d2 100644
9 --- a/src/gallium/drivers/r600/llvm_wrapper.cpp
10 +++ b/src/gallium/drivers/r600/llvm_wrapper.cpp
12 #include <llvm/ADT/OwningPtr.h>
13 #include <llvm/ADT/StringRef.h>
14 +#if HAVE_LLVM < 0x0303
15 #include <llvm/LLVMContext.h>
17 +#include <llvm/IR/LLVMContext.h>
19 #include <llvm/PassManager.h>
20 #include <llvm/Support/IRReader.h>
21 #include <llvm/Support/MemoryBuffer.h>
22 diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
23 index 903e102..0491e64 100644
24 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
25 +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
28 #include "radeon_llvm_emit.h"
30 +#if HAVE_LLVM < 0x0303
31 #include <llvm/LLVMContext.h>
32 #include <llvm/Module.h>
33 +#include <llvm/DataLayout.h>
35 +#include <llvm/IR/LLVMContext.h>
36 +#include <llvm/IR/Module.h>
37 +#include <llvm/IR/DataLayout.h>
40 #include <llvm/PassManager.h>
41 #include <llvm/ADT/Triple.h>
42 #include <llvm/Support/FormattedStream.h>
44 #include <llvm/Target/TargetMachine.h>
45 #include <llvm/Transforms/Scalar.h>
46 #include <llvm-c/Target.h>
47 -#include <llvm/DataLayout.h>
53 From 1f006717db5258e703d83b37772b85ad25bf3319 Mon Sep 17 00:00:00 2001
54 From: Tom Stellard <thomas.stellard@amd.com>
55 Date: Wed, 13 Feb 2013 20:57:25 +0000
56 Subject: r600g: Add $(DEFINES) to AM_CXXFLAGS
58 This way llvm_wrapper.cpp is compiled with -DHAVE_LLVM=0x....
60 (limited to 'src/gallium')
62 diff --git a/src/gallium/drivers/r600/Makefile.am b/src/gallium/drivers/r600/Makefile.am
63 index 6f48b56..e1c8574 100644
64 --- a/src/gallium/drivers/r600/Makefile.am
65 +++ b/src/gallium/drivers/r600/Makefile.am
66 @@ -26,7 +26,8 @@ AM_CFLAGS += \
67 -I$(top_srcdir)/src/gallium/drivers/radeon/
75 if USE_R600_LLVM_COMPILER
78 From ead4db420e9e5408f41c70768a290592a384aedb Mon Sep 17 00:00:00 2001
79 From: Tom Stellard <thomas.stellard@amd.com>
80 Date: Tue, 23 Apr 2013 14:57:54 +0000
81 Subject: gallivm: Fix build with LLVM >= r180063
84 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
85 index 024819e..717afa7 100644
86 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
87 +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
89 #include <llvm/Target/TargetSelect.h>
90 #endif /* HAVE_LLVM < 0x0300 */
92 +#if HAVE_LLVM >= 0x0303
93 +#include <llvm/Wrap.h>
96 #include "pipe/p_config.h"
97 #include "util/u_debug.h"
98 #include "util/u_cpu_detect.h"
100 cgit v0.9.0.2-2-gbebe
101 From a0c8942bb4742b4bd22f494cea4dcd59d9ca99ab Mon Sep 17 00:00:00 2001
102 From: Tom Stellard <thomas.stellard@amd.com>
103 Date: Tue, 23 Apr 2013 14:58:38 +0000
104 Subject: radeon/llvm: Fix build with LLVM >= r180063
107 diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
108 index d2dc035..5b770d0 100644
109 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
110 +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
112 #include <llvm/Support/Threading.h>
113 #include <llvm/Target/TargetMachine.h>
114 #include <llvm/Transforms/Scalar.h>
115 +#include <llvm/Wrap.h>
116 #include <llvm-c/Target.h>
120 cgit v0.9.0.2-2-gbebe
121 From 6249db73ea580e6a54874235ffb3a7d42ac63bb4 Mon Sep 17 00:00:00 2001
122 From: Christian König <christian.koenig@amd.com>
123 Date: Tue, 26 Mar 2013 10:37:45 +0000
124 Subject: radeon/llvm: remove uneeded inclusion
126 The include isn't needed and the file has moved with LLVM master.
128 Signed-off-by: Christian König <christian.koenig@amd.com>
129 Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
131 (limited to 'src/gallium/drivers/radeon/radeon_llvm_emit.cpp')
133 diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
134 index ee82a90..a23532b 100644
135 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
136 +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
138 #include <llvm/ADT/Triple.h>
139 #include <llvm/Support/FormattedStream.h>
140 #include <llvm/Support/Host.h>
141 -#include <llvm/Support/IRReader.h>
142 #include <llvm/Support/SourceMgr.h>
143 #include <llvm/Support/TargetRegistry.h>
144 #include <llvm/Support/TargetSelect.h>
146 cgit v0.9.0.2-2-gbebe
147 diff -ur a/src/gallium/drivers/r600/llvm_wrapper.cpp b/src/gallium/drivers/r600/llvm_wrapper.cpp
148 --- a/src/gallium/drivers/r600/llvm_wrapper.cpp 2013-03-05 23:54:28.000000000 +0100
149 +++ b/src/gallium/drivers/r600/llvm_wrapper.cpp 2013-05-02 17:46:36.411226826 +0200
151 #include <llvm/ADT/StringRef.h>
152 #include <llvm/LLVMContext.h>
153 #include <llvm/PassManager.h>
154 +#if HAVE_LLVM < 0x0303
155 #include <llvm/Support/IRReader.h>
157 +#include <llvm/IRReader/IRReader.h>
158 +#include <llvm/Support/CBindingWrapping.h>
159 +#endif /* HAVE_LLVM < 0x0303 */
160 #include <llvm/Support/MemoryBuffer.h>
161 #include <llvm/Support/SourceMgr.h>
162 #include <llvm/Transforms/IPO.h>
163 diff -ur a/src/gallium/drivers/r600/Makefile.am b/src/gallium/drivers/r600/Makefile.am
164 --- a/src/gallium/drivers/r600/Makefile.am 2013-03-05 23:54:28.000000000 +0100
165 +++ b/src/gallium/drivers/r600/Makefile.am 2013-05-02 18:00:20.035242047 +0200
171 -I$(top_srcdir)/src/gallium/drivers/radeon/
174 From 4742f9b00b804dd01eb9955dd386a2373cd8eb36 Mon Sep 17 00:00:00 2001
175 From: Armin K <krejzi@email.com>
176 Date: Thu, 02 May 2013 10:55:04 +0000
177 Subject: gallivm: Fix build with LLVM 3.3
179 Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
181 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
182 index 717afa7..a531d98 100644
183 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
184 +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
186 #endif /* HAVE_LLVM < 0x0300 */
188 #if HAVE_LLVM >= 0x0303
189 -#include <llvm/Wrap.h>
190 +#include <llvm/IR/IRBuilder.h>
191 +#include <llvm/IR/Module.h>
192 +#include <llvm/Support/CBindingWrapping.h>
195 #include "pipe/p_config.h"
197 cgit v0.9.0.2-2-gbebe
198 From cd84353d576246273d1c6ae8e96b65217be15ebc Mon Sep 17 00:00:00 2001
199 From: Armin K <krejzi@email.com>
200 Date: Thu, 02 May 2013 10:55:05 +0000
201 Subject: radeon: Fix build with LLVM 3.3
203 Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
205 diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
206 index 55dad9b..fb974f9 100644
207 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
208 +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
211 #include <llvm/PassManager.h>
212 #include <llvm/ADT/Triple.h>
213 +#include <llvm/Support/CBindingWrapping.h>
214 #include <llvm/Support/FormattedStream.h>
215 #include <llvm/Support/Host.h>
216 #include <llvm/Support/SourceMgr.h>
218 #include <llvm/Support/Threading.h>
219 #include <llvm/Target/TargetMachine.h>
220 #include <llvm/Transforms/Scalar.h>
221 -#include <llvm/Wrap.h>
222 #include <llvm-c/Target.h>
225 # Provide compatibility with scripts for the old Mesa build system for
229 Signed-off-by: Vinson Lee <vlee at freedesktop.org>
231 src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 4 +++-
232 1 file changed, 3 insertions(+), 1 deletion(-)
234 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
235 index 86617d4..1c886ea 100644
236 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
237 +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
238 @@ -212,7 +212,9 @@ disassemble(const void* func, llvm::raw_ostream & Out)
240 const Target *T = TargetRegistry::lookupTarget(Triple, Error);
242 -#if HAVE_LLVM >= 0x0300
243 +#if HAVE_LLVM >= 0x0304
244 + OwningPtr<const MCAsmInfo> AsmInfo(T->createMCAsmInfo(*T->createMCRegInfo(Triple), Triple));
245 +#elif HAVE_LLVM >= 0x0300
246 OwningPtr<const MCAsmInfo> AsmInfo(T->createMCAsmInfo(Triple));
248 OwningPtr<const MCAsmInfo> AsmInfo(T->createAsmInfo(Triple));
251 --- x/src/gallium/state_trackers/clover/llvm/invocation.cpp.org 2013-06-19 12:06:31.055563544 +0200
252 +++ x/src/gallium/state_trackers/clover/llvm/invocation.cpp 2013-06-19 12:16:58.645029877 +0200
254 #include <clang/CodeGen/CodeGenAction.h>
255 #include <llvm/Bitcode/BitstreamWriter.h>
256 #include <llvm/Bitcode/ReaderWriter.h>
257 +#if HAVE_LLVM < 0x0303
258 #include <llvm/DerivedTypes.h>
259 -#include <llvm/Linker.h>
260 #include <llvm/LLVMContext.h>
261 #include <llvm/Module.h>
263 +#include <llvm/IR/DerivedTypes.h>
264 +#include <llvm/IR/LLVMContext.h>
265 +#include <llvm/IR/Module.h>
266 +#include <llvm/Support/SourceMgr.h>
267 +#include <llvm/IRReader/IRReader.h>
269 +#include <llvm/Linker.h>
270 #include <llvm/PassManager.h>
271 #include <llvm/Support/TargetSelect.h>
272 #include <llvm/Support/MemoryBuffer.h>
275 #if HAVE_LLVM < 0x0302
276 #include <llvm/Target/TargetData.h>
278 +#elif HAVE_LLVM < 0x0303
279 #include <llvm/DataLayout.h>
281 +#include <llvm/IR/DataLayout.h>
284 #include "pipe/p_state.h"
286 // Add libclc generic search path
287 c.getHeaderSearchOpts().AddPath(LIBCLC_INCLUDEDIR,
288 clang::frontend::Angled,
289 - false, false, false);
291 +#if HAVE_LLVM < 0x0303
296 // Add libclc include
297 c.getPreprocessorOpts().Includes.push_back("clc/clc.h");
299 c.getInvocation().setLangDefaults(c.getLangOpts(), clang::IK_OpenCL,
300 clang::LangStandard::lang_opencl11);
302 - c.createDiagnostics(0, NULL, new clang::TextDiagnosticPrinter(
304 + c.createDiagnostics(
305 +#if HAVE_LLVM < 0x0303
308 + new clang::TextDiagnosticPrinter(
310 #if HAVE_LLVM <= 0x0301
311 c.getDiagnosticOpts()));
313 @@ -201,12 +219,26 @@
315 llvm::PassManager PM;
316 llvm::PassManagerBuilder Builder;
318 - llvm::Linker linker("clover", mod);
319 + llvm::sys::Path libclc_path =
320 + llvm::sys::Path(LIBCLC_LIBEXECDIR + triple + ".bc");
322 // Link the kernel with libclc
323 - linker.LinkInFile(llvm::sys::Path(LIBCLC_LIBEXECDIR + triple + ".bc"), isNative);
324 +#if HAVE_LLVM < 0x0303
326 + llvm::Linker linker("clover", mod);
327 + linker.LinkInFile(libclc_path, isNative);
328 mod = linker.releaseModule();
330 + std::string err_str;
331 + llvm::SMDiagnostic err;
332 + llvm::Module *libclc_mod = llvm::ParseIRFile(libclc_path.str(), err,
333 + mod->getContext());
334 + if (llvm::Linker::LinkModules(mod, libclc_mod,
335 + llvm::Linker::DestroySource,
337 + throw build_error(err_str);
341 // Add a function internalizer pass.
343 --- ./src/gallium/drivers/r600/llvm_wrapper.cpp~ 2013-06-19 12:24:15.000000000 +0200
344 +++ ./src/gallium/drivers/r600/llvm_wrapper.cpp 2013-06-19 12:29:10.363799511 +0200
347 #include <llvm/IRReader/IRReader.h>
348 #include <llvm/Support/CBindingWrapping.h>
349 +#include <llvm/LinkAllIR.h>
350 #endif /* HAVE_LLVM < 0x0303 */
351 #include <llvm/Support/MemoryBuffer.h>
352 #include <llvm/Support/SourceMgr.h>
353 --- Mesa-9.1.3/src/gallium/targets/opencl/Makefile.am~ 2013-03-05 23:54:28.000000000 +0100
354 +++ Mesa-9.1.3/src/gallium/targets/opencl/Makefile.am 2013-06-19 12:38:56.722221012 +0200
366 --- Mesa-9.1.6/configure.ac~ 2013-08-01 23:14:58.000000000 +0200
367 +++ Mesa-9.1.6/configure.ac 2013-08-02 09:44:02.661826293 +0200
368 @@ -1779,7 +1779,7 @@
370 radeon_llvm_check() {
371 LLVM_REQUIRED_VERSION_MAJOR="3"
372 - LLVM_REQUIRED_VERSION_MINOR="2"
373 + LLVM_REQUIRED_VERSION_MINOR="3"
374 if test "$LLVM_VERSION_INT" -ne "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
375 AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR with R600 target enabled is required.
376 To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from: