[Mesa-dev] [PATCH 02/24] gallivm, ac: add writeonly and inaccessiblememonly attributes

Marek Olšák maraeo at gmail.com
Sun Feb 26 09:41:36 UTC 2017


On Feb 26, 2017 1:09 AM, "Jan Vesely" <jan.vesely at rutgers.edu> wrote:

On Sun, 2017-02-26 at 00:58 +0100, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>  src/amd/common/ac_llvm_util.c               | 2 ++
>  src/amd/common/ac_llvm_util.h               | 2 ++
>  src/gallium/auxiliary/gallivm/lp_bld_intr.c | 2 ++
>  src/gallium/auxiliary/gallivm/lp_bld_intr.h | 2 ++
>  4 files changed, 8 insertions(+)
>
> diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c
> index fb525dd..3cc06d4 100644
> --- a/src/amd/common/ac_llvm_util.c
> +++ b/src/amd/common/ac_llvm_util.c
> @@ -165,20 +165,22 @@ static LLVMAttribute ac_attr_to_llvm_attr(enum
ac_func_attr attr)
>  static const char *attr_to_str(enum ac_func_attr attr)
>  {
>     switch (attr) {
>     case AC_FUNC_ATTR_ALWAYSINLINE: return "alwaysinline";
>     case AC_FUNC_ATTR_BYVAL: return "byval";
>     case AC_FUNC_ATTR_INREG: return "inreg";
>     case AC_FUNC_ATTR_NOALIAS: return "noalias";
>     case AC_FUNC_ATTR_NOUNWIND: return "nounwind";
>     case AC_FUNC_ATTR_READNONE: return "readnone";
>     case AC_FUNC_ATTR_READONLY: return "readonly";
> +   case AC_FUNC_ATTR_WRITEONLY: return "writeonly";
> +   case AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY: return "inaccessiblememonly";

does this not give "error: duplicate case value" when compiled with
LLVM-3.9 ?


This code is not built with LLVM 3.9.

Marek


Jan

>     default:
>          fprintf(stderr, "Unhandled function attribute: %x\n", attr);
>          return 0;
>     }
>  }
>
>  #endif
>
>  static void
>  ac_add_function_attr(LLVMContextRef ctx, LLVMValueRef function,
> diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
> index 4fe4ab4..1cdee2e 100644
> --- a/src/amd/common/ac_llvm_util.h
> +++ b/src/amd/common/ac_llvm_util.h
> @@ -34,20 +34,22 @@ extern "C" {
>  #endif
>
>  enum ac_func_attr {
>       AC_FUNC_ATTR_ALWAYSINLINE = (1 << 0),
>       AC_FUNC_ATTR_BYVAL        = (1 << 1),
>       AC_FUNC_ATTR_INREG        = (1 << 2),
>       AC_FUNC_ATTR_NOALIAS      = (1 << 3),
>       AC_FUNC_ATTR_NOUNWIND     = (1 << 4),
>       AC_FUNC_ATTR_READNONE     = (1 << 5),
>       AC_FUNC_ATTR_READONLY     = (1 << 6),
> +     AC_FUNC_ATTR_WRITEONLY    = HAVE_LLVM >= 0x0400 ? (1 << 7) : 0,
> +     AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY = HAVE_LLVM >= 0x0400 ? (1 << 8)
: 0,
>
>       /* Legacy intrinsic that needs attributes on function declarations
>        * and they must match the internal LLVM definition exactly,
otherwise
>        * intrinsic selection fails.
>        */
>       AC_FUNC_ATTR_LEGACY       = (1u << 31),
>  };
>
>  LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family,
bool supports_spill);
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.c
b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> index 1b50e68..0be57c9 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> @@ -143,20 +143,22 @@ static LLVMAttribute lp_attr_to_llvm_attr(enum
lp_func_attr attr)
>  static const char *attr_to_str(enum lp_func_attr attr)
>  {
>     switch (attr) {
>     case LP_FUNC_ATTR_ALWAYSINLINE: return "alwaysinline";
>     case LP_FUNC_ATTR_BYVAL: return "byval";
>     case LP_FUNC_ATTR_INREG: return "inreg";
>     case LP_FUNC_ATTR_NOALIAS: return "noalias";
>     case LP_FUNC_ATTR_NOUNWIND: return "nounwind";
>     case LP_FUNC_ATTR_READNONE: return "readnone";
>     case LP_FUNC_ATTR_READONLY: return "readonly";
> +   case LP_FUNC_ATTR_WRITEONLY: return "writeonly";
> +   case LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY: return "inaccessiblememonly";
>     default:
>        _debug_printf("Unhandled function attribute: %x\n", attr);
>        return 0;
>     }
>  }
>
>  #endif
>
>  void
>  lp_add_function_attr(LLVMContextRef ctx, LLVMValueRef function,
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.h
b/src/gallium/auxiliary/gallivm/lp_bld_intr.h
> index d279911..4d14725 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_intr.h
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.h
> @@ -47,20 +47,22 @@
>  #define LP_MAX_FUNC_ARGS 32
>
>  enum lp_func_attr {
>     LP_FUNC_ATTR_ALWAYSINLINE = (1 << 0),
>     LP_FUNC_ATTR_BYVAL        = (1 << 1),
>     LP_FUNC_ATTR_INREG        = (1 << 2),
>     LP_FUNC_ATTR_NOALIAS      = (1 << 3),
>     LP_FUNC_ATTR_NOUNWIND     = (1 << 4),
>     LP_FUNC_ATTR_READNONE     = (1 << 5),
>     LP_FUNC_ATTR_READONLY     = (1 << 6),
> +   LP_FUNC_ATTR_WRITEONLY    = HAVE_LLVM >= 0x0400 ? (1 << 7) : 0,
> +   LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY = HAVE_LLVM >= 0x0400 ? (1 << 8) :
0,
>
>     /* Legacy intrinsic that needs attributes on function declarations
>      * and they must match the internal LLVM definition exactly, otherwise
>      * intrinsic selection fails.
>      */
>     LP_FUNC_ATTR_LEGACY       = (1u << 31),
>  };
>
>  void
>  lp_format_intrinsic(char *name,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170226/a9fdfea4/attachment-0001.html>


More information about the mesa-dev mailing list