|
|
|||
File indexing completed on 2026-05-10 08:36:51
0001 //===--- TargetID.h - Utilities for target ID -------------------*- 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 #ifndef LLVM_CLANG_BASIC_TARGETID_H 0010 #define LLVM_CLANG_BASIC_TARGETID_H 0011 0012 #include "llvm/ADT/SmallVector.h" 0013 #include "llvm/ADT/StringMap.h" 0014 #include "llvm/TargetParser/Triple.h" 0015 #include <optional> 0016 #include <set> 0017 0018 namespace clang { 0019 0020 /// Get all feature strings that can be used in target ID for \p Processor. 0021 /// Target ID is a processor name with optional feature strings 0022 /// postfixed by a plus or minus sign delimited by colons, e.g. 0023 /// gfx908:xnack+:sramecc-. Each processor have a limited 0024 /// number of predefined features when showing up in a target ID. 0025 llvm::SmallVector<llvm::StringRef, 4> 0026 getAllPossibleTargetIDFeatures(const llvm::Triple &T, 0027 llvm::StringRef Processor); 0028 0029 /// Get processor name from target ID. 0030 /// Returns canonical processor name or empty if the processor name is invalid. 0031 llvm::StringRef getProcessorFromTargetID(const llvm::Triple &T, 0032 llvm::StringRef OffloadArch); 0033 0034 /// Parse a target ID to get processor and feature map. 0035 /// Returns canonicalized processor name or std::nullopt if the target ID is 0036 /// invalid. Returns target ID features in \p FeatureMap if it is not null 0037 /// pointer. This function assumes \p OffloadArch is a valid target ID. 0038 /// If the target ID contains feature+, map it to true. 0039 /// If the target ID contains feature-, map it to false. 0040 /// If the target ID does not contain a feature (default), do not map it. 0041 std::optional<llvm::StringRef> parseTargetID(const llvm::Triple &T, 0042 llvm::StringRef OffloadArch, 0043 llvm::StringMap<bool> *FeatureMap); 0044 0045 /// Returns canonical target ID, assuming \p Processor is canonical and all 0046 /// entries in \p Features are valid. 0047 std::string getCanonicalTargetID(llvm::StringRef Processor, 0048 const llvm::StringMap<bool> &Features); 0049 0050 /// Get the conflicted pair of target IDs for a compilation or a bundled code 0051 /// object, assuming \p TargetIDs are canonicalized. If there is no conflicts, 0052 /// returns std::nullopt. 0053 std::optional<std::pair<llvm::StringRef, llvm::StringRef>> 0054 getConflictTargetIDCombination(const std::set<llvm::StringRef> &TargetIDs); 0055 0056 /// Check whether the provided target ID is compatible with the requested 0057 /// target ID. 0058 bool isCompatibleTargetID(llvm::StringRef Provided, llvm::StringRef Requested); 0059 } // namespace clang 0060 0061 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|