xref: /dragonfly/contrib/gcc-8.0/gcc/libfuncs.h (revision 38fd1498)
1*38fd1498Szrj /* Definitions for code generation pass of GNU compiler.
2*38fd1498Szrj    Copyright (C) 2001-2018 Free Software Foundation, Inc.
3*38fd1498Szrj 
4*38fd1498Szrj This file is part of GCC.
5*38fd1498Szrj 
6*38fd1498Szrj GCC is free software; you can redistribute it and/or modify
7*38fd1498Szrj it under the terms of the GNU General Public License as published by
8*38fd1498Szrj the Free Software Foundation; either version 3, or (at your option)
9*38fd1498Szrj any later version.
10*38fd1498Szrj 
11*38fd1498Szrj GCC is distributed in the hope that it will be useful,
12*38fd1498Szrj but WITHOUT ANY WARRANTY; without even the implied warranty of
13*38fd1498Szrj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*38fd1498Szrj GNU General Public License for more details.
15*38fd1498Szrj 
16*38fd1498Szrj You should have received a copy of the GNU General Public License
17*38fd1498Szrj along with GCC; see the file COPYING3.  If not see
18*38fd1498Szrj <http://www.gnu.org/licenses/>.  */
19*38fd1498Szrj 
20*38fd1498Szrj #ifndef GCC_LIBFUNCS_H
21*38fd1498Szrj #define GCC_LIBFUNCS_H
22*38fd1498Szrj 
23*38fd1498Szrj 
24*38fd1498Szrj /* Enumeration of indexes into libfunc_table.  */
25*38fd1498Szrj enum libfunc_index
26*38fd1498Szrj {
27*38fd1498Szrj   LTI_unwind_sjlj_register,
28*38fd1498Szrj   LTI_unwind_sjlj_unregister,
29*38fd1498Szrj   LTI_synchronize,
30*38fd1498Szrj   LTI_MAX
31*38fd1498Szrj };
32*38fd1498Szrj 
33*38fd1498Szrj /* Information about an optab-related libfunc.  The op field is logically
34*38fd1498Szrj    an enum optab_d, and the mode fields are logically machine_mode.
35*38fd1498Szrj    However, in the absence of forward-declared enums, there's no practical
36*38fd1498Szrj    benefit of pulling in the defining headers.
37*38fd1498Szrj 
38*38fd1498Szrj    We use the same hashtable for normal optabs and conversion optabs.  In
39*38fd1498Szrj    the first case mode2 is forced to VOIDmode.  */
40*38fd1498Szrj 
41*38fd1498Szrj struct GTY((for_user)) libfunc_entry {
42*38fd1498Szrj   int op, mode1, mode2;
43*38fd1498Szrj   rtx libfunc;
44*38fd1498Szrj };
45*38fd1498Szrj 
46*38fd1498Szrj /* Descriptor for libfunc_entry.  */
47*38fd1498Szrj 
48*38fd1498Szrj struct libfunc_hasher : ggc_ptr_hash<libfunc_entry>
49*38fd1498Szrj {
50*38fd1498Szrj   static hashval_t hash (libfunc_entry *);
51*38fd1498Szrj   static bool equal (libfunc_entry *, libfunc_entry *);
52*38fd1498Szrj };
53*38fd1498Szrj 
54*38fd1498Szrj /* Target-dependent globals.  */
55*38fd1498Szrj struct GTY(()) target_libfuncs {
56*38fd1498Szrj   /* SYMBOL_REF rtx's for the library functions that are called
57*38fd1498Szrj      implicitly and not via optabs.  */
58*38fd1498Szrj   rtx x_libfunc_table[LTI_MAX];
59*38fd1498Szrj 
60*38fd1498Szrj   /* Hash table used to convert declarations into nodes.  */
61*38fd1498Szrj   hash_table<libfunc_hasher> *GTY(()) x_libfunc_hash;
62*38fd1498Szrj };
63*38fd1498Szrj 
64*38fd1498Szrj extern GTY(()) struct target_libfuncs default_target_libfuncs;
65*38fd1498Szrj #if SWITCHABLE_TARGET
66*38fd1498Szrj extern struct target_libfuncs *this_target_libfuncs;
67*38fd1498Szrj #else
68*38fd1498Szrj #define this_target_libfuncs (&default_target_libfuncs)
69*38fd1498Szrj #endif
70*38fd1498Szrj 
71*38fd1498Szrj #define libfunc_table \
72*38fd1498Szrj   (this_target_libfuncs->x_libfunc_table)
73*38fd1498Szrj 
74*38fd1498Szrj /* Accessor macros for libfunc_table.  */
75*38fd1498Szrj 
76*38fd1498Szrj #define unwind_sjlj_register_libfunc (libfunc_table[LTI_unwind_sjlj_register])
77*38fd1498Szrj #define unwind_sjlj_unregister_libfunc \
78*38fd1498Szrj   (libfunc_table[LTI_unwind_sjlj_unregister])
79*38fd1498Szrj #define synchronize_libfunc	(libfunc_table[LTI_synchronize])
80*38fd1498Szrj 
81*38fd1498Szrj /* In explow.c */
82*38fd1498Szrj extern void set_stack_check_libfunc (const char *);
83*38fd1498Szrj 
84*38fd1498Szrj #endif /* GCC_LIBFUNCS_H */
85