From: Eli Friedman Date: Fri, 12 Oct 2012 23:32:00 +0000 (+0000) Subject: Add TargetInfo for r600. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6505a29cfd629e1a4820282b4cf3871efc1e696f;p=clang Add TargetInfo for r600. Patch by Tom Stellard. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165850 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index d421b058eb..76e09a55f4 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1213,6 +1213,71 @@ namespace { }; } +namespace { + +static const unsigned R600AddrSpaceMap[] = { + 1, // opencl_global + 3, // opencl_local + 2, // opencl_constant + 1, // cuda_device + 2, // cuda_constant + 3 // cuda_shared +}; + +class R600TargetInfo : public TargetInfo { +public: + R600TargetInfo(const std::string& triple) : TargetInfo(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 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; + } + + + virtual void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const { + Builder.defineMacro("__R600__"); + } + + virtual BuiltinVaListKind getBuiltinVaListKind() const { + return TargetInfo::CharPtrBuiltinVaList; + } + +}; + +} // end anonymous namespace + namespace { // MBlaze abstract base class class MBlazeTargetInfo : public TargetInfo { @@ -4426,6 +4491,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: