Merge trunk version 204345 into gupc branch.
[official-gcc.git] / libgupc / smp / upc_lib.h
blobb50769c3585204de32e7c0765c6e7cee83bc5313
1 /* Copyright (C) 2006-2013 Free Software Foundation, Inc.
2 This file is part of the UPC runtime library.
3 Written by Gary Funck <gary@intrepid.com>
4 and Nenad Vukicevic <nenad@intrepid.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it 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.
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
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.
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/>. */
28 #ifndef _UPC_LIB_H_
29 #define _UPC_LIB_H_
31 /* Definition of user-visible UPC library routines,
32 in a form that they can be called from the
33 "C"-based runtime. */
35 extern size_t upc_threadof (upc_shared_ptr_t);
36 extern size_t upc_phaseof (upc_shared_ptr_t);
37 extern upc_shared_ptr_t upc_resetphase (upc_shared_ptr_t);
38 extern size_t upc_addrfield (upc_shared_ptr_t);
39 extern size_t upc_affinitysize (size_t, size_t, size_t);
41 extern void upc_global_exit (int);
43 extern void upc_memcpy (upc_shared_ptr_t dest, upc_shared_ptr_t src,
44 size_t n);
45 extern void upc_memget (void *dest, upc_shared_ptr_t src, size_t n);
46 extern void upc_memput (upc_shared_ptr_t dest, const void *src, size_t n);
47 extern void upc_memset (upc_shared_ptr_t dest, int c, size_t n);
49 extern upc_shared_ptr_t upc_global_alloc (size_t, size_t);
50 extern upc_shared_ptr_t upc_all_alloc (size_t, size_t);
51 extern upc_shared_ptr_t upc_alloc (size_t);
52 extern void upc_free (upc_shared_ptr_t);
53 extern void upc_all_free (upc_shared_ptr_t);
55 extern upc_shared_ptr_t upc_lock_alloc (void);
56 extern void upc_lock_free (upc_shared_ptr_t);
57 extern void upc_all_lock_free (upc_shared_ptr_t);
58 extern upc_shared_ptr_t upc_all_lock_alloc (void);
59 extern upc_shared_ptr_t upc_global_lock_alloc (void);
60 extern void upc_lock (upc_shared_ptr_t);
61 extern int upc_lock_attempt (upc_shared_ptr_t);
62 extern void upc_unlock (upc_shared_ptr_t);
64 typedef uint64_t upc_tick_t;
65 extern upc_tick_t upc_ticks_now(void);
66 extern uint64_t upc_ticks_to_ns(upc_tick_t ticks);
68 #endif /* _UPC_LIB_H_ */