@@ -107,18 +107,12 @@ static std::string computeBPFDataLayout(const Triple &TT) {
107
107
}
108
108
109
109
static std::string computeCSKYDataLayout (const Triple &TT) {
110
- std::string Ret;
111
-
112
- // Only support little endian for now.
113
- // TODO: Add support for big endian.
114
- Ret += " e" ;
115
-
116
110
// CSKY is always 32-bit target with the CSKYv2 ABI as prefer now.
117
111
// It's a 4-byte aligned stack with ELF mangling only.
118
- Ret += " -m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32"
112
+ // Only support little endian for now.
113
+ // TODO: Add support for big endian.
114
+ return " e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32"
119
115
" -v128:32:32-a:0:32-Fi32-n32" ;
120
-
121
- return Ret;
122
116
}
123
117
124
118
static std::string computeLoongArchDataLayout (const Triple &TT) {
@@ -320,7 +314,7 @@ static std::string computeSparcDataLayout(const Triple &T) {
320
314
Ret += " -m:e" ;
321
315
322
316
// Some ABIs have 32bit pointers.
323
- if (!is64Bit )
317
+ if (!Is64Bit )
324
318
Ret += " -p:32:32" ;
325
319
326
320
// Alignments for 64 bit integers.
@@ -332,12 +326,12 @@ static std::string computeSparcDataLayout(const Triple &T) {
332
326
333
327
// On SparcV9 128 floats are aligned to 128 bits, on others only to 64.
334
328
// On SparcV9 registers can hold 64 or 32 bits, on others only 32.
335
- if (is64Bit )
329
+ if (Is64Bit )
336
330
Ret += " -n32:64" ;
337
331
else
338
332
Ret += " -f128:64-n32" ;
339
333
340
- if (is64Bit )
334
+ if (Is64Bit )
341
335
Ret += " -S128" ;
342
336
else
343
337
Ret += " -S64" ;
@@ -356,10 +350,8 @@ static std::string computeSystemZDataLayout(const Triple &TT) {
356
350
357
351
// Special features for z/OS.
358
352
if (TT.isOSzOS ()) {
359
- if (TT.isArch64Bit ()) {
360
- // Custom address space for ptr32.
361
- Ret += " -p1:32:32" ;
362
- }
353
+ // Custom address space for ptr32.
354
+ Ret += " -p1:32:32" ;
363
355
}
364
356
365
357
// Make sure that global data has at least 16 bits of alignment by
@@ -387,12 +379,14 @@ static std::string computeSystemZDataLayout(const Triple &TT) {
387
379
}
388
380
389
381
static std::string computeX86DataLayout (const Triple &TT) {
382
+ bool Is64Bit = TT.getArch () == Triple::x86_64;
383
+
390
384
// X86 is little endian
391
385
std::string Ret = " e" ;
392
386
393
387
Ret += getManglingComponent (TT);
394
388
// X86 and x32 have 32 bit pointers.
395
- if (!TT. isArch64Bit () || TT.isX32 ())
389
+ if (!Is64Bit || TT.isX32 ())
396
390
Ret += " -p:32:32" ;
397
391
398
392
// Address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers.
@@ -401,7 +395,7 @@ static std::string computeX86DataLayout(const Triple &TT) {
401
395
// Some ABIs align 64 bit integers and doubles to 64 bits, others to 32.
402
396
// 128 bit integers are not specified in the 32-bit ABIs but are used
403
397
// internally for lowering f128, so we match the alignment to that.
404
- if (TT. isArch64Bit () || TT.isOSWindows ())
398
+ if (Is64Bit || TT.isOSWindows ())
405
399
Ret += " -i64:64-i128:128" ;
406
400
else if (TT.isOSIAMCU ())
407
401
Ret += " -i64:32-f64:32" ;
@@ -411,7 +405,7 @@ static std::string computeX86DataLayout(const Triple &TT) {
411
405
// Some ABIs align long double to 128 bits, others to 32.
412
406
if (TT.isOSIAMCU ())
413
407
; // No f80
414
- else if (TT. isArch64Bit () || TT.isOSDarwin () || TT.isWindowsMSVCEnvironment ())
408
+ else if (Is64Bit || TT.isOSDarwin () || TT.isWindowsMSVCEnvironment ())
415
409
Ret += " -f80:128" ;
416
410
else
417
411
Ret += " -f80:32" ;
@@ -420,13 +414,13 @@ static std::string computeX86DataLayout(const Triple &TT) {
420
414
Ret += " -f128:32" ;
421
415
422
416
// The registers can hold 8, 16, 32 or, in x86-64, 64 bits.
423
- if (TT. isArch64Bit () )
417
+ if (Is64Bit )
424
418
Ret += " -n8:16:32:64" ;
425
419
else
426
420
Ret += " -n8:16:32" ;
427
421
428
422
// The stack is aligned to 32 bits on some ABIs and 128 bits on others.
429
- if ((!TT. isArch64Bit () && TT.isOSWindows ()) || TT.isOSIAMCU ())
423
+ if ((!Is64Bit && TT.isOSWindows ()) || TT.isOSIAMCU ())
430
424
Ret += " -a:0:32-S32" ;
431
425
else
432
426
Ret += " -S128" ;
@@ -435,12 +429,13 @@ static std::string computeX86DataLayout(const Triple &TT) {
435
429
}
436
430
437
431
static std::string computeNVPTXDataLayout (const Triple &T, StringRef ABIName) {
432
+ bool Is64Bit = T.getArch () == Triple::nvptx64;
438
433
std::string Ret = " e" ;
439
434
440
435
// Tensor Memory (addrspace:6) is always 32-bits.
441
436
// Distributed Shared Memory (addrspace:7) follows shared memory
442
437
// (addrspace:3).
443
- if (!T. isArch64Bit () )
438
+ if (!Is64Bit )
444
439
Ret += " -p:32:32-p6:32:32-p7:32:32" ;
445
440
else if (ABIName == " shortptr" )
446
441
Ret += " -p3:32:32-p4:32:32-p5:32:32-p6:32:32-p7:32:32" ;
@@ -485,7 +480,7 @@ static std::string computeLanaiDataLayout() {
485
480
}
486
481
487
482
static std::string computeWebAssemblyDataLayout (const Triple &TT) {
488
- return TT.isArch64Bit ()
483
+ return TT.getArch () == Triple::wasm64
489
484
? (TT.isOSEmscripten () ? " e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-"
490
485
" i128:128-f128:64-n32:64-S128-ni:1:10:20"
491
486
: " e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-"
0 commit comments