brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 02e847b Raw
55 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// This file contains classes and functions needed for processing, parsing, and10// using CLI options for the SPIR-V backend.11//12//===----------------------------------------------------------------------===//13 14#ifndef LLVM_LIB_TARGET_SPIRV_COMMANDLINE_H15#define LLVM_LIB_TARGET_SPIRV_COMMANDLINE_H16 17#include "MCTargetDesc/SPIRVBaseInfo.h"18#include "llvm/Support/CommandLine.h"19#include <set>20#include <string>21 22namespace llvm {23class StringRef;24class Triple;25 26/// Command line parser for toggling SPIR-V extensions.27struct SPIRVExtensionsParser28    : public cl::parser<std::set<SPIRV::Extension::Extension>> {29public:30  SPIRVExtensionsParser(cl::Option &O)31      : cl::parser<std::set<SPIRV::Extension::Extension>>(O) {}32 33  /// Parses SPIR-V extension name from CLI arguments.34  ///35  /// \return Returns true on error.36  bool parse(cl::Option &O, StringRef ArgName, StringRef ArgValue,37             std::set<SPIRV::Extension::Extension> &Vals);38 39  /// Validates and converts extension names into internal enum values.40  ///41  /// \return Returns a reference to the unknown SPIR-V extension name from the42  /// list if present, or an empty StringRef on success.43  static StringRef44  checkExtensions(const std::vector<std::string> &ExtNames,45                  std::set<SPIRV::Extension::Extension> &AllowedExtensions);46 47  /// Returns the list of extensions that are valid for a particular48  /// target environment (i.e., OpenCL or Vulkan).49  static std::set<SPIRV::Extension::Extension>50  getValidExtensions(const Triple &TT);51};52 53} // namespace llvm54#endif // LLVM_LIB_TARGET_SPIRV_COMMANDLINE_H55