LLVM 24.0.0git
SparcTargetParser.cpp
Go to the documentation of this file.
1//===-- SparcTargetParser.cpp - Parser for SPARC target features ----------===//
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
10// for SPARC CPUs.
11//
12//===----------------------------------------------------------------------===//
13
15#include "llvm/ADT/STLExtras.h"
17
18#define GET_SUBTARGETFEATURES_ENUM
19#define GET_SUBTARGETFEATURES_KV
20#include "llvm/TargetParser/SparcGenTargetFeatures.inc"
21
22namespace llvm {
23namespace Sparc {
24
26 ArrayRef<BasicSubtargetSubTypeKV> A = BasicSparcSubTypeKV;
28 return P != A.end() && StringRef(P->Key) == CPU;
29}
30
32 for (const BasicSubtargetSubTypeKV &P : BasicSparcSubTypeKV)
33 Values.emplace_back(P.Key);
34}
35
37 if (!CPUName.empty())
38 return CPUName;
39 return T.isSPARC64() ? "v9" : "v8";
40}
41
42std::optional<StringMap<bool>> getSparcDefaultTargetFeatures(StringRef CPU) {
43 return getCPUDefaultTargetFeatures(CPU, BasicSparcSubTypeKV,
44 BasicSparcFeatureKV);
45}
46
48 ArrayRef<BasicSubtargetFeatureKV> A = BasicSparcFeatureKV;
50 return F != A.end() && StringRef(F->Key) == Name;
51}
52
53} // namespace Sparc
54} // namespace llvm
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define F(x, y, z)
Definition MD5.cpp:54
#define T
#define P(N)
This file contains some templates that are useful if you are working with the STL at all.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr bool empty() const
Check if the string is empty.
Definition StringRef.h:141
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
LLVM_ABI void fillValidCPUList(SmallVectorImpl< StringRef > &Values)
Fill Values with the names of the processors known to the SPARC backend.
LLVM_ABI std::optional< StringMap< bool > > getSparcDefaultTargetFeatures(StringRef CPU)
Return the features enabled by default for CPU, including the ones they imply, or std::nullopt if CPU...
LLVM_ABI StringRef getNormalizedSparcTargetCPU(const Triple &T, StringRef CPUName="")
Return CPUName, or the default CPU for T if CPUName is empty.
LLVM_ABI bool isValidCPU(StringRef CPU)
Return true if CPU is a processor known to the SPARC backend.
LLVM_ABI bool isValidFeatureName(StringRef Name)
Return true if Name is a SPARC target feature.
This is an optimization pass for GlobalISel generic memory operations.
RelativeUniformCounterPtr Values
Definition InstrProf.h:91
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
Definition STLExtras.h:2068
LLVM_ABI std::optional< llvm::StringMap< bool > > getCPUDefaultTargetFeatures(StringRef CPU, ArrayRef< BasicSubtargetSubTypeKV > ProcDesc, ArrayRef< BasicSubtargetFeatureKV > ProcFeatures)
Used to provide key value pairs for feature and CPU bit flags.