clang  14.0.0git
TargetID.h
Go to the documentation of this file.
1 //===--- TargetID.h - Utilities for target ID -------------------*- 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 #ifndef LLVM_CLANG_BASIC_TARGET_ID_H
10 #define LLVM_CLANG_BASIC_TARGET_ID_H
11 
12 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/ADT/StringMap.h"
14 #include "llvm/ADT/Triple.h"
15 #include <set>
16 
17 namespace clang {
18 
19 /// Get all feature strings that can be used in target ID for \p Processor.
20 /// Target ID is a processor name with optional feature strings
21 /// postfixed by a plus or minus sign delimited by colons, e.g.
22 /// gfx908:xnack+:sramecc-. Each processor have a limited
23 /// number of predefined features when showing up in a target ID.
25 getAllPossibleTargetIDFeatures(const llvm::Triple &T,
26  llvm::StringRef Processor);
27 
28 /// Get processor name from target ID.
29 /// Returns canonical processor name or empty if the processor name is invalid.
30 llvm::StringRef getProcessorFromTargetID(const llvm::Triple &T,
31  llvm::StringRef OffloadArch);
32 
33 /// Parse a target ID to get processor and feature map.
34 /// Returns canonicalized processor name or None if the target ID is invalid.
35 /// Returns target ID features in \p FeatureMap if it is not null pointer.
36 /// This function assumes \p OffloadArch is a valid target ID.
37 /// If the target ID contains feature+, map it to true.
38 /// If the target ID contains feature-, map it to false.
39 /// If the target ID does not contain a feature (default), do not map it.
41 parseTargetID(const llvm::Triple &T, llvm::StringRef OffloadArch,
42  llvm::StringMap<bool> *FeatureMap);
43 
44 /// Returns canonical target ID, assuming \p Processor is canonical and all
45 /// entries in \p Features are valid.
46 std::string getCanonicalTargetID(llvm::StringRef Processor,
47  const llvm::StringMap<bool> &Features);
48 
49 /// Get the conflicted pair of target IDs for a compilation or a bundled code
50 /// object, assuming \p TargetIDs are canonicalized. If there is no conflicts,
51 /// returns None.
53 getConflictTargetIDCombination(const std::set<llvm::StringRef> &TargetIDs);
54 } // namespace clang
55 
56 #endif
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
llvm::SmallVector
Definition: LLVM.h:38
llvm::Optional
Definition: LLVM.h:40
clang::getProcessorFromTargetID
llvm::StringRef getProcessorFromTargetID(const llvm::Triple &T, llvm::StringRef OffloadArch)
Get processor name from target ID.
Definition: TargetID.cpp:53
clang::parseTargetID
llvm::Optional< llvm::StringRef > parseTargetID(const llvm::Triple &T, llvm::StringRef OffloadArch, llvm::StringMap< bool > *FeatureMap)
Parse a target ID to get processor and feature map.
Definition: TargetID.cpp:104
clang::getAllPossibleTargetIDFeatures
const llvm::SmallVector< llvm::StringRef, 4 > getAllPossibleTargetIDFeatures(const llvm::Triple &T, llvm::StringRef Processor)
Get all feature strings that can be used in target ID for Processor.
Definition: TargetID.cpp:37
clang::getConflictTargetIDCombination
llvm::Optional< std::pair< llvm::StringRef, llvm::StringRef > > getConflictTargetIDCombination(const std::set< llvm::StringRef > &TargetIDs)
Get the conflicted pair of target IDs for a compilation or a bundled code object, assuming TargetIDs ...
Definition: TargetID.cpp:145
clang::getCanonicalTargetID
std::string getCanonicalTargetID(llvm::StringRef Processor, const llvm::StringMap< bool > &Features)
Returns canonical target ID, assuming Processor is canonical and all entries in Features are valid.
Definition: TargetID.cpp:130
clang
Definition: CalledOnceCheck.h:17