@@ -351,11 +351,6 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
351
351
if (fnTy.getResults ().size () == 1 ) {
352
352
mlir::Type ty = fnTy.getResult (0 );
353
353
llvm::TypeSwitch<mlir::Type>(ty)
354
- .template Case <fir::ComplexType>([&](fir::ComplexType cmplx) {
355
- wrap = rewriteCallComplexResultType (loc, cmplx, newResTys,
356
- newInTyAndAttrs, newOpers,
357
- savedStackPtr);
358
- })
359
354
.template Case <mlir::ComplexType>([&](mlir::ComplexType cmplx) {
360
355
wrap = rewriteCallComplexResultType (loc, cmplx, newResTys,
361
356
newInTyAndAttrs, newOpers,
@@ -414,10 +409,6 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
414
409
}
415
410
}
416
411
})
417
- .template Case <fir::ComplexType>([&](fir::ComplexType cmplx) {
418
- rewriteCallComplexInputType (loc, cmplx, oper, newInTyAndAttrs,
419
- newOpers, savedStackPtr);
420
- })
421
412
.template Case <mlir::ComplexType>([&](mlir::ComplexType cmplx) {
422
413
rewriteCallComplexInputType (loc, cmplx, oper, newInTyAndAttrs,
423
414
newOpers, savedStackPtr);
@@ -538,10 +529,10 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
538
529
}
539
530
}
540
531
541
- // Result type fixup for fir:: ComplexType and mlir::ComplexType
542
- template <typename A, typename B >
532
+ // Result type fixup for ComplexType.
533
+ template <typename Ty >
543
534
void lowerComplexSignatureRes (
544
- mlir::Location loc, A cmplx, B &newResTys,
535
+ mlir::Location loc, mlir::ComplexType cmplx, Ty &newResTys,
545
536
fir::CodeGenSpecifics::Marshalling &newInTyAndAttrs) {
546
537
if (noComplexConversion) {
547
538
newResTys.push_back (cmplx);
@@ -557,10 +548,9 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
557
548
}
558
549
}
559
550
560
- // Argument type fixup for fir::ComplexType and mlir::ComplexType
561
- template <typename A>
551
+ // Argument type fixup for ComplexType.
562
552
void lowerComplexSignatureArg (
563
- mlir::Location loc, A cmplx,
553
+ mlir::Location loc, mlir::ComplexType cmplx,
564
554
fir::CodeGenSpecifics::Marshalling &newInTyAndAttrs) {
565
555
if (noComplexConversion) {
566
556
newInTyAndAttrs.push_back (fir::CodeGenSpecifics::getTypeAndAttr (cmplx));
@@ -602,9 +592,6 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
602
592
auto loc = addrOp.getLoc ();
603
593
for (mlir::Type ty : addrTy.getResults ()) {
604
594
llvm::TypeSwitch<mlir::Type>(ty)
605
- .Case <fir::ComplexType>([&](fir::ComplexType ty) {
606
- lowerComplexSignatureRes (loc, ty, newResTys, newInTyAndAttrs);
607
- })
608
595
.Case <mlir::ComplexType>([&](mlir::ComplexType ty) {
609
596
lowerComplexSignatureRes (loc, ty, newResTys, newInTyAndAttrs);
610
597
})
@@ -628,9 +615,6 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
628
615
}
629
616
}
630
617
})
631
- .Case <fir::ComplexType>([&](fir::ComplexType ty) {
632
- lowerComplexSignatureArg (loc, ty, newInTyAndAttrs);
633
- })
634
618
.Case <mlir::ComplexType>([&](mlir::ComplexType ty) {
635
619
lowerComplexSignatureArg (loc, ty, newInTyAndAttrs);
636
620
})
@@ -766,12 +750,6 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
766
750
// Convert return value(s)
767
751
for (auto ty : funcTy.getResults ())
768
752
llvm::TypeSwitch<mlir::Type>(ty)
769
- .Case <fir::ComplexType>([&](fir::ComplexType cmplx) {
770
- if (noComplexConversion)
771
- newResTys.push_back (cmplx);
772
- else
773
- doComplexReturn (func, cmplx, newResTys, newInTyAndAttrs, fixups);
774
- })
775
753
.Case <mlir::ComplexType>([&](mlir::ComplexType cmplx) {
776
754
if (noComplexConversion)
777
755
newResTys.push_back (cmplx);
@@ -835,9 +813,6 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
835
813
}
836
814
}
837
815
})
838
- .Case <fir::ComplexType>([&](fir::ComplexType cmplx) {
839
- doComplexArg (func, cmplx, newInTyAndAttrs, fixups);
840
- })
841
816
.Case <mlir::ComplexType>([&](mlir::ComplexType cmplx) {
842
817
doComplexArg (func, cmplx, newInTyAndAttrs, fixups);
843
818
})
@@ -1090,10 +1065,11 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
1090
1065
// / Convert a complex return value. This can involve converting the return
1091
1066
// / value to a "hidden" first argument or packing the complex into a wide
1092
1067
// / GPR.
1093
- template <typename A, typename B, typename C>
1094
- void doComplexReturn (mlir::func::FuncOp func, A cmplx, B &newResTys,
1068
+ template <typename Ty, typename FIXUPS>
1069
+ void doComplexReturn (mlir::func::FuncOp func, mlir::ComplexType cmplx,
1070
+ Ty &newResTys,
1095
1071
fir::CodeGenSpecifics::Marshalling &newInTyAndAttrs,
1096
- C &fixups) {
1072
+ FIXUPS &fixups) {
1097
1073
if (noComplexConversion) {
1098
1074
newResTys.push_back (cmplx);
1099
1075
return ;
@@ -1194,10 +1170,10 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
1194
1170
// / Convert a complex argument value. This can involve storing the value to
1195
1171
// / a temporary memory location or factoring the value into two distinct
1196
1172
// / arguments.
1197
- template <typename A, typename B >
1198
- void doComplexArg (mlir::func::FuncOp func, A cmplx,
1173
+ template <typename FIXUPS >
1174
+ void doComplexArg (mlir::func::FuncOp func, mlir::ComplexType cmplx,
1199
1175
fir::CodeGenSpecifics::Marshalling &newInTyAndAttrs,
1200
- B &fixups) {
1176
+ FIXUPS &fixups) {
1201
1177
if (noComplexConversion) {
1202
1178
newInTyAndAttrs.push_back (fir::CodeGenSpecifics::getTypeAndAttr (cmplx));
1203
1179
return ;
0 commit comments