summaryrefslogtreecommitdiff
authorJohannes Obermayr <johannesobermayr@gmx.de>2012-12-20 19:56:17 (GMT)
committer Tom Stellard <thomas.stellard@amd.com>2013-01-04 21:05:09 (GMT)
commit05c143cc049a87c515ecdc5695e5912da60cf5cb (patch) (side-by-side diff)
tree7fdb97c4a3816992f912e7750d4baac9a6debf34
parent54f3a3e88d35c855c43c31ae7c915cfa55d1f5d7 (diff)
downloadmesa-05c143cc049a87c515ecdc5695e5912da60cf5cb.zip
mesa-05c143cc049a87c515ecdc5695e5912da60cf5cb.tar.gz
Support LLVM >= 3.2 on radeonsi and opencl.
Tom Stellard: - Backend now has same name for all LLVM versions - Add missing LLVM_VERSION_INT definition
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--configure.ac24
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_emit.cpp7
2 files changed, 17 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac
index 1294740..3b84b1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1677,7 +1677,8 @@ if test "x$enable_gallium_llvm" = xyes; then
if test "x$LLVM_CONFIG" != xno; then
LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
- if test "x$with_llvm_shared_libs" = xyes; then
+ LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
+ if test "x$with_llvm_shared_libs" = xyes; then
dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`"
else
@@ -1800,24 +1801,19 @@ gallium_require_drm_loader() {
radeon_llvm_check() {
LLVM_REQUIRED_VERSION_MAJOR="3"
LLVM_REQUIRED_VERSION_MINOR="2"
- LLVM_AVAILABLE_VERSION_MAJOR=`echo $LLVM_VERSION | cut -d. -f1`
- LLVM_AVAILABLE_VERSION_MINOR=`echo $LLVM_VERSION | cut -d. -f2`
- if test "$LLVM_AVAILABLE_VERSION_MAJOR" -lt "$LLVM_REQUIRED_VERSION_MAJOR" -o [ "$LLVM_AVAILABLE_VERSION_MAJOR" -eq "$LLVM_REQUIRED_VERSION_MAJOR" -a "$LLVM_AVAILABLE_VERSION_MINOR" -lt "$LLVM_REQUIRED_VERSION_MINOR" ] ; then
- AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer with AMDGPU target enabled is required.
+ if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
+ AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer with R600 target enabled is required.
To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from:
git://people.freedesktop.org/~tstellar/llvm master
- and build with --enable-experimental-targets=AMDGPU])
+ and build with --enable-experimental-targets=R600])
fi
- if test true && $LLVM_CONFIG --targets-built | grep -qv '\<AMDGPU\>' ; then
- AC_MSG_ERROR([LLVM AMDGPU Target not enabled.
- To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from:
- git://people.freedesktop.org/~tstellar/llvm master
- and build with --enable-experimental-targets=AMDGPU])
+ if test true && $LLVM_CONFIG --targets-built | grep -qv '\<R600\>' ; then
+ AC_MSG_ERROR([LLVM R600 Target not enabled. You can enable it when building the LLVM
+ sources with the --enable-experimental-targets=R600
+ configure flag])
fi
AC_MSG_WARN([Please ensure you use the latest llvm tree from git://people.freedesktop.org/~tstellar/llvm master before submitting a bug])
- if test "x$LLVM_VERSION" = "x3.2"; then
- LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs amdgpu`"
- fi
+ LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs r600`"
}
dnl Gallium drivers
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
index 21661a0..b889f02 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
@@ -89,10 +89,17 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char ** bytes,
Triple AMDGPUTriple(sys::getDefaultTargetTriple());
+#if HAVE_LLVM == 0x0302
LLVMInitializeAMDGPUTargetInfo();
LLVMInitializeAMDGPUTarget();
LLVMInitializeAMDGPUTargetMC();
LLVMInitializeAMDGPUAsmPrinter();
+#else
+ LLVMInitializeR600TargetInfo();
+ LLVMInitializeR600Target();
+ LLVMInitializeR600TargetMC();
+ LLVMInitializeR600AsmPrinter();
+#endif
std::string err;
const Target * AMDGPUTarget = TargetRegistry::lookupTarget("r600", err);