@@ -1545,151 +1545,6 @@ class CopyInOutExplicitInterface {
15451545 const characteristics::DummyDataObject &dummyObj_;
15461546};
15471547
1548- static bool MayNeedCopy (FoldingContext &fc, const ActualArgument &actual,
1549- const characteristics::DummyDataObject *dummyObj, bool forCopyOut) {
1550- const bool forCopyIn = !forCopyOut;
1551- if (!evaluate::IsVariable (actual)) {
1552- // Actual argument expressions that aren’t variables are copy-in, but
1553- // not copy-out.
1554- return forCopyIn;
1555- }
1556- if (dummyObj) { // Explict interface
1557- CopyInOutExplicitInterface check{fc, actual, *dummyObj};
1558- if (forCopyOut && check.HasIntentIn ()) {
1559- // INTENT(IN) dummy args never need copy-out
1560- return false ;
1561- }
1562- if (forCopyIn && check.HasIntentOut ()) {
1563- // INTENT(OUT) dummy args never need copy-in
1564- return false ;
1565- }
1566- if (check.PassByValue ()) {
1567- // Pass by value, always copy-in, never copy-out
1568- return forCopyIn;
1569- }
1570- if (check.HaveCoarrayDifferences ()) {
1571- return true ;
1572- }
1573- // Note: contiguity and polymorphic checks deal with array or assumed rank
1574- // arguments
1575- if (!check.HaveArrayOrAssumedRankArgs ()) {
1576- return false ;
1577- }
1578- if (check.HaveContiguityDifferences ()) {
1579- return true ;
1580- }
1581- if (check.HavePolymorphicDifferences ()) {
1582- return true ;
1583- }
1584- } else { // Implicit interface
1585- if (ExtractCoarrayRef (actual)) {
1586- // Coindexed actual args may need copy-in and copy-out with implicit
1587- // interface
1588- return true ;
1589- }
1590- if (!IsSimplyContiguous (actual, fc)) {
1591- // Copy-in: actual arguments that are variables are copy-in when
1592- // non-contiguous.
1593- // Copy-out: vector subscripts could refer to duplicate elements, can't
1594- // copy out.
1595- return forCopyOut ? !HasVectorSubscript (actual) : true ;
1596- }
1597- }
1598- // For everything else, no copy-in or copy-out
1599- return false ;
1600- }
1601-
1602- static bool MayNeedCopyIn (FoldingContext &fc, const ActualArgument &actual,
1603- const characteristics::DummyDataObject *dummyObj) {
1604- if (!evaluate::IsVariable (actual)) {
1605- // Actual argument expressions that aren’t variables are copy-in, but
1606- // not copy-out.
1607- return true ;
1608- }
1609- if (dummyObj) { // Explicit interface
1610- CopyInOutExplicitInterface check{fc, actual, *dummyObj};
1611- if (check.HasIntentOut ()) {
1612- // INTENT(OUT) dummy args never need copy-in
1613- return false ;
1614- }
1615- if (check.PassByValue ()) {
1616- // Pass by value, always copy-in, never copy-out
1617- return true ;
1618- }
1619- if (check.HaveCoarrayDifferences ()) {
1620- return true ;
1621- }
1622- // Note: contiguity and polymorphic checks deal with array or assumed rank
1623- // arguments
1624- if (!check.HaveArrayOrAssumedRankArgs ()) {
1625- return false ;
1626- }
1627- if (check.HaveContiguityDifferences ()) {
1628- return true ;
1629- }
1630- if (check.HavePolymorphicDifferences ()) {
1631- return true ;
1632- }
1633- } else { // Implicit interface
1634- if (ExtractCoarrayRef (actual)) {
1635- // Coindexed actual args may need copy-in and copy-out with implicit
1636- // interface
1637- return true ;
1638- }
1639- if (!IsSimplyContiguous (actual, fc)) {
1640- // Actual arguments that are variables are copy-in when non-contiguous.
1641- return true ;
1642- }
1643- }
1644- // For everything else assume no copy-in
1645- return false ;
1646- }
1647-
1648- static bool MayNeedCopyOut (FoldingContext &fc, const ActualArgument &actual,
1649- const characteristics::DummyDataObject *dummyObj) {
1650- if (!evaluate::IsVariable (actual)) {
1651- // Expressions are never copy-out
1652- return false ;
1653- }
1654- if (dummyObj) { // Explict interface
1655- CopyInOutExplicitInterface check{fc, actual, *dummyObj};
1656- if (check.HasIntentIn ()) {
1657- // INTENT(IN) dummy args never need copy-out
1658- return false ;
1659- }
1660- if (check.PassByValue ()) {
1661- // Pass by value is never copy-out
1662- return false ;
1663- }
1664- if (check.HaveCoarrayDifferences ()) {
1665- return true ;
1666- }
1667- // Note: contiguity and polymorphic checks deal with array or assumed rank
1668- // arguments
1669- if (!check.HaveArrayOrAssumedRankArgs ()) {
1670- return false ;
1671- }
1672- if (check.HaveContiguityDifferences ()) {
1673- return true ;
1674- }
1675- if (check.HavePolymorphicDifferences ()) {
1676- return true ;
1677- }
1678- } else { // Implicit interface
1679- if (ExtractCoarrayRef (actual)) {
1680- // Coindexed actual args may need copy-in and copy-out with implicit
1681- // interface
1682- return true ;
1683- }
1684- if (!IsSimplyContiguous (actual, fc)) {
1685- // Vector subscripts could refer to duplicate elements, can't copy out
1686- return !HasVectorSubscript (actual);
1687- }
1688- }
1689- // For everything else assume no copy-out
1690- return false ;
1691- }
1692-
16931548// If forCopyOut is false, returns if a particular actual/dummy argument
16941549// combination may need a temporary creation with copy-in operation. If
16951550// forCopyOut is true, returns the same for copy-out operation. For
0 commit comments