LLVM 22.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
13#include "llvm/Support/Error.h"
19
20namespace llvm {
21
22class Triple;
23
24namespace MachO {
25
26// This is similar to a llvm Triple, but the triple doesn't have all the
27// information we need. For example there is no enum value for x86_64h. The
28// only way to get that information is to parse the triple string.
29class Target {
30public:
31 Target() = default;
35 explicit Target(const llvm::Triple &Triple)
38
40
41 LLVM_ABI operator std::string() const;
42
46};
47
48inline bool operator==(const Target &LHS, const Target &RHS) {
49 // In most cases the deployment version is not useful to compare.
50 return std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform);
51}
52
53inline bool operator!=(const Target &LHS, const Target &RHS) {
54 return !(LHS == RHS);
55}
56
57inline bool operator<(const Target &LHS, const Target &RHS) {
58 // In most cases the deployment version is not useful to compare.
59 return std::tie(LHS.Arch, LHS.Platform) < std::tie(RHS.Arch, RHS.Platform);
60}
61
62inline bool operator==(const Target &LHS, const Architecture &RHS) {
63 return LHS.Arch == RHS;
64}
65
66inline bool operator!=(const Target &LHS, const Architecture &RHS) {
67 return LHS.Arch != RHS;
68}
69
72LLVM_ABI ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets);
73
74LLVM_ABI std::string getTargetTripleName(const Target &Targ);
75
77
78} // namespace MachO
79} // namespace llvm
80
81#endif // LLVM_TEXTAPI_TARGET_H
#define LLVM_ABI
Definition: Compiler.h:213
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:485
PlatformType Platform
Definition: Target.h:44
Target(Architecture Arch, PlatformType Platform, VersionTuple MinDeployment={})
Definition: Target.h:32
static LLVM_ABI llvm::Expected< Target > create(StringRef Target)
Definition: Target.cpp:17
Target(const llvm::Triple &Triple)
Definition: Target.h:35
Architecture Arch
Definition: Target.h:43
VersionTuple MinDeployment
Definition: Target.h:45
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:47
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:30
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
LLVM_ABI std::string getTargetTripleName(const Target &Targ)
Definition: Target.cpp:76
PlatformType
Definition: MachO.h:500
LLVM_ABI VersionTuple mapToSupportedOSVersion(const Triple &Triple)
Definition: Platform.cpp:123
bool operator!=(const Target &LHS, const Target &RHS)
Definition: Target.h:53
SmallSet< PlatformType, 3 > PlatformSet
Definition: Platform.h:23
LLVM_ABI 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:28
LLVM_ABI PlatformType mapToPlatformType(PlatformType Platform, bool WantSim)
Definition: Platform.cpp:21
LLVM_ABI PlatformVersionSet mapToPlatformVersionSet(ArrayRef< Target > Targets)
Definition: Target.cpp:55
LLVM_ABI raw_ostream & operator<<(raw_ostream &OS, Architecture Arch)
LLVM_ABI Architecture mapToArchitecture(const llvm::Triple &Target)
Convert a target to an architecture slice.
LLVM_ABI ArchitectureSet mapToArchitectureSet(ArrayRef< Target > Targets)
Definition: Target.cpp:69
SmallSet< std::pair< PlatformType, VersionTuple >, 3 > PlatformVersionSet
Definition: Platform.h:24
bool operator<(const Target &LHS, const Target &RHS)
Definition: Target.h:57
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)