re PR libfortran/59513 (Fortran runtime error: Sequential READ or WRITE not allowed...
[official-gcc.git] / gcc / libfuncs.h
blobdfec1d7e920a3ad5e883759dd4f39fa75b7ac17c
1 /* Definitions for code generation pass of GNU compiler.
2 Copyright (C) 2001-2015 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it 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 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_LIBFUNCS_H
21 #define GCC_LIBFUNCS_H
23 #include "hashtab.h"
25 /* Enumeration of indexes into libfunc_table. */
26 enum libfunc_index
28 LTI_abort,
29 LTI_memcpy,
30 LTI_memmove,
31 LTI_memcmp,
32 LTI_memset,
33 LTI_setbits,
35 LTI_setjmp,
36 LTI_longjmp,
37 LTI_unwind_sjlj_register,
38 LTI_unwind_sjlj_unregister,
40 LTI_profile_function_entry,
41 LTI_profile_function_exit,
43 LTI_synchronize,
45 LTI_gcov_flush,
47 LTI_MAX
50 /* Information about an optab-related libfunc. The op field is logically
51 an enum optab_d, and the mode fields are logically machine_mode.
52 However, in the absence of forward-declared enums, there's no practical
53 benefit of pulling in the defining headers.
55 We use the same hashtable for normal optabs and conversion optabs. In
56 the first case mode2 is forced to VOIDmode. */
58 struct GTY((for_user)) libfunc_entry {
59 int op, mode1, mode2;
60 rtx libfunc;
63 /* Descriptor for libfunc_entry. */
65 struct libfunc_hasher : ggc_hasher<libfunc_entry *>
67 static hashval_t hash (libfunc_entry *);
68 static bool equal (libfunc_entry *, libfunc_entry *);
71 /* Target-dependent globals. */
72 struct GTY(()) target_libfuncs {
73 /* SYMBOL_REF rtx's for the library functions that are called
74 implicitly and not via optabs. */
75 rtx x_libfunc_table[LTI_MAX];
77 /* Hash table used to convert declarations into nodes. */
78 hash_table<libfunc_hasher> *GTY(()) x_libfunc_hash;
81 extern GTY(()) struct target_libfuncs default_target_libfuncs;
82 #if SWITCHABLE_TARGET
83 extern struct target_libfuncs *this_target_libfuncs;
84 #else
85 #define this_target_libfuncs (&default_target_libfuncs)
86 #endif
88 #define libfunc_table \
89 (this_target_libfuncs->x_libfunc_table)
91 /* Accessor macros for libfunc_table. */
93 #define abort_libfunc (libfunc_table[LTI_abort])
94 #define memcpy_libfunc (libfunc_table[LTI_memcpy])
95 #define memmove_libfunc (libfunc_table[LTI_memmove])
96 #define memcmp_libfunc (libfunc_table[LTI_memcmp])
97 #define memset_libfunc (libfunc_table[LTI_memset])
98 #define setbits_libfunc (libfunc_table[LTI_setbits])
100 #define setjmp_libfunc (libfunc_table[LTI_setjmp])
101 #define longjmp_libfunc (libfunc_table[LTI_longjmp])
102 #define unwind_sjlj_register_libfunc (libfunc_table[LTI_unwind_sjlj_register])
103 #define unwind_sjlj_unregister_libfunc \
104 (libfunc_table[LTI_unwind_sjlj_unregister])
106 #define profile_function_entry_libfunc (libfunc_table[LTI_profile_function_entry])
107 #define profile_function_exit_libfunc (libfunc_table[LTI_profile_function_exit])
109 #define synchronize_libfunc (libfunc_table[LTI_synchronize])
111 #define gcov_flush_libfunc (libfunc_table[LTI_gcov_flush])
113 /* In explow.c */
114 extern void set_stack_check_libfunc (const char *);
116 #endif /* GCC_LIBFUNCS_H */