1 | //===-- RISCVISAUtils.h - RISC-V ISA Utilities ------------------*- 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 | // Utilities shared by TableGen and RISCVISAInfo. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef LLVM_SUPPORT_RISCVISAUTILS_H |
14 | #define LLVM_SUPPORT_RISCVISAUTILS_H |
15 | |
16 | #include "llvm/ADT/StringRef.h" |
17 | #include <string> |
18 | |
19 | namespace llvm { |
20 | |
21 | namespace RISCVISAUtils { |
22 | constexpr StringLiteral AllStdExts = "mafdqlcbkjtpvnh" ; |
23 | |
24 | /// Represents the major and version number components of a RISC-V extension. |
25 | struct ExtensionVersion { |
26 | unsigned Major; |
27 | unsigned Minor; |
28 | }; |
29 | |
30 | bool compareExtension(const std::string &LHS, const std::string &RHS); |
31 | |
32 | /// Helper class for OrderedExtensionMap. |
33 | struct ExtensionComparator { |
34 | bool operator()(const std::string &LHS, const std::string &RHS) const { |
35 | return compareExtension(LHS, RHS); |
36 | } |
37 | }; |
38 | } // namespace RISCVISAUtils |
39 | |
40 | } // namespace llvm |
41 | |
42 | #endif |
43 | |