1 /* Copyright (C) 2009-2014 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)
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 #include "upc_config.h"
29 #include "upc_sysdep.h"
37 __upc_barrierg (int barrier_id
, const char *filename
, const int linenum
)
39 int named
= (barrier_id
!= INT_MIN
);
40 p_start (GASP_UPC_BARRIER
, named
, barrier_id
);
42 __upc_barrier (barrier_id
);
43 GUPCR_CLEAR_ERR_LOC();
44 p_end (GASP_UPC_BARRIER
, named
, barrier_id
);
48 __upc_notifyg (int barrier_id
, const char *filename
, const int linenum
)
50 int named
= (barrier_id
!= INT_MIN
);
51 p_start (GASP_UPC_NOTIFY
, named
, barrier_id
);
53 __upc_notify (barrier_id
);
54 GUPCR_CLEAR_ERR_LOC();
55 p_end (GASP_UPC_NOTIFY
, named
, barrier_id
);
59 __upc_waitg (int barrier_id
, const char *filename
, const int linenum
)
61 int named
= (barrier_id
!= INT_MIN
);
62 p_start (GASP_UPC_WAIT
, named
, barrier_id
);
64 __upc_wait (barrier_id
);
65 GUPCR_CLEAR_ERR_LOC();
66 p_end (GASP_UPC_WAIT
, named
, barrier_id
);
70 upc_global_lock_allocg (const char *filename
, int linenum
)
72 upc_shared_ptr_t result
;
73 p_start (GASP_UPC_GLOBAL_LOCK_ALLOC
);
75 result
= upc_global_lock_alloc();
76 GUPCR_CLEAR_ERR_LOC();
77 p_end (GASP_UPC_GLOBAL_LOCK_ALLOC
, &result
);
82 upc_all_lock_freeg (upc_shared_ptr_t ptr
, const char *filename
, int linenum
)
84 p_start (GASP_UPC_LOCK_FREE
, &ptr
);
86 upc_all_lock_free(ptr
);
87 GUPCR_CLEAR_ERR_LOC();
88 p_end (GASP_UPC_LOCK_FREE
, &ptr
);
92 upc_lock_freeg (upc_shared_ptr_t ptr
, const char *filename
, int linenum
)
94 p_start (GASP_UPC_LOCK_FREE
, &ptr
);
97 GUPCR_CLEAR_ERR_LOC();
98 p_end (GASP_UPC_LOCK_FREE
, &ptr
);
102 upc_all_lock_allocg (const char *filename
, int linenum
)
104 upc_shared_ptr_t result
;
105 p_start (GASP_UPC_ALL_LOCK_ALLOC
);
107 result
= upc_all_lock_alloc();
108 GUPCR_CLEAR_ERR_LOC();
109 p_end (GASP_UPC_ALL_LOCK_ALLOC
, &result
);
114 upc_lockg (upc_shared_ptr_t ptr
, const char *filename
, int linenum
)
116 p_start (GASP_UPC_LOCK
, &ptr
);
119 GUPCR_CLEAR_ERR_LOC();
120 p_end (GASP_UPC_LOCK
, &ptr
);
124 upc_lock_attemptg (upc_shared_ptr_t ptr
, const char *filename
, int linenum
)
127 p_start (GASP_UPC_LOCK_ATTEMPT
, &ptr
);
129 status
= upc_lock_attempt(ptr
);
130 GUPCR_CLEAR_ERR_LOC();
131 p_end (GASP_UPC_LOCK_ATTEMPT
, &ptr
, status
);
136 upc_unlockg (upc_shared_ptr_t ptr
, const char *filename
, int linenum
)
138 p_start (GASP_UPC_UNLOCK
, &ptr
);
141 GUPCR_CLEAR_ERR_LOC();
142 p_end (GASP_UPC_UNLOCK
, &ptr
);
146 __upc_funcg (int start
, const char *funcname
,
147 const char *filename
, const int linenum
)
150 p_start (GASP_C_FUNC
, funcname
);
152 p_end (GASP_C_FUNC
, funcname
);
156 __upc_forallg (int start
, const char *filename
, const int linenum
)
159 p_start (GASP_UPC_FORALL
);
161 p_end (GASP_UPC_FORALL
);
164 extern void __upc_exitg (int status
, const char *filename
, int linenum
)
165 __attribute__ ((__noreturn__
));
168 __upc_exitg (int status
, const char *filename
, int linenum
)
170 p_start (GASP_UPC_COLLECTIVE_EXIT
, status
);
171 p_end (GASP_UPC_COLLECTIVE_EXIT
, status
);
176 upc_global_exitg (int status
, const char *filename
, int linenum
)
178 p_atomic (GASP_UPC_NONCOLLECTIVE_EXIT
, status
);
179 upc_global_exit (status
);
183 __cvtaddrg (upc_shared_ptr_t p
, const char *filename
, int linenum
)
187 result
= __cvtaddr (p
);
188 GUPCR_CLEAR_ERR_LOC();
193 __getaddrg (upc_shared_ptr_t p
, const char *filename
, int linenum
)
197 result
= __getaddr (p
);
198 GUPCR_CLEAR_ERR_LOC();
203 upc_addrfieldg (upc_shared_ptr_t p
, const char *filename
, int linenum
)
207 result
= upc_addrfield (p
);
208 GUPCR_CLEAR_ERR_LOC();
213 upc_affinitysizeg (size_t totalsize
, size_t nbytes
, size_t threadid
,
214 const char *filename
, int linenum
)
218 result
= upc_affinitysize (totalsize
, nbytes
, threadid
);
219 GUPCR_CLEAR_ERR_LOC();
224 upc_phaseofg (upc_shared_ptr_t p
, const char *filename
, int linenum
)
228 result
= upc_phaseof (p
);
229 GUPCR_CLEAR_ERR_LOC();
234 upc_resetphaseg (upc_shared_ptr_t p
, const char *filename
, int linenum
)
236 upc_shared_ptr_t result
;
238 result
= upc_resetphase (p
);
239 GUPCR_CLEAR_ERR_LOC();
244 upc_threadofg (upc_shared_ptr_t p
, const char *filename
, int linenum
)
248 result
= upc_threadof (p
);
249 GUPCR_CLEAR_ERR_LOC();