17 if (
T.isOSBinFormatGOFF())
19 if (
T.isOSBinFormatMachO())
21 if ((
T.isOSWindows() ||
T.isUEFI()) &&
T.isOSBinFormatCOFF())
23 if (
T.isOSBinFormatXCOFF())
32 if (TT.isLittleEndian())
60 Ret +=
"-v64:32:64-v128:32:128";
62 Ret +=
"-v128:64:128";
84 if (TT.isOSBinFormatMachO()) {
86 return "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-"
88 return "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-"
91 if (TT.isOSBinFormatCOFF())
92 return "e-m:w-p270:32:32-p271:32:32-p272:64:64-p:64:64-i32:32-i64:64-i128:"
93 "128-n32:64-S128-Fn32";
94 std::string Endian = TT.isLittleEndian() ?
"e" :
"E";
95 std::string Ptr32 = TT.getEnvironment() ==
Triple::GNUILP32 ?
"-p:32:32" :
"";
96 return Endian +
"-m:e" + Ptr32 +
97 "-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-"
104 return "E-m:e-p:64:64-i64:64-i128:128-n32:64-S128";
106 return "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128";
114 return "e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32"
115 "-v128:32:32-a:0:32-Fi32-n32";
119 if (TT.isLoongArch64())
120 return "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128";
121 assert(TT.isLoongArch32() &&
"only LA32 and LA64 are currently supported");
122 return "e-m:e-p:32:32-i64:64-n32-S128";
126 std::string Ret =
"";
137 Ret +=
"-p:32:16:32";
141 Ret +=
"-i8:8:8-i16:16:16-i32:16:32";
148 Ret +=
"-a:0:16-S16";
154enum class MipsABI {
Unknown, O32, N32, N64 };
170 assert(ABIName.
empty() &&
"Unknown ABI option for MIPS");
182 if (TT.isLittleEndian())
187 if (ABI == MipsABI::O32)
193 if (ABI != MipsABI::N64)
198 Ret +=
"-i8:8:32-i16:16:32-i64:64";
203 if (ABI == MipsABI::N64 || ABI == MipsABI::N32)
204 Ret +=
"-i128:128-n32:64-S128";
216 if (
T.isLittleEndian())
233 }
else if (
T.isOSAIX()) {
234 Ret +=
is64Bit ?
"-Fi64" :
"-Fi32";
245 Ret +=
"-i128:128-n32:64";
252 if (
is64Bit && (
T.isOSAIX() ||
T.isOSLinux()))
253 Ret +=
"-S128-v256:256:256-v512:512:512";
261 return "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128"
262 "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1";
271 return "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32"
272 "-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-"
273 "v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-"
274 "v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9";
280 if (TT.isLittleEndian())
288 if (TT.isRISCV64()) {
289 Ret +=
"-p:64:64-i64:64-i128:128";
292 assert(TT.isRISCV32() &&
"only RV32 and RV64 are currently supported");
293 Ret +=
"-p:32:32-i64:64";
301 else if (ABI ==
"lp64e")
310 const bool Is64Bit =
T.isSPARC64();
332 Ret +=
"-f128:64-n32";
360 Ret +=
"-i1:8:16-i8:8:16";
385 std::string Ret =
"e";
389 if (!Is64Bit || TT.isX32())
393 Ret +=
"-p270:32:32-p271:32:32-p272:64:64";
398 if (Is64Bit || TT.isOSWindows())
399 Ret +=
"-i64:64-i128:128";
400 else if (TT.isOSIAMCU())
401 Ret +=
"-i64:32-f64:32";
403 Ret +=
"-i128:128-f64:32:64";
408 else if (Is64Bit || TT.isOSDarwin() || TT.isWindowsMSVCEnvironment())
418 Ret +=
"-n8:16:32:64";
423 if ((!Is64Bit && TT.isOSWindows()) || TT.isOSIAMCU())
424 Ret +=
"-a:0:32-S32";
433 std::string Ret =
"e";
439 Ret +=
"-p:32:32-p6:32:32-p7:32:32";
440 else if (ABIName ==
"shortptr")
441 Ret +=
"-p3:32:32-p4:32:32-p5:32:32-p6:32:32-p7:32:32";
445 Ret +=
"-i64:64-i128:128-i256:256-v16:16-v32:32-n16:32:64";
451 const auto Arch = TT.getArch();
458 return "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-"
459 "v256:256-v512:512-v1024:1024-n8:16:32:64-G1";
461 return "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-"
462 "v512:512-v1024:1024-n8:16:32:64-G10";
465 return "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-"
466 "v512:512-v1024:1024-n32:64-S32-G1-P4-A0";
468 return "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-"
469 "v512:512-v1024:1024-n8:16:32:64-G1-P9-A0";
470 return "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-"
471 "v512:512-v1024:1024-n8:16:32:64-G1";
487 ? (TT.isOSEmscripten() ?
"e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-"
488 "i128:128-f128:64-n32:64-S128-ni:1:10:20"
489 :
"e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-"
490 "i128:128-n32:64-S128-ni:1:10:20")
491 : (TT.isOSEmscripten() ?
"e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-"
492 "i128:128-f128:64-n32:64-S128-ni:1:10:20"
493 :
"e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-"
494 "i128:128-n32:64-S128-ni:1:10:20");
499 std::string Ret =
"e";
517 Ret +=
"-v128:64:64";
518 Ret +=
"-v256:64:64";
519 Ret +=
"-v512:64:64";
520 Ret +=
"-v1024:64:64";
521 Ret +=
"-v2048:64:64";
522 Ret +=
"-v4096:64:64";
523 Ret +=
"-v8192:64:64";
524 Ret +=
"-v16384:64:64";
541 return "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-"
542 "f32:32:32-i64:32-f64:32-a:0:32-n32";
544 return "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8:16-a:8";
551 return "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-"
552 "f32:32-f64:64-n8:16:32:64";
554 return "e-m:e-p:32:32:32-a:0-n16:32-"
555 "i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-"
556 "v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048";
568 return "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16";
595 return "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32";
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static std::string computeX86DataLayout(const Triple &TT)
static std::string computeNVPTXDataLayout(const Triple &T, StringRef ABIName)
static std::string computeSystemZDataLayout(const Triple &TT)
static std::string computeAMDDataLayout(const Triple &TT)
static std::string computeMipsDataLayout(const Triple &TT, StringRef ABIName)
static std::string computeBPFDataLayout(const Triple &TT)
static std::string computeSPIRVDataLayout(const Triple &TT)
static std::string computeWebAssemblyDataLayout(const Triple &TT)
static StringRef getManglingComponent(const Triple &T)
static std::string computeCSKYDataLayout(const Triple &TT)
static std::string computePowerDataLayout(const Triple &T)
static std::string computeLanaiDataLayout()
static std::string computeM68kDataLayout(const Triple &TT)
static std::string computeARMDataLayout(const Triple &TT, StringRef ABIName)
static MipsABI getMipsABI(const Triple &TT, StringRef ABIName)
static std::string computeLoongArchDataLayout(const Triple &TT)
static std::string computeVEDataLayout(const Triple &T)
static std::string computeSparcDataLayout(const Triple &T)
static std::string computeRISCVDataLayout(const Triple &TT, StringRef ABIName)
static std::string computeAArch64DataLayout(const Triple &TT)
static bool is64Bit(const char *name)
StringRef - Represent a constant reference to a string, i.e.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
empty - Check if the string is empty.
Triple - Helper class for working with autoconf configuration names.
LLVM_ABI std::string computeDataLayout(StringRef ABIName="") const
Compute the LLVM IR data layout string based on the triple.
ArchType getArch() const
Get the parsed architecture type of this triple.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI LLVM_READONLY ARMABI computeTargetABI(const Triple &TT, StringRef ABIName="")
This is an optimization pass for GlobalISel generic memory operations.