libfuncs.h 3.4 KB

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