2008-08-26 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / libgomp / fortran.c
blob1e20aea28eef241828edf3a65081f501afaabef0
1 /* Copyright (C) 2005, 2007, 2008 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 Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) 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 Lesser General Public License for
14 more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with libgomp; see the file COPYING.LIB. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 MA 02110-1301, USA. */
21 /* As a special exception, if you link this library with other files, some
22 of which are compiled with GCC, to produce an executable, this library
23 does not by itself cause the resulting executable to be covered by the
24 GNU General Public License. This exception does not however invalidate
25 any other reasons why the executable file might be covered by the GNU
26 General Public License. */
28 /* This file contains Fortran wrapper routines. */
30 #include "libgomp.h"
31 #include "libgomp_f.h"
32 #include <stdlib.h>
34 #ifdef HAVE_ATTRIBUTE_ALIAS
35 /* Use internal aliases if possible. */
36 # define ULP STR1(__USER_LABEL_PREFIX__)
37 # define STR1(x) STR2(x)
38 # define STR2(x) #x
39 # define ialias_redirect(fn) \
40 extern __typeof (fn) fn __asm__ (ULP "gomp_ialias_" #fn) attribute_hidden;
41 # ifndef LIBGOMP_GNU_SYMBOL_VERSIONING
42 ialias_redirect (omp_init_lock)
43 ialias_redirect (omp_init_nest_lock)
44 ialias_redirect (omp_destroy_lock)
45 ialias_redirect (omp_destroy_nest_lock)
46 ialias_redirect (omp_set_lock)
47 ialias_redirect (omp_set_nest_lock)
48 ialias_redirect (omp_unset_lock)
49 ialias_redirect (omp_unset_nest_lock)
50 ialias_redirect (omp_test_lock)
51 ialias_redirect (omp_test_nest_lock)
52 # endif
53 ialias_redirect (omp_set_dynamic)
54 ialias_redirect (omp_set_nested)
55 ialias_redirect (omp_set_num_threads)
56 ialias_redirect (omp_get_dynamic)
57 ialias_redirect (omp_get_nested)
58 ialias_redirect (omp_in_parallel)
59 ialias_redirect (omp_get_max_threads)
60 ialias_redirect (omp_get_num_procs)
61 ialias_redirect (omp_get_num_threads)
62 ialias_redirect (omp_get_thread_num)
63 ialias_redirect (omp_get_wtick)
64 ialias_redirect (omp_get_wtime)
65 ialias_redirect (omp_set_schedule)
66 ialias_redirect (omp_get_schedule)
67 ialias_redirect (omp_get_thread_limit)
68 ialias_redirect (omp_set_max_active_levels)
69 ialias_redirect (omp_get_max_active_levels)
70 ialias_redirect (omp_get_level)
71 ialias_redirect (omp_get_ancestor_thread_num)
72 ialias_redirect (omp_get_team_size)
73 ialias_redirect (omp_get_active_level)
74 #endif
76 #ifndef LIBGOMP_GNU_SYMBOL_VERSIONING
77 # define gomp_init_lock__30 omp_init_lock_
78 # define gomp_destroy_lock__30 omp_destroy_lock_
79 # define gomp_set_lock__30 omp_set_lock_
80 # define gomp_unset_lock__30 omp_unset_lock_
81 # define gomp_test_lock__30 omp_test_lock_
82 # define gomp_init_nest_lock__30 omp_init_nest_lock_
83 # define gomp_destroy_nest_lock__30 omp_destroy_nest_lock_
84 # define gomp_set_nest_lock__30 omp_set_nest_lock_
85 # define gomp_unset_nest_lock__30 omp_unset_nest_lock_
86 # define gomp_test_nest_lock__30 omp_test_nest_lock_
87 #endif
89 void
90 gomp_init_lock__30 (omp_lock_arg_t lock)
92 #ifndef OMP_LOCK_DIRECT
93 omp_lock_arg (lock) = malloc (sizeof (omp_lock_t));
94 #endif
95 gomp_init_lock_30 (omp_lock_arg (lock));
98 void
99 gomp_init_nest_lock__30 (omp_nest_lock_arg_t lock)
101 #ifndef OMP_NEST_LOCK_DIRECT
102 omp_nest_lock_arg (lock) = malloc (sizeof (omp_nest_lock_t));
103 #endif
104 gomp_init_nest_lock_30 (omp_nest_lock_arg (lock));
107 void
108 gomp_destroy_lock__30 (omp_lock_arg_t lock)
110 gomp_destroy_lock_30 (omp_lock_arg (lock));
111 #ifndef OMP_LOCK_DIRECT
112 free (omp_lock_arg (lock));
113 omp_lock_arg (lock) = NULL;
114 #endif
117 void
118 gomp_destroy_nest_lock__30 (omp_nest_lock_arg_t lock)
120 gomp_destroy_nest_lock_30 (omp_nest_lock_arg (lock));
121 #ifndef OMP_NEST_LOCK_DIRECT
122 free (omp_nest_lock_arg (lock));
123 omp_nest_lock_arg (lock) = NULL;
124 #endif
127 void
128 gomp_set_lock__30 (omp_lock_arg_t lock)
130 gomp_set_lock_30 (omp_lock_arg (lock));
133 void
134 gomp_set_nest_lock__30 (omp_nest_lock_arg_t lock)
136 gomp_set_nest_lock_30 (omp_nest_lock_arg (lock));
139 void
140 gomp_unset_lock__30 (omp_lock_arg_t lock)
142 gomp_unset_lock_30 (omp_lock_arg (lock));
145 void
146 gomp_unset_nest_lock__30 (omp_nest_lock_arg_t lock)
148 gomp_unset_nest_lock_30 (omp_nest_lock_arg (lock));
151 int32_t
152 gomp_test_lock__30 (omp_lock_arg_t lock)
154 return gomp_test_lock_30 (omp_lock_arg (lock));
157 int32_t
158 gomp_test_nest_lock__30 (omp_nest_lock_arg_t lock)
160 return gomp_test_nest_lock_30 (omp_nest_lock_arg (lock));
163 #ifdef LIBGOMP_GNU_SYMBOL_VERSIONING
164 void
165 gomp_init_lock__25 (omp_lock_25_arg_t lock)
167 #ifndef OMP_LOCK_25_DIRECT
168 omp_lock_25_arg (lock) = malloc (sizeof (omp_lock_25_t));
169 #endif
170 gomp_init_lock_25 (omp_lock_25_arg (lock));
173 void
174 gomp_init_nest_lock__25 (omp_nest_lock_25_arg_t lock)
176 #ifndef OMP_NEST_LOCK_25_DIRECT
177 omp_nest_lock_25_arg (lock) = malloc (sizeof (omp_nest_lock_25_t));
178 #endif
179 gomp_init_nest_lock_25 (omp_nest_lock_25_arg (lock));
182 void
183 gomp_destroy_lock__25 (omp_lock_25_arg_t lock)
185 gomp_destroy_lock_25 (omp_lock_25_arg (lock));
186 #ifndef OMP_LOCK_25_DIRECT
187 free (omp_lock_25_arg (lock));
188 omp_lock_25_arg (lock) = NULL;
189 #endif
192 void
193 gomp_destroy_nest_lock__25 (omp_nest_lock_25_arg_t lock)
195 gomp_destroy_nest_lock_25 (omp_nest_lock_25_arg (lock));
196 #ifndef OMP_NEST_LOCK_25_DIRECT
197 free (omp_nest_lock_25_arg (lock));
198 omp_nest_lock_25_arg (lock) = NULL;
199 #endif
202 void
203 gomp_set_lock__25 (omp_lock_25_arg_t lock)
205 gomp_set_lock_25 (omp_lock_25_arg (lock));
208 void
209 gomp_set_nest_lock__25 (omp_nest_lock_25_arg_t lock)
211 gomp_set_nest_lock_25 (omp_nest_lock_25_arg (lock));
214 void
215 gomp_unset_lock__25 (omp_lock_25_arg_t lock)
217 gomp_unset_lock_25 (omp_lock_25_arg (lock));
220 void
221 gomp_unset_nest_lock__25 (omp_nest_lock_25_arg_t lock)
223 gomp_unset_nest_lock_25 (omp_nest_lock_25_arg (lock));
226 int32_t
227 gomp_test_lock__25 (omp_lock_25_arg_t lock)
229 return gomp_test_lock_25 (omp_lock_25_arg (lock));
232 int32_t
233 gomp_test_nest_lock__25 (omp_nest_lock_25_arg_t lock)
235 return gomp_test_nest_lock_25 (omp_nest_lock_25_arg (lock));
238 omp_lock_symver (omp_init_lock_)
239 omp_lock_symver (omp_destroy_lock_)
240 omp_lock_symver (omp_set_lock_)
241 omp_lock_symver (omp_unset_lock_)
242 omp_lock_symver (omp_test_lock_)
243 omp_lock_symver (omp_init_nest_lock_)
244 omp_lock_symver (omp_destroy_nest_lock_)
245 omp_lock_symver (omp_set_nest_lock_)
246 omp_lock_symver (omp_unset_nest_lock_)
247 omp_lock_symver (omp_test_nest_lock_)
248 #endif
250 void
251 omp_set_dynamic_ (const int32_t *set)
253 omp_set_dynamic (*set);
256 void
257 omp_set_dynamic_8_ (const int64_t *set)
259 omp_set_dynamic (*set);
262 void
263 omp_set_nested_ (const int32_t *set)
265 omp_set_nested (*set);
268 void
269 omp_set_nested_8_ (const int64_t *set)
271 omp_set_nested (*set);
274 void
275 omp_set_num_threads_ (const int32_t *set)
277 omp_set_num_threads (*set);
280 void
281 omp_set_num_threads_8_ (const int64_t *set)
283 omp_set_num_threads (*set);
286 int32_t
287 omp_get_dynamic_ (void)
289 return omp_get_dynamic ();
292 int32_t
293 omp_get_nested_ (void)
295 return omp_get_nested ();
298 int32_t
299 omp_in_parallel_ (void)
301 return omp_in_parallel ();
304 int32_t
305 omp_get_max_threads_ (void)
307 return omp_get_max_threads ();
310 int32_t
311 omp_get_num_procs_ (void)
313 return omp_get_num_procs ();
316 int32_t
317 omp_get_num_threads_ (void)
319 return omp_get_num_threads ();
322 int32_t
323 omp_get_thread_num_ (void)
325 return omp_get_thread_num ();
328 double
329 omp_get_wtick_ (void)
331 return omp_get_wtick ();
334 double
335 omp_get_wtime_ (void)
337 return omp_get_wtime ();
340 void
341 omp_set_schedule_ (const int32_t *kind, const int32_t *modifier)
343 omp_set_schedule (*kind, *modifier);
346 void
347 omp_set_schedule_8_ (const int32_t *kind, const int64_t *modifier)
349 omp_set_schedule (*kind, *modifier);
352 void
353 omp_get_schedule_ (int32_t *kind, int32_t *modifier)
355 omp_sched_t k;
356 int m;
357 omp_get_schedule (&k, &m);
358 *kind = k;
359 *modifier = m;
362 void
363 omp_get_schedule_8_ (int32_t *kind, int64_t *modifier)
365 omp_sched_t k;
366 int m;
367 omp_get_schedule (&k, &m);
368 *kind = k;
369 *modifier = m;
372 int32_t
373 omp_get_thread_limit_ (void)
375 return omp_get_thread_limit ();
378 void
379 omp_set_max_active_levels_ (const int32_t *levels)
381 omp_set_max_active_levels (*levels);
384 void
385 omp_set_max_active_levels_8_ (const int64_t *levels)
387 omp_set_max_active_levels (*levels);
390 int32_t
391 omp_get_max_active_levels_ (void)
393 return omp_get_max_active_levels ();
396 int32_t
397 omp_get_level_ (void)
399 return omp_get_level ();
402 int32_t
403 omp_get_ancestor_thread_num_ (const int32_t *level)
405 return omp_get_ancestor_thread_num (*level);
408 int32_t
409 omp_get_ancestor_thread_num_8_ (const int64_t *level)
411 return omp_get_ancestor_thread_num (*level);
414 int32_t
415 omp_get_team_size_ (const int32_t *level)
417 return omp_get_team_size (*level);
420 int32_t
421 omp_get_team_size_8_ (const int64_t *level)
423 return omp_get_team_size (*level);
426 int32_t
427 omp_get_active_level_ (void)
429 return omp_get_active_level ();