LLVM 17.0.0git
Target.h
Go to the documentation of this file.
1//===- llvm/TextAPI/Target.h - TAPI Target ----------------------*- 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_TEXTAPI_TARGET_H
10#define LLVM_TEXTAPI_TARGET_H
11
12#include "llvm/Support/Error.h"
18
19namespace llvm {
20
21class Triple;
22
23namespace MachO {
24
25// This is similar to a llvm Triple, but the triple doesn't have all the
26// information we need. For example there is no enum value for x86_64h. The
27// only way to get that information is to parse the triple string.
28class Target {
29public:
30 Target() = default;
34 explicit Target(const llvm::Triple &Triple)
37
39
40 operator std::string() const;
41
45};
46
47inline bool operator==(const Target &LHS, const Target &RHS) {
48 return std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform);
49}
50
51inline bool operator!=(const Target &LHS, const Target &RHS) {
52 return std::tie(LHS.Arch, LHS.Platform) != std::tie(RHS.Arch, RHS.Platform);
53}
54
55inline bool operator<(const Target &LHS, const Target &RHS) {
56 return std::tie(LHS.Arch, LHS.Platform) < std::tie(RHS.Arch, RHS.Platform);
57}
58
59inline bool operator==(const Target &LHS, const Architecture &RHS) {
60 return LHS.Arch == RHS;
61}
62
63inline bool operator!=(const Target &LHS, const Architecture &RHS) {
64 return LHS.Arch != RHS;
65}
66
69
70std::string getTargetTripleName(const Target &Targ);
71
73
74} // namespace MachO
75} // namespace llvm
76
77#endif // LLVM_TEXTAPI_TARGET_H
raw_pwrite_stream & OS
@ Targets
Definition: TextStubV5.cpp:90
Defines the llvm::VersionTuple class, which represents a version in the form major[....
Value * RHS
Value * LHS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Tagged union holding either a T or a Error.
Definition: Error.h:470
PlatformType Platform
Definition: Target.h:43
Target(Architecture Arch, PlatformType Platform, VersionTuple MinDeployment={})
Definition: Target.h:31
static llvm::Expected< Target > create(StringRef Target)
Definition: Target.cpp:17
Target(const llvm::Triple &Triple)
Definition: Target.h:34
Architecture Arch
Definition: Target.h:42
VersionTuple MinDeployment
Definition: Target.h:44
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:31
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
std::string getTargetTripleName(const Target &Targ)
Definition: Target.cpp:75
PlatformType
Definition: MachO.h:497
VersionTuple mapToSupportedOSVersion(const Triple &Triple)
Definition: Platform.cpp:135
bool operator!=(const Target &LHS, const Target &RHS)
Definition: Target.h:51
SmallSet< PlatformType, 3 > PlatformSet
Definition: Platform.h:22
PlatformSet mapToPlatformSet(ArrayRef< Triple > Targets)
Definition: Platform.cpp:56
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
Definition: Architecture.h:27
PlatformType mapToPlatformType(PlatformType Platform, bool WantSim)
Definition: Platform.cpp:21
bool operator==(const DenseMapBase< DerivedT, SymbolsMapKey, MachO::Symbol *, KeyInfoT, BucketT > &LHS, const DenseMapBase< DerivedT, SymbolsMapKey, MachO::Symbol *, KeyInfoT, BucketT > &RHS)
raw_ostream & operator<<(raw_ostream &OS, Architecture Arch)
Architecture mapToArchitecture(const llvm::Triple &Target)
Convert a target to an architecture slice.
ArchitectureSet mapToArchitectureSet(ArrayRef< Target > Targets)
Definition: Target.cpp:68
bool operator<(const Target &LHS, const Target &RHS)
Definition: Target.h:55
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18