Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:33

0001 //===-- RISCVISAUtils.h - RISC-V ISA Utilities ------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Utilities shared by TableGen and RISCVISAInfo.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_SUPPORT_RISCVISAUTILS_H
0014 #define LLVM_SUPPORT_RISCVISAUTILS_H
0015 
0016 #include "llvm/ADT/StringRef.h"
0017 #include <map>
0018 #include <string>
0019 
0020 namespace llvm {
0021 
0022 namespace RISCVISAUtils {
0023 constexpr StringLiteral AllStdExts = "mafdqlcbkjtpvnh";
0024 
0025 /// Represents the major and version number components of a RISC-V extension.
0026 struct ExtensionVersion {
0027   unsigned Major;
0028   unsigned Minor;
0029 };
0030 
0031 bool compareExtension(const std::string &LHS, const std::string &RHS);
0032 
0033 /// Helper class for OrderedExtensionMap.
0034 struct ExtensionComparator {
0035   bool operator()(const std::string &LHS, const std::string &RHS) const {
0036     return compareExtension(LHS, RHS);
0037   }
0038 };
0039 
0040 /// OrderedExtensionMap is std::map, it's specialized to keep entries
0041 /// in canonical order of extension.
0042 typedef std::map<std::string, ExtensionVersion, ExtensionComparator>
0043     OrderedExtensionMap;
0044 
0045 } // namespace RISCVISAUtils
0046 
0047 } // namespace llvm
0048 
0049 #endif