[OpenACC] Refactor 'GOACC_enter_exit_data' to call 'goacc_enter_data', 'goacc_exit_data'
authorThomas Schwinge <thomas@codesourcery.com>
Wed, 18 Dec 2019 17:02:10 +0000 (18:02 +0100)
committerThomas Schwinge <tschwinge@gcc.gnu.org>
Wed, 18 Dec 2019 17:02:10 +0000 (18:02 +0100)
No functional changes.

libgomp/
* oacc-mem.c (GOACC_enter_exit_data): Refactor code to call
'goacc_enter_data', 'goacc_exit_data'.

From-SVN: r279537

libgomp/ChangeLog
libgomp/oacc-mem.c

index 683bb1ee28344f3f8c2ef67ff1be6f4d5a56264d..9bb22e932ecce2006b3bca314bf0d36b14a6362e 100644 (file)
@@ -1,5 +1,8 @@
 2019-12-18  Thomas Schwinge  <thomas@codesourcery.com>
 
+       * oacc-mem.c (GOACC_enter_exit_data): Refactor code to call
+       'goacc_enter_data', 'goacc_exit_data'.
+
        * oacc-mem.c (delete_copyout): Refactor into...
        (goacc_exit_data): ... this.  Adjust all users.
 
index 76356ce92805a49e72de76f5be0dae038c3da564..6509bd7882115f2c978b65e4b3cf21035aca4aae 100644 (file)
@@ -1158,28 +1158,26 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs,
     {
       for (i = 0; i < mapnum; i++)
        {
-         unsigned char kind = kinds[i] & 0xff;
-
          /* Scan for pointers and PSETs.  */
          int pointer = find_pointer (i, mapnum, kinds);
 
          if (!pointer)
            {
+             unsigned char kind = kinds[i] & 0xff;
              switch (kind)
                {
                case GOMP_MAP_ALLOC:
                case GOMP_MAP_FORCE_ALLOC:
-                 acc_create_async (hostaddrs[i], sizes[i], async);
-                 break;
                case GOMP_MAP_TO:
                case GOMP_MAP_FORCE_TO:
-                 acc_copyin_async (hostaddrs[i], sizes[i], async);
                  break;
                default:
                  gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 0x%.2x",
                              kind);
                  break;
                }
+
+             goacc_enter_data (hostaddrs[i], sizes[i], kinds[i], async);
            }
          else
            {
@@ -1198,9 +1196,6 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs,
       {
        unsigned char kind = kinds[i] & 0xff;
 
-       bool finalize = (kind == GOMP_MAP_DELETE
-                        || kind == GOMP_MAP_FORCE_FROM);
-
        int pointer = find_pointer (i, mapnum, kinds);
 
        if (!pointer)
@@ -1209,26 +1204,21 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs,
              {
              case GOMP_MAP_RELEASE:
              case GOMP_MAP_DELETE:
-               if (finalize)
-                 acc_delete_finalize_async (hostaddrs[i], sizes[i], async);
-               else
-                 acc_delete_async (hostaddrs[i], sizes[i], async);
-               break;
              case GOMP_MAP_FROM:
              case GOMP_MAP_FORCE_FROM:
-               if (finalize)
-                 acc_copyout_finalize_async (hostaddrs[i], sizes[i], async);
-               else
-                 acc_copyout_async (hostaddrs[i], sizes[i], async);
                break;
              default:
                gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 0x%.2x",
                            kind);
                break;
              }
+
+           goacc_exit_data (hostaddrs[i], sizes[i], kinds[i], async);
          }
        else
          {
+           bool finalize = (kind == GOMP_MAP_DELETE
+                            || kind == GOMP_MAP_FORCE_FROM);
            bool copyfrom = (kind == GOMP_MAP_FORCE_FROM
                             || kind == GOMP_MAP_FROM);
            goacc_remove_pointer (hostaddrs[i], sizes[i], copyfrom, async,