LLVM  15.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"
15 #include "llvm/TextAPI/Platform.h"
16 
17 namespace llvm {
18 
19 class Triple;
20 
21 namespace MachO {
22 
23 // This is similar to a llvm Triple, but the triple doesn't have all the
24 // information we need. For example there is no enum value for x86_64h. The
25 // only way to get that information is to parse the triple string.
26 class Target {
27 public:
28  Target() = default;
30  : Arch(Arch), Platform(Platform) {}
31  explicit Target(const llvm::Triple &Triple)
33 
35 
36  operator std::string() const;
37 
40 };
41 
42 inline bool operator==(const Target &LHS, const Target &RHS) {
43  return std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform);
44 }
45 
46 inline bool operator!=(const Target &LHS, const Target &RHS) {
47  return std::tie(LHS.Arch, LHS.Platform) != std::tie(RHS.Arch, RHS.Platform);
48 }
49 
50 inline bool operator<(const Target &LHS, const Target &RHS) {
51  return std::tie(LHS.Arch, LHS.Platform) < std::tie(RHS.Arch, RHS.Platform);
52 }
53 
54 inline bool operator==(const Target &LHS, const Architecture &RHS) {
55  return LHS.Arch == RHS;
56 }
57 
58 inline bool operator!=(const Target &LHS, const Architecture &RHS) {
59  return LHS.Arch != RHS;
60 }
61 
63 ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets);
64 
65 std::string getTargetTripleName(const Target &Targ);
66 
68 
69 } // namespace MachO
70 } // namespace llvm
71 
72 #endif // LLVM_TEXTAPI_TARGET_H
llvm::MachO::Target::Arch
Architecture Arch
Definition: Target.h:38
llvm::MachO::operator==
bool operator==(const DenseMapBase< DerivedT, SymbolsMapKey, MachO::Symbol *, KeyInfoT, BucketT > &LHS, const DenseMapBase< DerivedT, SymbolsMapKey, MachO::Symbol *, KeyInfoT, BucketT > &RHS)
Definition: InterfaceFile.h:440
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::MachO::mapToArchitectureSet
ArchitectureSet mapToArchitectureSet(ArrayRef< Target > Targets)
Definition: Target.cpp:65
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:140
llvm::MachO::Target
Definition: Target.h:26
Error.h
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Architecture.h
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::MachO::operator<
bool operator<(const Target &LHS, const Target &RHS)
Definition: Target.h:50
llvm::MachO::Target::create
static llvm::Expected< Target > create(StringRef Target)
Definition: Target.cpp:17
llvm::MachO::mapToPlatformType
PlatformType mapToPlatformType(PlatformType Platform, bool WantSim)
Definition: Platform.cpp:21
Platform.h
llvm::MachO::Target::Target
Target()=default
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::MachO::PlatformType
PlatformType
Definition: MachO.h:492
llvm::MachO::Target::Platform
PlatformType Platform
Definition: Target.h:39
llvm::MachO::Architecture
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
Definition: Architecture.h:27
llvm::MachO::operator<<
raw_ostream & operator<<(raw_ostream &OS, Architecture Arch)
Definition: Architecture.cpp:92
llvm::MachO::operator!=
bool operator!=(const Target &LHS, const Target &RHS)
Definition: Target.h:46
llvm::MachO::Target::Target
Target(Architecture Arch, PlatformType Platform)
Definition: Target.h:29
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MachO::PlatformSet
SmallSet< PlatformType, 3 > PlatformSet
Definition: Platform.h:21
llvm::MachO::mapToArchitecture
Architecture mapToArchitecture(const llvm::Triple &Target)
Convert a target to an architecture slice.
Definition: Architecture.cpp:74
llvm::MachO::getTargetTripleName
std::string getTargetTripleName(const Target &Targ)
Definition: Target.cpp:72
llvm::MachO::mapToPlatformSet
PlatformSet mapToPlatformSet(ArrayRef< Triple > Targets)
Definition: Platform.cpp:56
ArchitectureSet.h
llvm::MachO::Target::Target
Target(const llvm::Triple &Triple)
Definition: Target.h:31