[all-commits] [llvm/llvm-project] e123cd: [OpenCL] Refactor of targets OpenCL option settings

Anton Zabaznov via All-commits all-commits at lists.llvm.org
Mon Jan 25 08:55:03 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e123cd674c0209c80bc6225bb9e3a2d1d2ee418b
      https://github.com/llvm/llvm-project/commit/e123cd674c0209c80bc6225bb9e3a2d1d2ee418b
  Author: Anton Zabaznov <anton.zabaznov at intel.com>
  Date:   2021-01-25 (Mon, 25 Jan 2021)

  Changed paths:
    M clang/include/clang/Basic/OpenCLExtensions.def
    M clang/include/clang/Basic/OpenCLOptions.h
    M clang/include/clang/Basic/TargetInfo.h
    M clang/include/clang/Basic/TargetOptions.h
    M clang/lib/Basic/CMakeLists.txt
    A clang/lib/Basic/OpenCLOptions.cpp
    M clang/lib/Basic/Targets.cpp
    M clang/lib/Basic/Targets/AMDGPU.h
    M clang/lib/Basic/Targets/NVPTX.h
    M clang/lib/Basic/Targets/SPIR.h
    M clang/lib/Basic/Targets/X86.h
    M clang/lib/Frontend/InitPreprocessor.cpp
    M clang/lib/Parse/ParsePragma.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/test/Misc/nvptx.languageOptsOpenCL.cl
    M clang/test/Misc/r600.languageOptsOpenCL.cl

  Log Message:
  -----------
  [OpenCL] Refactor of targets OpenCL option settings

Currently, there is some refactoring needed in existing interface of OpenCL option
settings to support OpenCL C 3.0. The problem is that OpenCL extensions and features
are not only determined by the target platform but also by the OpenCL version.
Also, there are core extensions/features which are supported unconditionally in
specific OpenCL C version. In fact, these rules are not being followed for all targets.
For example, there are some targets (as nvptx and r600) which don't support
OpenCL C 2.0 core features (nvptx.languageOptsOpenCL.cl, r600.languageOptsOpenCL.cl).

After the change there will be explicit differentiation between optional core and core
OpenCL features which allows giving diagnostics if target doesn't support any of
necessary core features for specific OpenCL version.

This patch also eliminates `OpenCLOptions` instance duplication from `TargetOptions`.
`OpenCLOptions` instance should take place in `Sema` as it's going to be modified
during parsing. Removing this duplication will also allow to generally simplify
`OpenCLOptions` class for parsing purposes.

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D92277




More information about the All-commits mailing list