LLVM 20.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 // In most cases the deployment version is not useful to compare.
49 return std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform);
50}
51
52inline bool operator!=(const Target &LHS, const Target &RHS) {
53 return !(LHS == RHS);
54}
55
56inline bool operator<(const Target &LHS, const Target &RHS) {
57 // In most cases the deployment version is not useful to compare.
58 return std::tie(LHS.Arch, LHS.Platform) < std::tie(RHS.Arch, RHS.Platform);
59}
60
61inline bool operator==(const Target &LHS, const Architecture &RHS) {
62 return LHS.Arch == RHS;
63}
64
65inline bool operator!=(const Target &LHS, const Architecture &RHS) {
66 return LHS.Arch != RHS;
67}
68
71ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets);
72
73std::string getTargetTripleName(const Target &Targ);
74
76
77} // namespace MachO
78} // namespace llvm
79
80#endif // LLVM_TEXTAPI_TARGET_H
raw_pwrite_stream & OS
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:481
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:29
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:76
PlatformType
Definition: MachO.h:500
VersionTuple mapToSupportedOSVersion(const Triple &Triple)
Definition: Platform.cpp:123
bool operator!=(const Target &LHS, const Target &RHS)
Definition: Target.h:52
SmallSet< PlatformType, 3 > PlatformSet
Definition: Platform.h:22
PlatformSet mapToPlatformSet(ArrayRef< Triple > Targets)
Definition: Platform.cpp:62
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
PlatformVersionSet mapToPlatformVersionSet(ArrayRef< Target > Targets)
Definition: Target.cpp:55
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:69
SmallSet< std::pair< PlatformType, VersionTuple >, 3 > PlatformVersionSet
Definition: Platform.h:23
bool operator<(const Target &LHS, const Target &RHS)
Definition: Target.h:56
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)