LLVM 23.0.0git
TargetParser.h
Go to the documentation of this file.
1//===-- TargetParser - Parser for target features ---------------*- 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// This file implements a target parser to recognise hardware features such as
10// FPU/CPU/ARCH names as well as specific support such as HDIV, etc.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TARGETPARSER_TARGETPARSER_H
15#define LLVM_TARGETPARSER_TARGETPARSER_H
16
17#include "SubtargetFeature.h"
18#include "llvm/ADT/ArrayRef.h"
19#include "llvm/ADT/StringMap.h"
20#include "llvm/ADT/StringRef.h"
22#include <optional>
23
24namespace llvm {
25
27 const char *Key; ///< K-V key string
28 unsigned Value; ///< K-V integer value
29 FeatureBitArray Implies; ///< K-V bit mask
30};
31
32/// Used to provide key value pairs for feature and CPU bit flags.
34 const char *Key; ///< K-V key string
35 FeatureBitArray Implies; ///< K-V bit mask
36
37 /// Compare routine for std::lower_bound
38 bool operator<(StringRef S) const { return StringRef(Key) < S; }
39
40 /// Compare routine for std::is_sorted.
42 return StringRef(Key) < StringRef(Other.Key);
43 }
44};
45
46LLVM_ABI std::optional<llvm::StringMap<bool>>
47getCPUDefaultTargetFeatures(StringRef CPU,
50} // namespace llvm
51
52#endif
This file defines the StringMap class.
#define LLVM_ABI
Definition Compiler.h:213
Class used to store the subtarget bits in the tables created by tablegen.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
This is an optimization pass for GlobalISel generic memory operations.
@ Other
Any other memory.
Definition ModRef.h:68
ArrayRef(const T &OneElt) -> ArrayRef< T >
LLVM_ABI std::optional< llvm::StringMap< bool > > getCPUDefaultTargetFeatures(StringRef CPU, ArrayRef< BasicSubtargetSubTypeKV > ProcDesc, ArrayRef< BasicSubtargetFeatureKV > ProcFeatures)
FeatureBitArray Implies
K-V bit mask.
const char * Key
K-V key string.
unsigned Value
K-V integer value.
Used to provide key value pairs for feature and CPU bit flags.
FeatureBitArray Implies
K-V bit mask.
bool operator<(const BasicSubtargetSubTypeKV &Other) const
Compare routine for std::is_sorted.
bool operator<(StringRef S) const
Compare routine for std::lower_bound.
const char * Key
K-V key string.