Skip to content

Commit 97381e6

Browse files
authored
[IRGen] Support additional single payload enum cases in layout strings (swiftlang#66042)
* [IRGen] Support additional single payload enum cases in layout strings rdar://105837101 Adds layout string support for single payload enums with simple (non-scattered) extra inhabitant patterns * Add more test cases
1 parent e18d71c commit 97381e6

File tree

10 files changed

+527
-65
lines changed

10 files changed

+527
-65
lines changed

lib/IRGen/GenDiffFunc.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ class DifferentiableFuncTypeInfo final
139139
// return fields[0];
140140
// }
141141

142-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
142+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
143+
fields, T, getBestKnownAlignment().getValue(), *this);
143144
}
144145

145146
llvm::NoneType getNonFixedOffsets(IRGenFunction &IGF) const { return None; }
@@ -313,7 +314,8 @@ class LinearFuncTypeInfo final
313314
// return fields[0];
314315
// }
315316

316-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
317+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
318+
fields, T, getBestKnownAlignment().getValue(), *this);
317319
}
318320

319321
llvm::NoneType getNonFixedOffsets(IRGenFunction &IGF) const { return None; }

lib/IRGen/GenExistential.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,8 @@ class ClassExistentialTypeInfo final
10871087
ScalarKind::TriviallyDestroyable));
10881088
}
10891089

1090-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(alignedGroup, T, getBestKnownAlignment().getValue());
1090+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
1091+
alignedGroup, T, getBestKnownAlignment().getValue(), *this);
10911092
}
10921093

10931094
/// Given an explosion with multiple pointer elements in them, pack them

lib/IRGen/GenStruct.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ namespace {
416416
// return fields[0];
417417
// }
418418

419-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
419+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
420+
fields, T, getBestKnownAlignment().getValue(), *this);
420421
}
421422

422423
void initializeFromParams(IRGenFunction &IGF, Explosion &params,
@@ -765,7 +766,8 @@ namespace {
765766
return fields[0];
766767
}
767768

768-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
769+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
770+
fields, T, getBestKnownAlignment().getValue(), *this);
769771
}
770772

771773
void initializeFromParams(IRGenFunction &IGF, Explosion &params,
@@ -921,7 +923,8 @@ namespace {
921923
return fields[0];
922924
}
923925

924-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
926+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
927+
fields, T, getBestKnownAlignment().getValue(), *this);
925928
}
926929

927930
void initializeFromParams(IRGenFunction &IGF, Explosion &params,
@@ -999,7 +1002,8 @@ namespace {
9991002
// return fields[0];
10001003
// }
10011004

1002-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
1005+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
1006+
fields, T, getBestKnownAlignment().getValue(), *this);
10031007
}
10041008

10051009
llvm::NoneType getNonFixedOffsets(IRGenFunction &IGF) const {
@@ -1090,7 +1094,8 @@ namespace {
10901094
// return fields[0];
10911095
// }
10921096

1093-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
1097+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
1098+
fields, T, getBestKnownAlignment().getValue(), *this);
10941099
}
10951100

10961101
// We have an indirect schema.

lib/IRGen/GenTuple.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ namespace {
297297
// if (fields.size() == 1) {
298298
// return fields[0];
299299
// }
300-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
300+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
301+
fields, T, getBestKnownAlignment().getValue(), *this);
301302
}
302303

303304
llvm::NoneType getNonFixedOffsets(IRGenFunction &IGF) const {
@@ -348,7 +349,8 @@ namespace {
348349
// return fields[0];
349350
// }
350351

351-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
352+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
353+
fields, T, getBestKnownAlignment().getValue(), *this);
352354
}
353355

354356
llvm::NoneType getNonFixedOffsets(IRGenFunction &IGF) const {
@@ -422,7 +424,8 @@ namespace {
422424
// return fields[0];
423425
// }
424426

425-
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(fields, T, getBestKnownAlignment().getValue());
427+
return IGM.typeLayoutCache.getOrCreateAlignedGroupEntry(
428+
fields, T, getBestKnownAlignment().getValue(), *this);
426429
}
427430

428431
llvm::Value *getEnumTagSinglePayload(IRGenFunction &IGF,

0 commit comments

Comments
 (0)