xref: /freebsd/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVCommandLine.h (revision 3a56015a2f5d630910177fa79a522bb95511ccf7)
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_COMMANDLINE_H
15 #define LLVM_LIB_TARGET_SPIRV_COMMANDLINE_H
16 
17 #include "MCTargetDesc/SPIRVBaseInfo.h"
18 #include "llvm/Support/CommandLine.h"
19 #include <set>
20 
21 namespace llvm {
22 
23 /// Command line parser for toggling SPIR-V extensions.
24 struct SPIRVExtensionsParser
25     : public cl::parser<std::set<SPIRV::Extension::Extension>> {
26 public:
27   SPIRVExtensionsParser(cl::Option &O)
28       : cl::parser<std::set<SPIRV::Extension::Extension>>(O) {}
29 
30   /// Parses SPIR-V extension name from CLI arguments.
31   ///
32   /// \return Returns true on error.
33   bool parse(cl::Option &O, StringRef ArgName, StringRef ArgValue,
34              std::set<SPIRV::Extension::Extension> &Vals);
35 };
36 
37 } // namespace llvm
38 #endif // LLVM_LIB_TARGET_SPIRV_COMMANDLINE_H
39