Author: krejzi
Date: 2012-12-30 15:58:51 -0700 (Sun, 30 Dec 2012)
New Revision: 2565
Added:
trunk/MesaLib/MesaLib-9.0.1-llvm32-1.patch
Log:
MesaLib LLVM Fix.
Added: trunk/MesaLib/MesaLib-9.0.1-llvm32-1.patch
===================================================================
--- trunk/MesaLib/MesaLib-9.0.1-llvm32-1.patch (rev 0)
+++ trunk/MesaLib/MesaLib-9.0.1-llvm32-1.patch 2012-12-30 22:58:51 UTC (rev
2565)
@@ -0,0 +1,176 @@
+Submitted By: Armin K. <krejzi at email dot com>
+Date: 2012-12-30
+Initial Package Version: 9.0.1
+Upstream Status: In upstream VCS.
+Origin: Upstream.
+Description: Fixes building with LLVM 3.2
+
+diff --git a/configure.ac b/configure.ac
+index b46f897..6a55ca2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1654,6 +1654,7 @@ if test "x$enable_gallium_llvm" = xyes; then
+ if $LLVM_CONFIG --components | grep -q '\<mcjit\>'; then
+ LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit"
+ fi
++ LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets"
+ if test "x$enable_opencl" = xyes; then
+ LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker
instrumentation"
+ fi
+@@ -1775,6 +1776,21 @@ gallium_require_drm_loader() {
+ fi
+ }
+
++radeon_llvm_check() {
++ LLVM_VERSION_MAJOR=`echo $LLVM_VERSION | cut -d. -f1`
++ if test "$LLVM_VERSION_MAJOR" -lt "3" -o "x$LLVM_VERSION" = "x3.0"; then
++ AC_MSG_ERROR([LLVM 3.1 or newer is required for the r600/radeonsi
llvm compiler.])
++ fi
++ if test "$LLVM_VERSION_MAJOR" -ge "3" -a "x$LLVM_VERSION" != "x3.1" &&
$LLVM_CONFIG --targets-built | grep -qv '\<AMDGPU\>' ; then
++ AC_MSG_ERROR([To use the r600/radeonsi LLVM backend with LLVM 3.2 and
newer, you need to fetch the LLVM source from:
++ git://people.freedesktop.org/~tstellar/llvm master
++ and build with --enable-experimental-targets=AMDGPU])
++ fi
++ if test "x$LLVM_VERSION" = "x3.2"; then
++ LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs amdgpu`"
++ fi
++}
++
+ dnl Gallium drivers
+ dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this
block
+ if test "x$with_gallium_drivers" != x; then
+@@ -1805,9 +1821,7 @@ if test "x$with_gallium_drivers" != x; then
+ gallium_require_drm_loader
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
+ if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes;
then
+- if test "x$LLVM_VERSION" != "x3.1"; then
+- AC_MSG_ERROR([LLVM 3.1 is required for the r600 llvm
compiler.])
+- fi
++ radeon_llvm_check
+ NEED_RADEON_GALLIUM=yes;
+ fi
+ if test "x$enable_r600_llvm" = xyes; then
+@@ -1822,9 +1836,7 @@ if test "x$with_gallium_drivers" != x; then
+ PKG_CHECK_MODULES([RADEON], [libdrm_radeon >=
$LIBDRM_RADEON_REQUIRED])
+ gallium_require_drm_loader
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
+- if test "x$LLVM_VERSION" != "x3.1"; then
+- AC_MSG_ERROR([LLVM 3.1 is required to build the radeonsi
driver.])
+- fi
++ radeon_llvm_check
+ NEED_RADEON_GALLIUM=yes;
+ gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi" ""
"" "vdpau-radeonsi" ""
+ ;;
+diff --git a/src/gallium/drivers/r600/r600_shader.c
b/src/gallium/drivers/r600/r600_shader.c
+index 21019b7..a5f0ec1 100644
+--- a/src/gallium/drivers/r600/r600_shader.c
++++ b/src/gallium/drivers/r600/r600_shader.c
+@@ -319,6 +319,7 @@ static unsigned r600_alu_from_byte_stream(struct
r600_shader_ctx *ctx,
+ alu.index_mode = bytes[bytes_read++];
+
+
++#if HAVE_LLVM < 0x0302
+ if (alu.inst == CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE) ||
+ alu.inst == CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE) ||
+ alu.inst == CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_INT)
||
+@@ -432,6 +433,7 @@ static unsigned r600_fc_from_byte_stream(struct
r600_shader_ctx *ctx,
+ CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE));
+ break;
+ }
++#endif
+
+ return bytes_read;
+ }
+diff --git a/src/gallium/drivers/radeon/Makefile
b/src/gallium/drivers/radeon/Makefile
+index 7f1c613..bcc2646 100644
+--- a/src/gallium/drivers/radeon/Makefile
++++ b/src/gallium/drivers/radeon/Makefile
+@@ -12,6 +12,12 @@ TBLGEN = $(LLVM_BINDIR)/llvm-tblgen
+
+ CXXFLAGS+= $(LLVM_CXXFLAGS)
+
++ifeq ($(LLVM_VERSION),3.1)
++ CPP_SOURCES += $(LLVM_CPP_SOURCES)
++else
++ CXXFLAGS+= -DEXTERNAL_LLVM
++endif
++
+ include ../../Makefile.template
+
+ CXXFLAGS := $(filter-out -DDEBUG, $(CXXFLAGS))
+diff --git a/src/gallium/drivers/radeon/Makefile.sources
b/src/gallium/drivers/radeon/Makefile.sources
+index 0f874d7..b175067 100644
+--- a/src/gallium/drivers/radeon/Makefile.sources
++++ b/src/gallium/drivers/radeon/Makefile.sources
+@@ -23,8 +23,7 @@ TD_FILES := \
+ SIRegisterInfo.td \
+ SISchedule.td
+
+-
+-GENERATED_SOURCES := \
++LLVM_GENERATED_SOURCES := \
+ R600Intrinsics.td \
+ R600RegisterInfo.td \
+ SIRegisterInfo.td \
+@@ -41,7 +40,7 @@ GENERATED_SOURCES := \
+ AMDGPUGenMCCodeEmitter.inc \
+ AMDGPUGenDFAPacketizer.inc
+
+-CPP_SOURCES := \
++LLVM_CPP_SOURCES := \
+ AMDIL7XXDevice.cpp \
+ AMDILCFGStructurizer.cpp \
+ AMDILDevice.cpp \
+@@ -80,6 +79,8 @@ CPP_SOURCES := \
+ MCTargetDesc/SIMCCodeEmitter.cpp \
+ MCTargetDesc/R600MCCodeEmitter.cpp \
+ TargetInfo/AMDGPUTargetInfo.cpp \
++
++CPP_SOURCES := \
+ radeon_llvm_emit.cpp
+
+ C_SOURCES := \
+diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
+index 1b67bfe..23d9425 100644
+--- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
++++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
+@@ -36,13 +36,16 @@
+ #include <llvm/Support/TargetRegistry.h>
+ #include <llvm/Support/TargetSelect.h>
+ #include <llvm/Support/Threading.h>
+-#include <llvm/Target/TargetData.h>
+ #include <llvm/Target/TargetMachine.h>
+-
+ #include <llvm/Transforms/Scalar.h>
+-
+ #include <llvm-c/Target.h>
+
++#if HAVE_LLVM < 0x0302
++#include <llvm/Target/TargetData.h>
++#else
++#include <llvm/DataLayout.h>
++#endif
++
+ #include <iostream>
+ #include <stdlib.h>
+ #include <stdio.h>
+@@ -90,6 +93,7 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char ** bytes,
+ /* XXX: Can we just initialize the AMDGPU target here? */
+ InitializeAllTargets();
+ InitializeAllTargetMCs();
++ InitializeAllAsmPrinters();
+ #else
+ LLVMInitializeAMDGPUTargetInfo();
+ LLVMInitializeAMDGPUTarget();
+@@ -125,7 +129,11 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char **
bytes,
+ ));
+ TargetMachine &AMDGPUTargetMachine = *tm.get();
+ PassManager PM;
++#if HAVE_LLVM < 0x0302
+ PM.add(new TargetData(*AMDGPUTargetMachine.getTargetData()));
++#else
++ PM.add(new DataLayout(*AMDGPUTargetMachine.getDataLayout()));
++#endif
+ PM.add(createPromoteMemoryToRegisterPass());
+ AMDGPUTargetMachine.setAsmVerbosityDefault(true);
+
--
http://linuxfromscratch.org/mailman/listinfo/patches
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page