libfuncs.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* Definitions for code generation pass of GNU compiler.
  2. Copyright (C) 2001-2019 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. /* Enumeration of indexes into libfunc_table. */
  18. enum libfunc_index
  19. {
  20. LTI_unwind_sjlj_register,
  21. LTI_unwind_sjlj_unregister,
  22. LTI_synchronize,
  23. LTI_MAX
  24. };
  25. /* Information about an optab-related libfunc. The op field is logically
  26. an enum optab_d, and the mode fields are logically machine_mode.
  27. However, in the absence of forward-declared enums, there's no practical
  28. benefit of pulling in the defining headers.
  29. We use the same hashtable for normal optabs and conversion optabs. In
  30. the first case mode2 is forced to VOIDmode. */
  31. struct GTY((for_user)) libfunc_entry {
  32. int op, mode1, mode2;
  33. rtx libfunc;
  34. };
  35. /* Descriptor for libfunc_entry. */
  36. struct libfunc_hasher : ggc_ptr_hash<libfunc_entry>
  37. {
  38. static hashval_t hash (libfunc_entry *);
  39. static bool equal (libfunc_entry *, libfunc_entry *);
  40. };
  41. /* Target-dependent globals. */
  42. struct GTY(()) target_libfuncs {
  43. /* SYMBOL_REF rtx's for the library functions that are called
  44. implicitly and not via optabs. */
  45. rtx x_libfunc_table[LTI_MAX];
  46. /* Hash table used to convert declarations into nodes. */
  47. hash_table<libfunc_hasher> *GTY(()) x_libfunc_hash;
  48. };
  49. extern GTY(()) struct target_libfuncs default_target_libfuncs;
  50. #if SWITCHABLE_TARGET
  51. extern struct target_libfuncs *this_target_libfuncs;
  52. #else
  53. #define this_target_libfuncs (&default_target_libfuncs)
  54. #endif
  55. #define libfunc_table \
  56. (this_target_libfuncs->x_libfunc_table)
  57. /* Accessor macros for libfunc_table. */
  58. #define unwind_sjlj_register_libfunc (libfunc_table[LTI_unwind_sjlj_register])
  59. #define unwind_sjlj_unregister_libfunc \
  60. (libfunc_table[LTI_unwind_sjlj_unregister])
  61. #define synchronize_libfunc (libfunc_table[LTI_synchronize])
  62. /* In explow.c */
  63. extern void set_stack_check_libfunc (const char *);
  64. #endif /* GCC_LIBFUNCS_H */