2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / libgomp / fortran.c
blob53469f5473cd144936641bcf2e6d324458e5cfb4
1 /* Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
2 Contributed by Jakub Jelinek <jakub@redhat.com>.
4 This file is part of the GNU OpenMP Library (libgomp).
6 Libgomp is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
25 /* This file contains Fortran wrapper routines. */
27 #include "libgomp.h"
28 #include "libgomp_f.h"
29 #include <stdlib.h>
31 #ifdef HAVE_ATTRIBUTE_ALIAS
32 /* Use internal aliases if possible. */
33 # define ULP STR1(__USER_LABEL_PREFIX__)
34 # define STR1(x) STR2(x)
35 # define STR2(x) #x
36 # define ialias_redirect(fn) \
37 extern __typeof (fn) fn __asm__ (ULP "gomp_ialias_" #fn) attribute_hidden;
38 # ifndef LIBGOMP_GNU_SYMBOL_VERSIONING
39 ialias_redirect (omp_init_lock)
40 ialias_redirect (omp_init_nest_lock)
41 ialias_redirect (omp_destroy_lock)
42 ialias_redirect (omp_destroy_nest_lock)
43 ialias_redirect (omp_set_lock)
44 ialias_redirect (omp_set_nest_lock)
45 ialias_redirect (omp_unset_lock)
46 ialias_redirect (omp_unset_nest_lock)
47 ialias_redirect (omp_test_lock)
48 ialias_redirect (omp_test_nest_lock)
49 # endif
50 ialias_redirect (omp_set_dynamic)
51 ialias_redirect (omp_set_nested)
52 ialias_redirect (omp_set_num_threads)
53 ialias_redirect (omp_get_dynamic)
54 ialias_redirect (omp_get_nested)
55 ialias_redirect (omp_in_parallel)
56 ialias_redirect (omp_get_max_threads)
57 ialias_redirect (omp_get_num_procs)
58 ialias_redirect (omp_get_num_threads)
59 ialias_redirect (omp_get_thread_num)
60 ialias_redirect (omp_get_wtick)
61 ialias_redirect (omp_get_wtime)
62 ialias_redirect (omp_set_schedule)
63 ialias_redirect (omp_get_schedule)
64 ialias_redirect (omp_get_thread_limit)
65 ialias_redirect (omp_set_max_active_levels)
66 ialias_redirect (omp_get_max_active_levels)
67 ialias_redirect (omp_get_level)
68 ialias_redirect (omp_get_ancestor_thread_num)
69 ialias_redirect (omp_get_team_size)
70 ialias_redirect (omp_get_active_level)
71 #endif
73 #ifndef LIBGOMP_GNU_SYMBOL_VERSIONING
74 # define gomp_init_lock__30 omp_init_lock_
75 # define gomp_destroy_lock__30 omp_destroy_lock_
76 # define gomp_set_lock__30 omp_set_lock_
77 # define gomp_unset_lock__30 omp_unset_lock_
78 # define gomp_test_lock__30 omp_test_lock_
79 # define gomp_init_nest_lock__30 omp_init_nest_lock_
80 # define gomp_destroy_nest_lock__30 omp_destroy_nest_lock_
81 # define gomp_set_nest_lock__30 omp_set_nest_lock_
82 # define gomp_unset_nest_lock__30 omp_unset_nest_lock_
83 # define gomp_test_nest_lock__30 omp_test_nest_lock_
84 #endif
86 void
87 gomp_init_lock__30 (omp_lock_arg_t lock)
89 #ifndef OMP_LOCK_DIRECT
90 omp_lock_arg (lock) = malloc (sizeof (omp_lock_t));
91 #endif
92 gomp_init_lock_30 (omp_lock_arg (lock));
95 void
96 gomp_init_nest_lock__30 (omp_nest_lock_arg_t lock)
98 #ifndef OMP_NEST_LOCK_DIRECT
99 omp_nest_lock_arg (lock) = malloc (sizeof (omp_nest_lock_t));
100 #endif
101 gomp_init_nest_lock_30 (omp_nest_lock_arg (lock));
104 void
105 gomp_destroy_lock__30 (omp_lock_arg_t lock)
107 gomp_destroy_lock_30 (omp_lock_arg (lock));
108 #ifndef OMP_LOCK_DIRECT
109 free (omp_lock_arg (lock));
110 omp_lock_arg (lock) = NULL;
111 #endif
114 void
115 gomp_destroy_nest_lock__30 (omp_nest_lock_arg_t lock)
117 gomp_destroy_nest_lock_30 (omp_nest_lock_arg (lock));
118 #ifndef OMP_NEST_LOCK_DIRECT
119 free (omp_nest_lock_arg (lock));
120 omp_nest_lock_arg (lock) = NULL;
121 #endif
124 void
125 gomp_set_lock__30 (omp_lock_arg_t lock)
127 gomp_set_lock_30 (omp_lock_arg (lock));
130 void
131 gomp_set_nest_lock__30 (omp_nest_lock_arg_t lock)
133 gomp_set_nest_lock_30 (omp_nest_lock_arg (lock));
136 void
137 gomp_unset_lock__30 (omp_lock_arg_t lock)
139 gomp_unset_lock_30 (omp_lock_arg (lock));
142 void
143 gomp_unset_nest_lock__30 (omp_nest_lock_arg_t lock)
145 gomp_unset_nest_lock_30 (omp_nest_lock_arg (lock));
148 int32_t
149 gomp_test_lock__30 (omp_lock_arg_t lock)
151 return gomp_test_lock_30 (omp_lock_arg (lock));
154 int32_t
155 gomp_test_nest_lock__30 (omp_nest_lock_arg_t lock)
157 return gomp_test_nest_lock_30 (omp_nest_lock_arg (lock));
160 #ifdef LIBGOMP_GNU_SYMBOL_VERSIONING
161 void
162 gomp_init_lock__25 (omp_lock_25_arg_t lock)
164 #ifndef OMP_LOCK_25_DIRECT
165 omp_lock_25_arg (lock) = malloc (sizeof (omp_lock_25_t));
166 #endif
167 gomp_init_lock_25 (omp_lock_25_arg (lock));
170 void
171 gomp_init_nest_lock__25 (omp_nest_lock_25_arg_t lock)
173 #ifndef OMP_NEST_LOCK_25_DIRECT
174 omp_nest_lock_25_arg (lock) = malloc (sizeof (omp_nest_lock_25_t));
175 #endif
176 gomp_init_nest_lock_25 (omp_nest_lock_25_arg (lock));
179 void
180 gomp_destroy_lock__25 (omp_lock_25_arg_t lock)
182 gomp_destroy_lock_25 (omp_lock_25_arg (lock));
183 #ifndef OMP_LOCK_25_DIRECT
184 free (omp_lock_25_arg (lock));
185 omp_lock_25_arg (lock) = NULL;
186 #endif
189 void
190 gomp_destroy_nest_lock__25 (omp_nest_lock_25_arg_t lock)
192 gomp_destroy_nest_lock_25 (omp_nest_lock_25_arg (lock));
193 #ifndef OMP_NEST_LOCK_25_DIRECT
194 free (omp_nest_lock_25_arg (lock));
195 omp_nest_lock_25_arg (lock) = NULL;
196 #endif
199 void
200 gomp_set_lock__25 (omp_lock_25_arg_t lock)
202 gomp_set_lock_25 (omp_lock_25_arg (lock));
205 void
206 gomp_set_nest_lock__25 (omp_nest_lock_25_arg_t lock)
208 gomp_set_nest_lock_25 (omp_nest_lock_25_arg (lock));
211 void
212 gomp_unset_lock__25 (omp_lock_25_arg_t lock)
214 gomp_unset_lock_25 (omp_lock_25_arg (lock));
217 void
218 gomp_unset_nest_lock__25 (omp_nest_lock_25_arg_t lock)
220 gomp_unset_nest_lock_25 (omp_nest_lock_25_arg (lock));
223 int32_t
224 gomp_test_lock__25 (omp_lock_25_arg_t lock)
226 return gomp_test_lock_25 (omp_lock_25_arg (lock));
229 int32_t
230 gomp_test_nest_lock__25 (omp_nest_lock_25_arg_t lock)
232 return gomp_test_nest_lock_25 (omp_nest_lock_25_arg (lock));
235 omp_lock_symver (omp_init_lock_)
236 omp_lock_symver (omp_destroy_lock_)
237 omp_lock_symver (omp_set_lock_)
238 omp_lock_symver (omp_unset_lock_)
239 omp_lock_symver (omp_test_lock_)
240 omp_lock_symver (omp_init_nest_lock_)
241 omp_lock_symver (omp_destroy_nest_lock_)
242 omp_lock_symver (omp_set_nest_lock_)
243 omp_lock_symver (omp_unset_nest_lock_)
244 omp_lock_symver (omp_test_nest_lock_)
245 #endif
247 void
248 omp_set_dynamic_ (const int32_t *set)
250 omp_set_dynamic (*set);
253 void
254 omp_set_dynamic_8_ (const int64_t *set)
256 omp_set_dynamic (*set);
259 void
260 omp_set_nested_ (const int32_t *set)
262 omp_set_nested (*set);
265 void
266 omp_set_nested_8_ (const int64_t *set)
268 omp_set_nested (*set);
271 void
272 omp_set_num_threads_ (const int32_t *set)
274 omp_set_num_threads (*set);
277 void
278 omp_set_num_threads_8_ (const int64_t *set)
280 omp_set_num_threads (*set);
283 int32_t
284 omp_get_dynamic_ (void)
286 return omp_get_dynamic ();
289 int32_t
290 omp_get_nested_ (void)
292 return omp_get_nested ();
295 int32_t
296 omp_in_parallel_ (void)
298 return omp_in_parallel ();
301 int32_t
302 omp_get_max_threads_ (void)
304 return omp_get_max_threads ();
307 int32_t
308 omp_get_num_procs_ (void)
310 return omp_get_num_procs ();
313 int32_t
314 omp_get_num_threads_ (void)
316 return omp_get_num_threads ();
319 int32_t
320 omp_get_thread_num_ (void)
322 return omp_get_thread_num ();
325 double
326 omp_get_wtick_ (void)
328 return omp_get_wtick ();
331 double
332 omp_get_wtime_ (void)
334 return omp_get_wtime ();
337 void
338 omp_set_schedule_ (const int32_t *kind, const int32_t *modifier)
340 omp_set_schedule (*kind, *modifier);
343 void
344 omp_set_schedule_8_ (const int32_t *kind, const int64_t *modifier)
346 omp_set_schedule (*kind, *modifier);
349 void
350 omp_get_schedule_ (int32_t *kind, int32_t *modifier)
352 omp_sched_t k;
353 int m;
354 omp_get_schedule (&k, &m);
355 *kind = k;
356 *modifier = m;
359 void
360 omp_get_schedule_8_ (int32_t *kind, int64_t *modifier)
362 omp_sched_t k;
363 int m;
364 omp_get_schedule (&k, &m);
365 *kind = k;
366 *modifier = m;
369 int32_t
370 omp_get_thread_limit_ (void)
372 return omp_get_thread_limit ();
375 void
376 omp_set_max_active_levels_ (const int32_t *levels)
378 omp_set_max_active_levels (*levels);
381 void
382 omp_set_max_active_levels_8_ (const int64_t *levels)
384 omp_set_max_active_levels (*levels);
387 int32_t
388 omp_get_max_active_levels_ (void)
390 return omp_get_max_active_levels ();
393 int32_t
394 omp_get_level_ (void)
396 return omp_get_level ();
399 int32_t
400 omp_get_ancestor_thread_num_ (const int32_t *level)
402 return omp_get_ancestor_thread_num (*level);
405 int32_t
406 omp_get_ancestor_thread_num_8_ (const int64_t *level)
408 return omp_get_ancestor_thread_num (*level);
411 int32_t
412 omp_get_team_size_ (const int32_t *level)
414 return omp_get_team_size (*level);
417 int32_t
418 omp_get_team_size_8_ (const int64_t *level)
420 return omp_get_team_size (*level);
423 int32_t
424 omp_get_active_level_ (void)
426 return omp_get_active_level ();