@@ -79,6 +79,7 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
79
79
TargetRewrite (const fir::TargetRewriteOptions &options) {
80
80
noCharacterConversion = options.noCharacterConversion ;
81
81
noComplexConversion = options.noComplexConversion ;
82
+ noStructConversion = options.noStructConversion ;
82
83
}
83
84
84
85
void runOnOperation () override final {
@@ -252,6 +253,11 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
252
253
fir::CodeGenSpecifics::Marshalling &newInTyAndAttrs,
253
254
llvm::SmallVectorImpl<mlir::Value> &newOpers,
254
255
mlir::Value &savedStackPtr) {
256
+ if (noStructConversion) {
257
+ newInTyAndAttrs.push_back (fir::CodeGenSpecifics::getTypeAndAttr (recTy));
258
+ newOpers.push_back (oper);
259
+ return ;
260
+ }
255
261
auto structArgs =
256
262
specifics->structArgumentType (loc, recTy, newInTyAndAttrs);
257
263
if (structArgs.size () != 1 )
@@ -522,6 +528,10 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
522
528
void
523
529
lowerStructSignatureArg (mlir::Location loc, fir::RecordType recTy,
524
530
fir::CodeGenSpecifics::Marshalling &newInTyAndAttrs) {
531
+ if (noStructConversion) {
532
+ newInTyAndAttrs.push_back (fir::CodeGenSpecifics::getTypeAndAttr (recTy));
533
+ return ;
534
+ }
525
535
auto structArgs =
526
536
specifics->structArgumentType (loc, recTy, newInTyAndAttrs);
527
537
newInTyAndAttrs.insert (newInTyAndAttrs.end (), structArgs.begin (),
@@ -645,7 +655,7 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
645
655
!noCharacterConversion) ||
646
656
(fir::isa_complex (ty) && !noComplexConversion) ||
647
657
(ty.isa <mlir::IntegerType>() && hasCCallingConv) ||
648
- ty.isa <fir::RecordType>()) {
658
+ ( ty.isa <fir::RecordType>() && !noStructConversion )) {
649
659
LLVM_DEBUG (llvm::dbgs () << " rewrite " << signature << " for target\n " );
650
660
return false ;
651
661
}
@@ -1128,6 +1138,10 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
1128
1138
void doStructArg (mlir::func::FuncOp func, fir::RecordType recTy,
1129
1139
fir::CodeGenSpecifics::Marshalling &newInTyAndAttrs,
1130
1140
FIXUPS &fixups) {
1141
+ if (noStructConversion) {
1142
+ newInTyAndAttrs.push_back (fir::CodeGenSpecifics::getTypeAndAttr (recTy));
1143
+ return ;
1144
+ }
1131
1145
auto structArgs =
1132
1146
specifics->structArgumentType (func.getLoc (), recTy, newInTyAndAttrs);
1133
1147
createFuncOpArgFixups (func, newInTyAndAttrs, structArgs, fixups);
0 commit comments