(root)/
gcc-13.2.0/
libgomp/
libgomp-plugin.c
       1  /* Copyright (C) 2014-2023 Free Software Foundation, Inc.
       2  
       3     Contributed by Mentor Embedded.
       4  
       5     This file is part of the GNU Offloading and Multi Processing Library
       6     (libgomp).
       7  
       8     Libgomp is free software; you can redistribute it and/or modify it
       9     under the terms of the GNU General Public License as published by
      10     the Free Software Foundation; either version 3, or (at your option)
      11     any later version.
      12  
      13     Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
      14     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      15     FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
      16     more details.
      17  
      18     Under Section 7 of GPL version 3, you are granted additional
      19     permissions described in the GCC Runtime Library Exception, version
      20     3.1, as published by the Free Software Foundation.
      21  
      22     You should have received a copy of the GNU General Public License and
      23     a copy of the GCC Runtime Library Exception along with this program;
      24     see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      25     <http://www.gnu.org/licenses/>.  */
      26  
      27  /* Exported (non-hidden) functions exposing libgomp interface for plugins.  */
      28  
      29  #include <stdlib.h>
      30  
      31  #include "libgomp.h"
      32  #include "libgomp-plugin.h"
      33  
      34  void *
      35  GOMP_PLUGIN_malloc (size_t size)
      36  {
      37    return gomp_malloc (size);
      38  }
      39  
      40  void *
      41  GOMP_PLUGIN_malloc_cleared (size_t size)
      42  {
      43    return gomp_malloc_cleared (size);
      44  }
      45  
      46  void *
      47  GOMP_PLUGIN_realloc (void *ptr, size_t size)
      48  {
      49    return gomp_realloc (ptr, size);
      50  }
      51  
      52  void
      53  GOMP_PLUGIN_debug (int kind, const char *msg, ...)
      54  {
      55    va_list ap;
      56  
      57    va_start (ap, msg);
      58    gomp_vdebug (kind, msg, ap);
      59    va_end (ap);
      60  }
      61  
      62  void
      63  GOMP_PLUGIN_error (const char *msg, ...)
      64  {
      65    va_list ap;
      66  
      67    va_start (ap, msg);
      68    gomp_verror (msg, ap);
      69    va_end (ap);
      70  }
      71  
      72  void
      73  GOMP_PLUGIN_fatal (const char *msg, ...)
      74  {
      75    va_list ap;
      76  
      77    va_start (ap, msg);
      78    gomp_vfatal (msg, ap);
      79    va_end (ap);
      80  }
      81  
      82  void
      83  GOMP_PLUGIN_target_rev (uint64_t fn_ptr, uint64_t mapnum, uint64_t devaddrs_ptr,
      84  			uint64_t sizes_ptr, uint64_t kinds_ptr, int dev_num,
      85  			void (*dev_to_host_cpy) (void *, const void *, size_t,
      86  						 void *),
      87  			void (*host_to_dev_cpy) (void *, const void *, size_t,
      88  						 void *), void *token)
      89  {
      90    gomp_target_rev (fn_ptr, mapnum, devaddrs_ptr, sizes_ptr, kinds_ptr, dev_num,
      91  		   dev_to_host_cpy, host_to_dev_cpy, token);
      92  }