rebase to 3.1 + add r600 patches from Tom Stellar

This commit is contained in:
Dave Airlie 2012-06-03 09:33:39 +01:00
parent 98be43ec03
commit dcd073e711
9 changed files with 362 additions and 24 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
/llvm-3.0.tar.gz /llvm-3.0.tar.gz
/clang-3.0.tar.gz /clang-3.0.tar.gz
/clang-3.1.src.tar.gz
/llvm-3.1.src.tar.gz

View File

@ -0,0 +1,100 @@
From 70cae83ffd093f183dec07c464db3c0bb6b92c10 Mon Sep 17 00:00:00 2001
From: Tom Stellard <thomas.stellard@amd.com>
Date: Fri, 2 Mar 2012 10:54:52 -0500
Subject: [PATCH 1/3] Add r600 TargetInfo
---
lib/Basic/Targets.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 85dfd78..64dc01c 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -1068,6 +1068,73 @@ namespace {
}
namespace {
+
+class AMDGPUTargetInfo : public TargetInfo {
+public:
+
+ AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { }
+
+ virtual const char * getClobbers() const {
+ return "";
+ }
+
+ virtual void getGCCRegNames(const char * const *&Names,
+ unsigned &numNames) const {
+ Names = NULL;
+ numNames = 0;
+ }
+
+ virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
+ unsigned &NumAliases) const {
+ Aliases = NULL;
+ NumAliases = 0;
+ }
+
+ virtual bool validateAsmConstraint(const char *&Name,
+ TargetInfo::ConstraintInfo &info) const {
+ return true;
+ }
+
+ virtual void getTargetBuiltins(const Builtin::Info *&Records,
+ unsigned &NumRecords) const {
+ Records = NULL;
+ NumRecords = 0;
+ }
+};
+
+
+static const unsigned R600AddrSpaceMap[] = {
+ 1, // opencl_global
+ 3, // opencl_local
+ 2 // opencl_constant
+};
+
+class R600TargetInfo : public AMDGPUTargetInfo {
+public:
+ R600TargetInfo(const std::string& triple) : AMDGPUTargetInfo(triple) {
+ DescriptionString =
+ "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16"
+ "-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32"
+ "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64"
+ "-v96:128:128-v128:128:128-v192:256:256-v256:256:256"
+ "-v512:512:512-v1024:1024:1024-v2048:2048:2048"
+ "-n8:16:32:64";
+ AddrSpaceMap = &R600AddrSpaceMap;
+ }
+
+ virtual void getTargetDefines(const LangOptions &Opts,
+ MacroBuilder &Builder) const {
+ Builder.defineMacro("__R600__");
+ }
+
+ virtual const char * getVAListDeclaration() const {
+ return "";
+ }
+};
+
+} // end anonymous namespace
+
+namespace {
// MBlaze abstract base class
class MBlazeTargetInfo : public TargetInfo {
static const char * const GCCRegNames[];
@@ -3963,6 +4030,9 @@ static TargetInfo *AllocateTarget(const std::string &T) {
case llvm::Triple::mblaze:
return new MBlazeTargetInfo(T);
+ case llvm::Triple::r600:
+ return new R600TargetInfo(T);
+
case llvm::Triple::sparc:
switch (os) {
case llvm::Triple::Linux:
--
1.7.7.6

View File

@ -0,0 +1,64 @@
From e25389b66b5ced3a2b5461077dcc9a505d334e3d Mon Sep 17 00:00:00 2001
From: Tom Stellard <thomas.stellard@amd.com>
Date: Tue, 13 Mar 2012 14:12:21 -0400
Subject: [PATCH 1/2] r600: Add some intrinsic definitions
---
include/llvm/Intrinsics.td | 1 +
include/llvm/IntrinsicsR600.td | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
create mode 100644 include/llvm/IntrinsicsR600.td
diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
index 069f907..e90dd85 100644
--- a/include/llvm/Intrinsics.td
+++ b/include/llvm/Intrinsics.td
@@ -441,3 +441,4 @@ include "llvm/IntrinsicsCellSPU.td"
include "llvm/IntrinsicsXCore.td"
include "llvm/IntrinsicsPTX.td"
include "llvm/IntrinsicsHexagon.td"
+include "llvm/IntrinsicsR600.td"
diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
new file mode 100644
index 0000000..789fecb
--- /dev/null
+++ b/include/llvm/IntrinsicsR600.td
@@ -0,0 +1,35 @@
+//===- IntrinsicsR600.td - Defines R600 intrinsics ---------*- tablegen -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines all of the R600-specific intrinsics.
+//
+//===----------------------------------------------------------------------===//
+//
+// Authors: Tom Stellard <thomas.stellard@amd.com>
+//
+
+let TargetPrefix = "r600" in {
+
+class R600ReadPreloadRegisterIntrinsic<string name>
+ : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>,
+ GCCBuiltin<name>;
+
+multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
+ def _x : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_x")>;
+ def _y : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_y")>;
+ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
+}
+
+defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
+ "__builtin_r600_read_ngroups">;
+defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
+ "__builtin_r600_read_tgid">;
+defm int_r600_read_tidig : R600ReadPreloadRegisterIntrinsic_xyz <
+ "__builtin_r600_read_tidig">;
+} // End TargetPrefix = "r600"
--
1.7.7.6

View File

@ -0,0 +1,27 @@
From 17667fa3450470f7c89fc2ba4631d908cf510749 Mon Sep 17 00:00:00 2001
From: Tom Stellard <thomas.stellard@amd.com>
Date: Wed, 14 Mar 2012 11:19:35 -0400
Subject: [PATCH 2/2] r600: Add get_global_size and get_local_size intrinsics
---
include/llvm/IntrinsicsR600.td | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
index 789fecb..0473acb 100644
--- a/include/llvm/IntrinsicsR600.td
+++ b/include/llvm/IntrinsicsR600.td
@@ -26,6 +26,10 @@ multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
}
+defm int_r600_read_global_size : R600ReadPreloadRegisterIntrinsic_xyz <
+ "__builtin_r600_read_global_size">;
+defm int_r600_read_local_size : R600ReadPreloadRegisterIntrinsic_xyz <
+ "__builtin_r600_read_local_size">;
defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
"__builtin_r600_read_ngroups">;
defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
--
1.7.7.6

View File

@ -0,0 +1,111 @@
From a014573ad193775b2301e39275a1ca0ac3bb5847 Mon Sep 17 00:00:00 2001
From: Tom Stellard <thomas.stellard@amd.com>
Date: Tue, 13 Mar 2012 13:54:51 -0400
Subject: [PATCH 2/3] r600: Add some target builtins
---
include/clang/Basic/BuiltinsR600.def | 32 ++++++++++++++++++++++++++++++++
include/clang/Basic/TargetBuiltins.h | 10 ++++++++++
lib/Basic/Targets.cpp | 12 ++++++++++--
3 files changed, 52 insertions(+), 2 deletions(-)
create mode 100644 include/clang/Basic/BuiltinsR600.def
diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def
new file mode 100644
index 0000000..ce1f30e
--- /dev/null
+++ b/include/clang/Basic/BuiltinsR600.def
@@ -0,0 +1,32 @@
+//===--- BuiltinsR600.def - R600 Builtin function database -- --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the R600-specific builtin function database. Users of
+// this file must define the BUILTIN macro to make use of this information.
+//
+//===----------------------------------------------------------------------===//
+//
+// Authors: Tom Stellard <thomas.stellard@amd.com>
+//
+
+// The format of this database matches clang/Basic/Builtins.def.
+
+BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc")
+BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc")
+BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc")
+
+BUILTIN(__builtin_r600_read_tidig_x, "z", "nc")
+BUILTIN(__builtin_r600_read_tidig_y, "z", "nc")
+BUILTIN(__builtin_r600_read_tidig_z, "z", "nc")
+
+BUILTIN(__builtin_r600_read_tgid_x, "z", "nc")
+BUILTIN(__builtin_r600_read_tgid_y, "z", "nc")
+BUILTIN(__builtin_r600_read_tgid_z, "z", "nc")
+
+#undef BUILTIN
diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/TargetBuiltins.h
index 7c04bf7..3460cd5 100644
--- a/include/clang/Basic/TargetBuiltins.h
+++ b/include/clang/Basic/TargetBuiltins.h
@@ -45,6 +45,16 @@ namespace clang {
};
}
+ /// R600 builtins
+ namespace R600 {
+ enum {
+ LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
+#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
+#include "clang/Basic/BuiltinsR600.def"
+ LastTSBuiltin
+ };
+ }
+
/// X86 builtins
namespace X86 {
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 64dc01c..03f1a18 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -1070,6 +1070,7 @@ namespace {
namespace {
class AMDGPUTargetInfo : public TargetInfo {
+ static const Builtin::Info BuiltinInfo[];
public:
AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { }
@@ -1097,8 +1098,8 @@ public:
virtual void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const {
- Records = NULL;
- NumRecords = 0;
+ Records = BuiltinInfo;
+ NumRecords = clang::R600::LastTSBuiltin-Builtin::FirstTSBuiltin;
}
};
@@ -1132,6 +1133,13 @@ public:
}
};
+const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] = {
+#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES },
+#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\
+ ALL_LANGUAGES },
+#include "clang/Basic/BuiltinsR600.def"
+};
+
} // end anonymous namespace
namespace {
--
1.7.7.6

View File

@ -0,0 +1,31 @@
From 2881b8189dcacc8ab6a336f0e107d72752c8c47e Mon Sep 17 00:00:00 2001
From: Tom Stellard <thomas.stellard@amd.com>
Date: Wed, 14 Mar 2012 11:20:08 -0400
Subject: [PATCH 3/3] r600: Add read_global_size and read_local_size builtins
---
include/clang/Basic/BuiltinsR600.def | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def
index ce1f30e..c81758e 100644
--- a/include/clang/Basic/BuiltinsR600.def
+++ b/include/clang/Basic/BuiltinsR600.def
@@ -17,6 +17,14 @@
// The format of this database matches clang/Basic/Builtins.def.
+BUILTIN(__builtin_r600_read_global_size_x, "z", "nc")
+BUILTIN(__builtin_r600_read_global_size_y, "z", "nc")
+BUILTIN(__builtin_r600_read_global_size_z, "z", "nc")
+
+BUILTIN(__builtin_r600_read_local_size_x, "z", "nc")
+BUILTIN(__builtin_r600_read_local_size_y, "z", "nc")
+BUILTIN(__builtin_r600_read_local_size_z, "z", "nc")
+
BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc")
BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc")
BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc")
--
1.7.7.6

View File

@ -1,10 +0,0 @@
--- llvm-3.0.src/tools/gold/Makefile.link_llvmgold_to_lto 2011-05-31 22:00:45.000000000 +0200
+++ llvm-3.0.src/tools/gold/Makefile 2012-02-25 09:40:01.889923932 +0100
@@ -26,6 +26,6 @@
# Because off_t is used in the public API, the largefile parts are required for
# ABI compatibility.
CXXFLAGS+=-I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-CXXFLAGS+=$(SharedLibDir)/$(SharedPrefix)LTO$(SHLIBEXT)
+CXXFLAGS+=-L$(SharedLibDir)/$(SharedPrefix) -lLTO
include $(LEVEL)/Makefile.common

View File

@ -35,15 +35,15 @@ ExcludeArch: s390 s390x ppc ppc64
%endif %endif
Name: llvm Name: llvm
Version: 3.0 Version: 3.1
Release: 13%{?dist} Release: 1%{?dist}
Summary: The Low Level Virtual Machine Summary: The Low Level Virtual Machine
Group: Development/Languages Group: Development/Languages
License: NCSA License: NCSA
URL: http://llvm.org/ URL: http://llvm.org/
Source0: %{downloadurl}/llvm-%{version}%{?prerel:%{prerel}.src}.tar.gz Source0: %{downloadurl}/llvm-%{version}%{?prerel:%{prerel}}.src.tar.gz
Source1: %{downloadurl}/clang-%{version}%{?prerel:%{prerel}.src}.tar.gz Source1: %{downloadurl}/clang-%{version}%{?prerel:%{prerel}}.src.tar.gz
# multilib fixes # multilib fixes
Source2: llvm-Config-config.h Source2: llvm-Config-config.h
Source3: llvm-Config-llvm-config.h Source3: llvm-Config-llvm-config.h
@ -51,11 +51,14 @@ Source3: llvm-Config-llvm-config.h
# Data files should be installed with timestamps preserved # Data files should be installed with timestamps preserved
Patch0: llvm-2.6-timestamp.patch Patch0: llvm-2.6-timestamp.patch
# LLVMgold should link against LTO as a normal library
# http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-November/045433.html # r600 llvm and clang patches
# patch is applied upstream, but has to be rewritten due to post-3.0 Patch600: 0001-r600-Add-some-intrinsic-definitions.patch
# Makefile clean-ups Patch601: 0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch
Patch1: llvm-3.0-link_llvmgold_to_lto.patch
Patch610: 0001-Add-r600-TargetInfo.patch
Patch611: 0002-r600-Add-some-target-builtins.patch
Patch612: 0003-r600-Add-read_global_size-and-read_local_size-builti.patch
BuildRequires: bison BuildRequires: bison
BuildRequires: chrpath BuildRequires: chrpath
@ -250,11 +253,18 @@ mv clang-%{version}%{?prerel}.src tools/clang
# llvm patches # llvm patches
%patch0 -p1 -b .timestamp %patch0 -p1 -b .timestamp
%patch1 -p1 -b .link_llvmgold_to_lto #patch1 -p1 -b .link_llvmgold_to_lto
# r600 llvm patch
%patch600 -p1 -b .r600
%patch601 -p1 -b .r601
# clang patches # clang patches
#pushd tools/clang pushd tools/clang
#popd %patch610 -p1 -b .r610
%patch611 -p1 -b .r611
%patch612 -p1 -b .r612
popd
# fix ld search path # fix ld search path
sed -i 's|/lib /usr/lib $lt_ld_extra|%{_libdir} $lt_ld_extra|' \ sed -i 's|/lib /usr/lib $lt_ld_extra|%{_libdir} $lt_ld_extra|' \
@ -535,6 +545,9 @@ exit 0
%endif %endif
%changelog %changelog
* Sun Jun 03 2012 Dave Airlie <airlied@redhat.com> 3.1-1
- rebase to 3.1 + add r600 patches from Tom Stellar
* Fri May 25 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 3.0-13 * Fri May 25 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 3.0-13
- Add compiler build options for ARM hardfp - Add compiler build options for ARM hardfp

View File

@ -1,2 +1,2 @@
a8e5f5f1c1adebae7b4a654c376a6005 llvm-3.0.tar.gz 59bf2d3120a3805f27cafda3823caaf8 clang-3.1.src.tar.gz
43350706ae6cf05d0068885792ea0591 clang-3.0.tar.gz 16eaa7679f84113f65b12760fdfe4ee1 llvm-3.1.src.tar.gz