1234027Sstas/* Definitions for code generation pass of GNU compiler.
2234027Sstas   Copyright (C) 2001-2015 Free Software Foundation, Inc.
3234027Sstas
4234027SstasThis file is part of GCC.
5234027Sstas
6234027SstasGCC is free software; you can redistribute it and/or modify
7234027Sstasit under the terms of the GNU General Public License as published by
8234027Sstasthe Free Software Foundation; either version 3, or (at your option)
9234027Sstasany later version.
10234027Sstas
11234027SstasGCC is distributed in the hope that it will be useful,
12234027Sstasbut WITHOUT ANY WARRANTY; without even the implied warranty of
13234027SstasMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14233294SstasGNU General Public License for more details.
15233294Sstas
16233294SstasYou should have received a copy of the GNU General Public License
17233294Sstasalong with GCC; see the file COPYING3.  If not see
18233294Sstas<http://www.gnu.org/licenses/>.  */
19233294Sstas
20233294Sstas#ifndef GCC_LIBFUNCS_H
21233294Sstas#define GCC_LIBFUNCS_H
22233294Sstas
23233294Sstas#include "hashtab.h"
24233294Sstas
25233294Sstas/* Enumeration of indexes into libfunc_table.  */
26233294Sstasenum libfunc_index
27233294Sstas{
28233294Sstas  LTI_abort,
29233294Sstas  LTI_memcpy,
30233294Sstas  LTI_memmove,
31233294Sstas  LTI_memcmp,
32233294Sstas  LTI_memset,
33233294Sstas  LTI_setbits,
34233294Sstas
35233294Sstas  LTI_setjmp,
36233294Sstas  LTI_longjmp,
37233294Sstas  LTI_unwind_sjlj_register,
38233294Sstas  LTI_unwind_sjlj_unregister,
39233294Sstas
40233294Sstas  LTI_profile_function_entry,
41233294Sstas  LTI_profile_function_exit,
42233294Sstas
43233294Sstas  LTI_synchronize,
44233294Sstas
45233294Sstas  LTI_gcov_flush,
46233294Sstas
47233294Sstas  LTI_MAX
48233294Sstas};
49233294Sstas
50233294Sstas/* Information about an optab-related libfunc.  The op field is logically
51233294Sstas   an enum optab_d, and the mode fields are logically machine_mode.
52233294Sstas   However, in the absence of forward-declared enums, there's no practical
53233294Sstas   benefit of pulling in the defining headers.
54233294Sstas
55233294Sstas   We use the same hashtable for normal optabs and conversion optabs.  In
56233294Sstas   the first case mode2 is forced to VOIDmode.  */
57233294Sstas
58233294Sstasstruct GTY((for_user)) libfunc_entry {
59233294Sstas  int op, mode1, mode2;
60233294Sstas  rtx libfunc;
61233294Sstas};
62233294Sstas
63233294Sstas/* Descriptor for libfunc_entry.  */
64233294Sstas
65233294Sstasstruct libfunc_hasher : ggc_hasher<libfunc_entry *>
66233294Sstas{
67233294Sstas  static hashval_t hash (libfunc_entry *);
68233294Sstas  static bool equal (libfunc_entry *, libfunc_entry *);
69233294Sstas};
70233294Sstas
71233294Sstas/* Target-dependent globals.  */
72233294Sstasstruct GTY(()) target_libfuncs {
73233294Sstas  /* SYMBOL_REF rtx's for the library functions that are called
74233294Sstas     implicitly and not via optabs.  */
75233294Sstas  rtx x_libfunc_table[LTI_MAX];
76233294Sstas
77233294Sstas  /* Hash table used to convert declarations into nodes.  */
78233294Sstas  hash_table<libfunc_hasher> *GTY(()) x_libfunc_hash;
79233294Sstas};
80233294Sstas
81233294Sstasextern GTY(()) struct target_libfuncs default_target_libfuncs;
82233294Sstas#if SWITCHABLE_TARGET
83233294Sstasextern struct target_libfuncs *this_target_libfuncs;
84233294Sstas#else
85233294Sstas#define this_target_libfuncs (&default_target_libfuncs)
86233294Sstas#endif
87233294Sstas
88233294Sstas#define libfunc_table \
89233294Sstas  (this_target_libfuncs->x_libfunc_table)
90233294Sstas
91233294Sstas/* Accessor macros for libfunc_table.  */
92233294Sstas
93233294Sstas#define abort_libfunc	(libfunc_table[LTI_abort])
94233294Sstas#define memcpy_libfunc	(libfunc_table[LTI_memcpy])
95233294Sstas#define memmove_libfunc	(libfunc_table[LTI_memmove])
96233294Sstas#define memcmp_libfunc	(libfunc_table[LTI_memcmp])
97233294Sstas#define memset_libfunc	(libfunc_table[LTI_memset])
98233294Sstas#define setbits_libfunc	(libfunc_table[LTI_setbits])
99233294Sstas
100233294Sstas#define setjmp_libfunc	(libfunc_table[LTI_setjmp])
101233294Sstas#define longjmp_libfunc	(libfunc_table[LTI_longjmp])
102233294Sstas#define unwind_sjlj_register_libfunc (libfunc_table[LTI_unwind_sjlj_register])
103233294Sstas#define unwind_sjlj_unregister_libfunc \
104233294Sstas  (libfunc_table[LTI_unwind_sjlj_unregister])
105233294Sstas
106233294Sstas#define profile_function_entry_libfunc	(libfunc_table[LTI_profile_function_entry])
107233294Sstas#define profile_function_exit_libfunc	(libfunc_table[LTI_profile_function_exit])
108233294Sstas
109233294Sstas#define synchronize_libfunc	(libfunc_table[LTI_synchronize])
110233294Sstas
111233294Sstas#define gcov_flush_libfunc	(libfunc_table[LTI_gcov_flush])
112233294Sstas
113233294Sstas/* In explow.c */
114233294Sstasextern void set_stack_check_libfunc (const char *);
115233294Sstas
116233294Sstas#endif /* GCC_LIBFUNCS_H */
117233294Sstas