@@ -379,8 +379,10 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty,
379
379
380
380
// Check some invariants
381
381
// FIXME: Enforce these by construction.
382
- assert ((Hi != Memory || Lo == Memory) && " Invalid memory classification." );
383
- assert ((Hi != SSEUp || Lo == SSE) && " Invalid SSEUp classification." );
382
+ assert ((Hi != Class::Memory || Lo == Class::Memory) &&
383
+ " Invalid memory classification." );
384
+ assert ((Hi != Class::SSEUp || Lo == Class::SSE) &&
385
+ " Invalid SSEUp classification." );
384
386
385
387
neededInt = 0 ;
386
388
neededSSE = 0 ;
@@ -391,15 +393,15 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty,
391
393
392
394
// AMD64-ABI 3.2.3p3: Rule 2. If the class is INTEGER, the next available
393
395
// register of the sequence %rdi, %rsi, %rdx, %rcx, %r8 and %r9 is used.
394
- case Integer:
396
+ case Class:: Integer:
395
397
++neededInt;
396
398
397
399
// Pick an 8-byte type based on the preferred type.
398
400
ResType = GetINTEGERTypeAtOffset (CGT.ConvertType (Ty), 0 , Ty, 0 );
399
401
400
402
// If we have a sign or zero extended integer, make sure to return Extend so
401
403
// that the parameter gets the right LLVM IR attributes.
402
- if (Hi == NoClass && mlir::isa<mlir::cir::IntType>(ResType)) {
404
+ if (Hi == Class:: NoClass && mlir::isa<mlir::cir::IntType>(ResType)) {
403
405
assert (!Ty->getAs <EnumType>() && " NYI" );
404
406
if (Ty->isSignedIntegerOrEnumerationType () &&
405
407
isPromotableIntegerTypeForABI (Ty))
@@ -411,7 +413,7 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty,
411
413
// AMD64-ABI 3.2.3p3: Rule 3. If the class is SSE, the next available SSE
412
414
// register is used, the registers are taken in the order from %xmm0 to
413
415
// %xmm7.
414
- case SSE: {
416
+ case Class:: SSE: {
415
417
mlir::Type CIRType = CGT.ConvertType (Ty);
416
418
ResType = GetSSETypeAtOffset (CIRType, 0 , Ty, 0 );
417
419
++neededSSE;
@@ -423,7 +425,7 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty,
423
425
switch (Hi) {
424
426
default :
425
427
assert (false && " NYI" );
426
- case NoClass:
428
+ case Class:: NoClass:
427
429
break ;
428
430
}
429
431
@@ -453,23 +455,23 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, Class &Lo,
453
455
// shouldn't be passed in registers for example, so there is no chance they
454
456
// can straddle an eightbyte. Verify & simplify.
455
457
456
- Lo = Hi = NoClass;
458
+ Lo = Hi = Class:: NoClass;
457
459
Class &Current = OffsetBase < 64 ? Lo : Hi;
458
- Current = Memory;
460
+ Current = Class:: Memory;
459
461
460
462
if (const auto *BT = Ty->getAs <BuiltinType>()) {
461
463
BuiltinType::Kind k = BT->getKind ();
462
464
if (k == BuiltinType::Void) {
463
- Current = NoClass;
465
+ Current = Class:: NoClass;
464
466
} else if (k == BuiltinType::Int128 || k == BuiltinType::UInt128) {
465
467
assert (false && " NYI" );
466
- Lo = Integer;
467
- Hi = Integer;
468
+ Lo = Class:: Integer;
469
+ Hi = Class:: Integer;
468
470
} else if (k >= BuiltinType::Bool && k <= BuiltinType::LongLong) {
469
- Current = Integer;
471
+ Current = Class:: Integer;
470
472
} else if (k == BuiltinType::Float || k == BuiltinType::Double ||
471
473
k == BuiltinType::Float16) {
472
- Current = SSE;
474
+ Current = Class:: SSE;
473
475
} else if (k == BuiltinType::LongDouble) {
474
476
assert (false && " NYI" );
475
477
} else
@@ -482,7 +484,7 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, Class &Lo,
482
484
483
485
assert (!Ty->getAs <EnumType>() && " Enums NYI" );
484
486
if (Ty->hasPointerRepresentation ()) {
485
- Current = Integer;
487
+ Current = Class:: Integer;
486
488
return ;
487
489
}
488
490
@@ -508,27 +510,29 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const {
508
510
classify (RetTy, 0 , Lo, Hi, /* isNamedArg*/ true );
509
511
510
512
// Check some invariants.
511
- assert ((Hi != Memory || Lo == Memory) && " Invalid memory classification." );
512
- assert ((Hi != SSEUp || Lo == SSE) && " Invalid SSEUp classification." );
513
+ assert ((Hi != Class::Memory || Lo == Class::Memory) &&
514
+ " Invalid memory classification." );
515
+ assert ((Hi != Class::SSEUp || Lo == Class::SSE) &&
516
+ " Invalid SSEUp classification." );
513
517
514
518
mlir::Type ResType = nullptr ;
515
- assert (Lo == NoClass || Lo == Integer ||
516
- Lo == SSE && " Only NoClass and Integer supported so far" );
519
+ assert (Lo == Class:: NoClass || Lo == Class:: Integer ||
520
+ Lo == Class:: SSE && " Only NoClass and Integer supported so far" );
517
521
518
522
switch (Lo) {
519
- case NoClass:
520
- assert (Hi == NoClass && " Only NoClass supported so far for Hi" );
523
+ case Class:: NoClass:
524
+ assert (Hi == Class:: NoClass && " Only NoClass supported so far for Hi" );
521
525
return ABIArgInfo::getIgnore ();
522
526
523
527
// AMD64-ABI 3.2.3p4: Rule 3. If the class is INTEGER, the next available
524
528
// register of the sequence %rax, %rdx is used.
525
- case Integer:
529
+ case Class:: Integer:
526
530
ResType = GetINTEGERTypeAtOffset (CGT.ConvertType (RetTy), 0 , RetTy, 0 );
527
531
528
532
// If we have a sign or zero extended integer, make sure to return Extend so
529
533
// that the parameter gets the right LLVM IR attributes.
530
534
// TODO: extend the above consideration to MLIR
531
- if (Hi == NoClass && mlir::isa<mlir::cir::IntType>(ResType)) {
535
+ if (Hi == Class:: NoClass && mlir::isa<mlir::cir::IntType>(ResType)) {
532
536
// Treat an enum type as its underlying type.
533
537
if (const auto *EnumTy = RetTy->getAs <EnumType>())
534
538
RetTy = EnumTy->getDecl ()->getIntegerType ();
@@ -542,7 +546,7 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const {
542
546
543
547
// AMD64-ABI 3.2.3p4: Rule 4. If the class is SSE, the next available SSE
544
548
// register of the sequence %xmm0, %xmm1 is used.
545
- case SSE:
549
+ case Class:: SSE:
546
550
ResType = GetSSETypeAtOffset (CGT.ConvertType (RetTy), 0 , RetTy, 0 );
547
551
break ;
548
552
0 commit comments