File indexing completed on 2026-05-10 08:44:38
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_TEXTAPI_TARGET_H
0010 #define LLVM_TEXTAPI_TARGET_H
0011
0012 #include "llvm/Support/Error.h"
0013 #include "llvm/Support/VersionTuple.h"
0014 #include "llvm/TargetParser/Triple.h"
0015 #include "llvm/TextAPI/Architecture.h"
0016 #include "llvm/TextAPI/ArchitectureSet.h"
0017 #include "llvm/TextAPI/Platform.h"
0018
0019 namespace llvm {
0020
0021 class Triple;
0022
0023 namespace MachO {
0024
0025
0026
0027
0028 class Target {
0029 public:
0030 Target() = default;
0031 Target(Architecture Arch, PlatformType Platform,
0032 VersionTuple MinDeployment = {})
0033 : Arch(Arch), Platform(Platform), MinDeployment(MinDeployment) {}
0034 explicit Target(const llvm::Triple &Triple)
0035 : Arch(mapToArchitecture(Triple)), Platform(mapToPlatformType(Triple)),
0036 MinDeployment(mapToSupportedOSVersion(Triple)) {}
0037
0038 static llvm::Expected<Target> create(StringRef Target);
0039
0040 operator std::string() const;
0041
0042 Architecture Arch;
0043 PlatformType Platform;
0044 VersionTuple MinDeployment;
0045 };
0046
0047 inline bool operator==(const Target &LHS, const Target &RHS) {
0048
0049 return std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform);
0050 }
0051
0052 inline bool operator!=(const Target &LHS, const Target &RHS) {
0053 return !(LHS == RHS);
0054 }
0055
0056 inline bool operator<(const Target &LHS, const Target &RHS) {
0057
0058 return std::tie(LHS.Arch, LHS.Platform) < std::tie(RHS.Arch, RHS.Platform);
0059 }
0060
0061 inline bool operator==(const Target &LHS, const Architecture &RHS) {
0062 return LHS.Arch == RHS;
0063 }
0064
0065 inline bool operator!=(const Target &LHS, const Architecture &RHS) {
0066 return LHS.Arch != RHS;
0067 }
0068
0069 PlatformVersionSet mapToPlatformVersionSet(ArrayRef<Target> Targets);
0070 PlatformSet mapToPlatformSet(ArrayRef<Target> Targets);
0071 ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets);
0072
0073 std::string getTargetTripleName(const Target &Targ);
0074
0075 raw_ostream &operator<<(raw_ostream &OS, const Target &Target);
0076
0077 }
0078 }
0079
0080 #endif