1//===--- SPIRVCommandLine.h ---- Command Line Options -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains classes and functions needed for processing, parsing, and
10// using CLI options for the SPIR-V backend.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVCOMMANDLINE_H
15#define LLVM_LIB_TARGET_SPIRV_SPIRVCOMMANDLINE_H
16
17#include "MCTargetDesc/SPIRVBaseInfo.h"
18#include <string>
19
20namespace llvm {
21template <typename T> class ArrayRef;
22class Error;
23class StringRef;
24class Triple;
25
26/// Parser for toggling SPIR-V extensions.
27struct SPIRVExtensionsParser {
28 /// Parses the value of -spirv-ext into \p Enabled and \p Disabled.
29 static Error parse(StringRef ArgValue, ExtensionSet &Enabled,
30 ExtensionSet &Disabled);
31
32 /// Validates and converts extension names into internal enum values.
33 ///
34 /// \return Returns a reference to the unknown SPIR-V extension name from the
35 /// list if present, or an empty StringRef on success.
36 static StringRef checkExtensions(ArrayRef<std::string> ExtNames,
37 ExtensionSet &AllowedExtensions);
38
39 /// Returns the list of extensions that are valid for a particular
40 /// target environment (i.e., OpenCL or Vulkan), excluding \p Disabled.
41 static ExtensionSet getValidExtensions(const Triple &TT,
42 const ExtensionSet &Disabled);
43};
44
45} // namespace llvm
46#endif // LLVM_LIB_TARGET_SPIRV_SPIRVCOMMANDLINE_H
47