@@ -1567,6 +1567,42 @@ static AsyncContextLayout getAsyncContextLayout(IRGenSILFunction &IGF) {
1567
1567
return getAsyncContextLayout (IGF.IGM , IGF.CurSILFn );
1568
1568
}
1569
1569
1570
+ Explosion NativeCCEntryPointArgumentEmission::explosionForObject (
1571
+ IRGenFunction &IGF, unsigned index, SILArgument *param, SILType paramTy,
1572
+ const LoadableTypeInfo &loadableParamTI,
1573
+ const LoadableTypeInfo &loadableArgTI,
1574
+ std::function<Explosion(unsigned index, unsigned size)>
1575
+ explosionForArgument) {
1576
+ Explosion paramValues;
1577
+ // If the explosion must be passed indirectly, load the value from the
1578
+ // indirect address.
1579
+ auto &nativeSchema = loadableArgTI.nativeParameterValueSchema (IGF.IGM );
1580
+ if (nativeSchema.requiresIndirect ()) {
1581
+ Explosion paramExplosion = explosionForArgument (index, 1 );
1582
+ Address paramAddr =
1583
+ loadableParamTI.getAddressForPointer (paramExplosion.claimNext ());
1584
+ if (loadableParamTI.getStorageType () != loadableArgTI.getStorageType ())
1585
+ paramAddr = loadableArgTI.getAddressForPointer (IGF.Builder .CreateBitCast (
1586
+ paramAddr.getAddress (),
1587
+ loadableArgTI.getStorageType ()->getPointerTo ()));
1588
+ loadableArgTI.loadAsTake (IGF, paramAddr, paramValues);
1589
+ } else {
1590
+ if (!nativeSchema.empty ()) {
1591
+ // Otherwise, we map from the native convention to the type's explosion
1592
+ // schema.
1593
+ Explosion nativeParam;
1594
+ unsigned size = nativeSchema.size ();
1595
+ Explosion paramExplosion = explosionForArgument (index, size);
1596
+ paramExplosion.transferInto (nativeParam, size);
1597
+ paramValues = nativeSchema.mapFromNative (IGF.IGM , IGF, nativeParam,
1598
+ param->getType ());
1599
+ } else {
1600
+ assert (loadableParamTI.getSchema ().empty ());
1601
+ }
1602
+ }
1603
+ return paramValues;
1604
+ }
1605
+
1570
1606
namespace {
1571
1607
class SyncEntryPointArgumentEmission
1572
1608
: public virtual EntryPointArgumentEmission {
@@ -1652,42 +1688,6 @@ class SyncNativeCCEntryPointArgumentEmission final
1652
1688
llvm::Value *getCoroutineBuffer () override {
1653
1689
return allParamValues.claimNext ();
1654
1690
}
1655
- Explosion
1656
- explosionForObject (IRGenFunction &IGF, unsigned index, SILArgument *param,
1657
- SILType paramTy, const LoadableTypeInfo &loadableParamTI,
1658
- const LoadableTypeInfo &loadableArgTI,
1659
- std::function<Explosion(unsigned index, unsigned size)>
1660
- explosionForArgument) override {
1661
- Explosion paramValues;
1662
- // If the explosion must be passed indirectly, load the value from the
1663
- // indirect address.
1664
- auto &nativeSchema = loadableArgTI.nativeParameterValueSchema (IGF.IGM );
1665
- if (nativeSchema.requiresIndirect ()) {
1666
- Explosion paramExplosion = explosionForArgument (index, 1 );
1667
- Address paramAddr =
1668
- loadableParamTI.getAddressForPointer (paramExplosion.claimNext ());
1669
- if (loadableParamTI.getStorageType () != loadableArgTI.getStorageType ())
1670
- paramAddr =
1671
- loadableArgTI.getAddressForPointer (IGF.Builder .CreateBitCast (
1672
- paramAddr.getAddress (),
1673
- loadableArgTI.getStorageType ()->getPointerTo ()));
1674
- loadableArgTI.loadAsTake (IGF, paramAddr, paramValues);
1675
- } else {
1676
- if (!nativeSchema.empty ()) {
1677
- // Otherwise, we map from the native convention to the type's explosion
1678
- // schema.
1679
- Explosion nativeParam;
1680
- unsigned size = nativeSchema.size ();
1681
- Explosion paramExplosion = explosionForArgument (index, size);
1682
- paramExplosion.transferInto (nativeParam, size);
1683
- paramValues = nativeSchema.mapFromNative (IGF.IGM , IGF, nativeParam,
1684
- param->getType ());
1685
- } else {
1686
- assert (loadableParamTI.getSchema ().empty ());
1687
- }
1688
- }
1689
- return paramValues;
1690
- };
1691
1691
1692
1692
public:
1693
1693
using SyncEntryPointArgumentEmission::requiresIndirectResult;
@@ -1767,42 +1767,6 @@ class AsyncNativeCCEntryPointArgumentEmission final
1767
1767
llvm_unreachable (
1768
1768
" async functions do not use a fixed size coroutine buffer" );
1769
1769
}
1770
- Explosion
1771
- explosionForObject (IRGenFunction &IGF, unsigned index, SILArgument *param,
1772
- SILType paramTy, const LoadableTypeInfo &loadableParamTI,
1773
- const LoadableTypeInfo &loadableArgTI,
1774
- std::function<Explosion(unsigned index, unsigned size)>
1775
- explosionForArgument) override {
1776
- Explosion paramValues;
1777
- // If the explosion must be passed indirectly, load the value from the
1778
- // indirect address.
1779
- auto &nativeSchema = loadableArgTI.nativeParameterValueSchema (IGF.IGM );
1780
- if (nativeSchema.requiresIndirect ()) {
1781
- Explosion paramExplosion = explosionForArgument (index, 1 );
1782
- Address paramAddr =
1783
- loadableParamTI.getAddressForPointer (paramExplosion.claimNext ());
1784
- if (loadableParamTI.getStorageType () != loadableArgTI.getStorageType ())
1785
- paramAddr =
1786
- loadableArgTI.getAddressForPointer (IGF.Builder .CreateBitCast (
1787
- paramAddr.getAddress (),
1788
- loadableArgTI.getStorageType ()->getPointerTo ()));
1789
- loadableArgTI.loadAsTake (IGF, paramAddr, paramValues);
1790
- } else {
1791
- if (!nativeSchema.empty ()) {
1792
- // Otherwise, we map from the native convention to the type's explosion
1793
- // schema.
1794
- Explosion nativeParam;
1795
- unsigned size = nativeSchema.size ();
1796
- Explosion paramExplosion = explosionForArgument (index, size);
1797
- paramExplosion.transferInto (nativeParam, size);
1798
- paramValues = nativeSchema.mapFromNative (IGF.IGM , IGF, nativeParam,
1799
- param->getType ());
1800
- } else {
1801
- assert (loadableParamTI.getSchema ().empty ());
1802
- }
1803
- }
1804
- return paramValues;
1805
- };
1806
1770
};
1807
1771
1808
1772
std::unique_ptr<NativeCCEntryPointArgumentEmission>
0 commit comments