helper-proto.h.inc 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Helper file for declaring TCG helper functions.
  4. * This one expands prototypes for the helper functions.
  5. * Define HELPER_H for the header file to be expanded.
  6. */
  7. #include "exec/helper-head.h.inc"
  8. /*
  9. * Work around an issue with --enable-lto, in which GCC's ipa-split pass
  10. * decides to split out the noreturn code paths that raise an exception,
  11. * taking the __builtin_return_address() along into the new function,
  12. * where it no longer computes a value that returns to TCG generated code.
  13. * Despite the name, the noinline attribute affects splitter, so this
  14. * prevents the optimization in question. Given that helpers should not
  15. * otherwise be called directly, this should not have any other visible effect.
  16. *
  17. * See https://gitlab.com/qemu-project/qemu/-/issues/1454
  18. */
  19. #define DEF_HELPER_ATTR __attribute__((noinline))
  20. #define DEF_HELPER_FLAGS_0(name, flags, ret) \
  21. dh_ctype(ret) HELPER(name) (void) DEF_HELPER_ATTR;
  22. #define DEF_HELPER_FLAGS_1(name, flags, ret, t1) \
  23. dh_ctype(ret) HELPER(name) (dh_ctype(t1)) DEF_HELPER_ATTR;
  24. #define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2) \
  25. dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)) DEF_HELPER_ATTR;
  26. #define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3) \
  27. dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), \
  28. dh_ctype(t3)) DEF_HELPER_ATTR;
  29. #define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4) \
  30. dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
  31. dh_ctype(t4)) DEF_HELPER_ATTR;
  32. #define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5) \
  33. dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
  34. dh_ctype(t4), dh_ctype(t5)) DEF_HELPER_ATTR;
  35. #define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6) \
  36. dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
  37. dh_ctype(t4), dh_ctype(t5), \
  38. dh_ctype(t6)) DEF_HELPER_ATTR;
  39. #define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7) \
  40. dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
  41. dh_ctype(t4), dh_ctype(t5), dh_ctype(t6), \
  42. dh_ctype(t7)) DEF_HELPER_ATTR;
  43. #define IN_HELPER_PROTO
  44. #include HELPER_H
  45. #undef IN_HELPER_PROTO
  46. #undef DEF_HELPER_FLAGS_0
  47. #undef DEF_HELPER_FLAGS_1
  48. #undef DEF_HELPER_FLAGS_2
  49. #undef DEF_HELPER_FLAGS_3
  50. #undef DEF_HELPER_FLAGS_4
  51. #undef DEF_HELPER_FLAGS_5
  52. #undef DEF_HELPER_FLAGS_6
  53. #undef DEF_HELPER_FLAGS_7
  54. #undef DEF_HELPER_ATTR