Reduce the size of optabs representation
[gcc.git] / gcc / libfuncs.h
1 /* Definitions for code generation pass of GNU compiler.
2 Copyright (C) 2001, 2004, 2007, 2008, 2010 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
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.
10
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.
15
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/>. */
19
20 #ifndef GCC_LIBFUNCS_H
21 #define GCC_LIBFUNCS_H
22
23 #include "hashtab.h"
24 #include "optabs.h"
25
26 /* Enumeration of indexes into libfunc_table. */
27 enum libfunc_index
28 {
29 LTI_abort,
30 LTI_memcpy,
31 LTI_memmove,
32 LTI_memcmp,
33 LTI_memset,
34 LTI_setbits,
35
36 LTI_setjmp,
37 LTI_longjmp,
38 LTI_unwind_sjlj_register,
39 LTI_unwind_sjlj_unregister,
40
41 LTI_profile_function_entry,
42 LTI_profile_function_exit,
43
44 LTI_synchronize,
45
46 LTI_gcov_flush,
47
48 LTI_MAX
49 };
50
51 /* Information about an optab-related libfunc. We use the same hashtable
52 for normal optabs and conversion optabs. In the first case mode2
53 is unused. */
54 struct GTY(()) libfunc_entry {
55 optab op;
56 enum machine_mode mode1, mode2;
57 rtx libfunc;
58 };
59
60 /* Target-dependent globals. */
61 struct GTY(()) target_libfuncs {
62 /* SYMBOL_REF rtx's for the library functions that are called
63 implicitly and not via optabs. */
64 rtx x_libfunc_table[LTI_MAX];
65
66 /* Hash table used to convert declarations into nodes. */
67 htab_t GTY((param_is (struct libfunc_entry))) x_libfunc_hash;
68 };
69
70 extern GTY(()) struct target_libfuncs default_target_libfuncs;
71 #if SWITCHABLE_TARGET
72 extern struct target_libfuncs *this_target_libfuncs;
73 #else
74 #define this_target_libfuncs (&default_target_libfuncs)
75 #endif
76
77 #define libfunc_table \
78 (this_target_libfuncs->x_libfunc_table)
79
80 /* Accessor macros for libfunc_table. */
81
82 #define abort_libfunc (libfunc_table[LTI_abort])
83 #define memcpy_libfunc (libfunc_table[LTI_memcpy])
84 #define memmove_libfunc (libfunc_table[LTI_memmove])
85 #define memcmp_libfunc (libfunc_table[LTI_memcmp])
86 #define memset_libfunc (libfunc_table[LTI_memset])
87 #define setbits_libfunc (libfunc_table[LTI_setbits])
88
89 #define setjmp_libfunc (libfunc_table[LTI_setjmp])
90 #define longjmp_libfunc (libfunc_table[LTI_longjmp])
91 #define unwind_sjlj_register_libfunc (libfunc_table[LTI_unwind_sjlj_register])
92 #define unwind_sjlj_unregister_libfunc \
93 (libfunc_table[LTI_unwind_sjlj_unregister])
94
95 #define profile_function_entry_libfunc (libfunc_table[LTI_profile_function_entry])
96 #define profile_function_exit_libfunc (libfunc_table[LTI_profile_function_exit])
97
98 #define synchronize_libfunc (libfunc_table[LTI_synchronize])
99
100 #define gcov_flush_libfunc (libfunc_table[LTI_gcov_flush])
101
102 /* In explow.c */
103 extern void set_stack_check_libfunc (const char *);
104
105 #endif /* GCC_LIBFUNCS_H */