[cfe-commits] PATCH: Add r600 TargetInfo

Tom Stellard tom at stellard.net
Tue Oct 9 07:29:02 PDT 2012


Ping.

On Mon, Oct 01, 2012 at 03:25:56PM -0400, Tom Stellard wrote:
> Hi,
> 
> This patch adds r600 TargetInfo to Clang and makes it possible to
> compile OpenCL C kernels for r600 using libclang.
> 
> Please Review.
> 
> Thanks,
> Tom Stellard

> diff --git lib/Basic/Targets.cpp lib/Basic/Targets.cpp
> index 2019137..4056bad 100644
> --- lib/Basic/Targets.cpp
> +++ lib/Basic/Targets.cpp
> @@ -1177,6 +1177,75 @@ 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 const char * getVAListDeclaration() const {
> +    return "";
> +  }
> +
> +  virtual BuiltinVaListKind getBuiltinVaListKind() const {
> +    return TargetInfo::CharPtrBuiltinVaList;
> +  }
> +
> +};
> +
> +} // end anonymous namespace
> +
> +namespace {
>  // MBlaze abstract base class
>  class MBlazeTargetInfo : public TargetInfo {
>    static const char * const GCCRegNames[];
> @@ -4348,6 +4417,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:

> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list