@@ -379,8 +379,10 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty,
379379
380380 // Check some invariants
381381 // 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." );
384386
385387 neededInt = 0 ;
386388 neededSSE = 0 ;
@@ -391,15 +393,15 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty,
391393
392394 // AMD64-ABI 3.2.3p3: Rule 2. If the class is INTEGER, the next available
393395 // register of the sequence %rdi, %rsi, %rdx, %rcx, %r8 and %r9 is used.
394- case Integer:
396+ case Class:: Integer:
395397 ++neededInt;
396398
397399 // Pick an 8-byte type based on the preferred type.
398400 ResType = GetINTEGERTypeAtOffset (CGT.ConvertType (Ty), 0 , Ty, 0 );
399401
400402 // If we have a sign or zero extended integer, make sure to return Extend so
401403 // 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)) {
403405 assert (!Ty->getAs <EnumType>() && " NYI" );
404406 if (Ty->isSignedIntegerOrEnumerationType () &&
405407 isPromotableIntegerTypeForABI (Ty))
@@ -411,7 +413,7 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty,
411413 // AMD64-ABI 3.2.3p3: Rule 3. If the class is SSE, the next available SSE
412414 // register is used, the registers are taken in the order from %xmm0 to
413415 // %xmm7.
414- case SSE: {
416+ case Class:: SSE: {
415417 mlir::Type CIRType = CGT.ConvertType (Ty);
416418 ResType = GetSSETypeAtOffset (CIRType, 0 , Ty, 0 );
417419 ++neededSSE;
@@ -423,7 +425,7 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty,
423425 switch (Hi) {
424426 default :
425427 assert (false && " NYI" );
426- case NoClass:
428+ case Class:: NoClass:
427429 break ;
428430 }
429431
@@ -453,23 +455,23 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, Class &Lo,
453455 // shouldn't be passed in registers for example, so there is no chance they
454456 // can straddle an eightbyte. Verify & simplify.
455457
456- Lo = Hi = NoClass;
458+ Lo = Hi = Class:: NoClass;
457459 Class &Current = OffsetBase < 64 ? Lo : Hi;
458- Current = Memory;
460+ Current = Class:: Memory;
459461
460462 if (const auto *BT = Ty->getAs <BuiltinType>()) {
461463 BuiltinType::Kind k = BT->getKind ();
462464 if (k == BuiltinType::Void) {
463- Current = NoClass;
465+ Current = Class:: NoClass;
464466 } else if (k == BuiltinType::Int128 || k == BuiltinType::UInt128) {
465467 assert (false && " NYI" );
466- Lo = Integer;
467- Hi = Integer;
468+ Lo = Class:: Integer;
469+ Hi = Class:: Integer;
468470 } else if (k >= BuiltinType::Bool && k <= BuiltinType::LongLong) {
469- Current = Integer;
471+ Current = Class:: Integer;
470472 } else if (k == BuiltinType::Float || k == BuiltinType::Double ||
471473 k == BuiltinType::Float16) {
472- Current = SSE;
474+ Current = Class:: SSE;
473475 } else if (k == BuiltinType::LongDouble) {
474476 assert (false && " NYI" );
475477 } else
@@ -482,7 +484,7 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, Class &Lo,
482484
483485 assert (!Ty->getAs <EnumType>() && " Enums NYI" );
484486 if (Ty->hasPointerRepresentation ()) {
485- Current = Integer;
487+ Current = Class:: Integer;
486488 return ;
487489 }
488490
@@ -508,27 +510,29 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const {
508510 classify (RetTy, 0 , Lo, Hi, /* isNamedArg*/ true );
509511
510512 // 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." );
513517
514518 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" );
517521
518522 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" );
521525 return ABIArgInfo::getIgnore ();
522526
523527 // AMD64-ABI 3.2.3p4: Rule 3. If the class is INTEGER, the next available
524528 // register of the sequence %rax, %rdx is used.
525- case Integer:
529+ case Class:: Integer:
526530 ResType = GetINTEGERTypeAtOffset (CGT.ConvertType (RetTy), 0 , RetTy, 0 );
527531
528532 // If we have a sign or zero extended integer, make sure to return Extend so
529533 // that the parameter gets the right LLVM IR attributes.
530534 // 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)) {
532536 // Treat an enum type as its underlying type.
533537 if (const auto *EnumTy = RetTy->getAs <EnumType>())
534538 RetTy = EnumTy->getDecl ()->getIntegerType ();
@@ -542,7 +546,7 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const {
542546
543547 // AMD64-ABI 3.2.3p4: Rule 4. If the class is SSE, the next available SSE
544548 // register of the sequence %xmm0, %xmm1 is used.
545- case SSE:
549+ case Class:: SSE:
546550 ResType = GetSSETypeAtOffset (CGT.ConvertType (RetTy), 0 , RetTy, 0 );
547551 break ;
548552
0 commit comments