[RISCV] Refactor predicates for rvv intrinsic patterns.
[llvm-project.git] / llvm / lib / TextAPI / TextStubCommon.h
blob9558bd9e2d352d90f21b010676c79be3722dccad
1 //===- TextStubCommon.h ---------------------------------------------------===//
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 // Defines common Text Stub YAML mappings.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_TEXTAPI_TEXT_STUB_COMMON_H
14 #define LLVM_TEXTAPI_TEXT_STUB_COMMON_H
16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/Support/YAMLTraits.h"
18 #include "llvm/TextAPI/Architecture.h"
19 #include "llvm/TextAPI/InterfaceFile.h"
20 #include "llvm/TextAPI/Platform.h"
21 #include "llvm/TextAPI/Target.h"
23 using UUID = std::pair<llvm::MachO::Target, std::string>;
25 // clang-format off
26 enum TBDFlags : unsigned {
27 None = 0U,
28 FlatNamespace = 1U << 0,
29 NotApplicationExtensionSafe = 1U << 1,
30 InstallAPI = 1U << 2,
31 LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/InstallAPI),
33 // clang-format on
35 LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef, FlowStringRef)
36 LLVM_YAML_STRONG_TYPEDEF(uint8_t, SwiftVersion)
37 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID)
38 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef)
40 namespace llvm {
42 namespace MachO {
43 class ArchitectureSet;
44 class PackedVersion;
46 Expected<std::unique_ptr<InterfaceFile>>
47 getInterfaceFileFromJSON(StringRef JSON);
49 Error serializeInterfaceFileToJSON(raw_ostream &OS, const InterfaceFile &File,
50 bool Compact);
51 } // namespace MachO
53 namespace yaml {
55 template <> struct ScalarTraits<FlowStringRef> {
56 static void output(const FlowStringRef &, void *, raw_ostream &);
57 static StringRef input(StringRef, void *, FlowStringRef &);
58 static QuotingType mustQuote(StringRef);
61 template <> struct ScalarEnumerationTraits<MachO::ObjCConstraintType> {
62 static void enumeration(IO &, MachO::ObjCConstraintType &);
65 template <> struct ScalarTraits<MachO::PlatformSet> {
66 static void output(const MachO::PlatformSet &, void *, raw_ostream &);
67 static StringRef input(StringRef, void *, MachO::PlatformSet &);
68 static QuotingType mustQuote(StringRef);
71 template <> struct ScalarBitSetTraits<MachO::ArchitectureSet> {
72 static void bitset(IO &, MachO::ArchitectureSet &);
75 template <> struct ScalarTraits<MachO::Architecture> {
76 static void output(const MachO::Architecture &, void *, raw_ostream &);
77 static StringRef input(StringRef, void *, MachO::Architecture &);
78 static QuotingType mustQuote(StringRef);
81 template <> struct ScalarTraits<MachO::PackedVersion> {
82 static void output(const MachO::PackedVersion &, void *, raw_ostream &);
83 static StringRef input(StringRef, void *, MachO::PackedVersion &);
84 static QuotingType mustQuote(StringRef);
87 template <> struct ScalarTraits<SwiftVersion> {
88 static void output(const SwiftVersion &, void *, raw_ostream &);
89 static StringRef input(StringRef, void *, SwiftVersion &);
90 static QuotingType mustQuote(StringRef);
93 template <> struct ScalarTraits<UUID> {
94 static void output(const UUID &, void *, raw_ostream &);
95 static StringRef input(StringRef, void *, UUID &);
96 static QuotingType mustQuote(StringRef);
99 } // end namespace yaml.
100 } // end namespace llvm.
102 #endif // LLVM_TEXTAPI_TEXT_STUB_COMMON_H