[AArch64] Properly handle SHIFT ops and EXTEND in aarch64_rtx_mult_cost
[official-gcc.git] / libgcc / config / gthr-rtems.h
blob23038c6c9ad5d8fda77688384eb44f42fcac7199
1 /* RTEMS threads compatibility routines for libgcc2 and libobjc.
2 by: Rosimildo da Silva( rdasilva@connecttel.com ) */
3 /* Compile this one with gcc. */
4 /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 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/>. */
27 #ifndef GCC_GTHR_RTEMS_H
28 #define GCC_GTHR_RTEMS_H
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #define __GTHREADS 1
36 #define __GTHREAD_ONCE_INIT 0
37 #define __GTHREAD_MUTEX_INIT_FUNCTION rtems_gxx_mutex_init
38 #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION rtems_gxx_recursive_mutex_init
40 /* Avoid dependency on rtems specific headers. */
41 typedef void *__gthread_key_t;
42 typedef int __gthread_once_t;
43 typedef void *__gthread_mutex_t;
44 typedef void *__gthread_recursive_mutex_t;
47 * External functions provided by RTEMS. They are very similar to their POSIX
48 * counterparts. A "Wrapper API" is being use to avoid dependency on any RTEMS
49 * header files.
52 /* generic per task variables */
53 extern int rtems_gxx_once (__gthread_once_t *__once, void (*__func) (void));
54 extern int rtems_gxx_key_create (__gthread_key_t *__key, void (*__dtor) (void *));
55 extern int rtems_gxx_key_delete (__gthread_key_t __key);
56 extern void *rtems_gxx_getspecific (__gthread_key_t __key);
57 extern int rtems_gxx_setspecific (__gthread_key_t __key, const void *__ptr);
59 /* mutex support */
60 extern void rtems_gxx_mutex_init (__gthread_mutex_t *__mutex);
61 extern int rtems_gxx_mutex_destroy (__gthread_mutex_t *__mutex);
62 extern int rtems_gxx_mutex_lock (__gthread_mutex_t *__mutex);
63 extern int rtems_gxx_mutex_trylock (__gthread_mutex_t *__mutex);
64 extern int rtems_gxx_mutex_unlock (__gthread_mutex_t *__mutex);
66 /* recursive mutex support */
67 extern void rtems_gxx_recursive_mutex_init (__gthread_recursive_mutex_t *__mutex);
68 extern int rtems_gxx_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex);
69 extern int rtems_gxx_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex);
70 extern int rtems_gxx_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex);
72 /* RTEMS threading is always active */
73 static inline int
74 __gthread_active_p (void)
76 return 1;
79 /* Wrapper calls */
80 static inline int
81 __gthread_once (__gthread_once_t *__once, void (*__func) (void))
83 return rtems_gxx_once( __once, __func );
86 static inline int
87 __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
89 return rtems_gxx_key_create( __key, __dtor );
92 static inline int
93 __gthread_key_delete (__gthread_key_t __key)
95 return rtems_gxx_key_delete (__key);
98 static inline void *
99 __gthread_getspecific (__gthread_key_t __key)
101 return rtems_gxx_getspecific (__key);
104 static inline int
105 __gthread_setspecific (__gthread_key_t __key, const void *__ptr)
107 return rtems_gxx_setspecific (__key, __ptr);
110 static inline int
111 __gthread_mutex_destroy (__gthread_mutex_t *__mutex)
113 return rtems_gxx_mutex_destroy (__mutex);
116 static inline int
117 __gthread_mutex_lock (__gthread_mutex_t *__mutex)
119 return rtems_gxx_mutex_lock (__mutex);
122 static inline int
123 __gthread_mutex_trylock (__gthread_mutex_t *__mutex)
125 return rtems_gxx_mutex_trylock (__mutex);
128 static inline int
129 __gthread_mutex_unlock (__gthread_mutex_t *__mutex)
131 return rtems_gxx_mutex_unlock( __mutex );
134 static inline int
135 __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
137 return rtems_gxx_recursive_mutex_lock (__mutex);
140 static inline int
141 __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
143 return rtems_gxx_recursive_mutex_trylock (__mutex);
146 static inline int
147 __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
149 return rtems_gxx_recursive_mutex_unlock( __mutex );
152 static inline int
153 __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
155 /* This requires that recursive and non-recursive mutexes have the same
156 representation. */
157 return rtems_gxx_mutex_destroy (__mutex );
160 #ifdef __cplusplus
162 #endif
164 #endif /* ! GCC_GTHR_RTEMS_H */