ARMEHABI.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- ARMEHABI.h - ARM Exception Handling ABI ----------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file defines the constants for the ARM unwind opcodes and exception
  15. // handling table entry kinds.
  16. //
  17. // The enumerations and constants in this file reflect the ARM EHABI
  18. // Specification as published by ARM.
  19. //
  20. // Exception Handling ABI for the ARM Architecture r2.09 - November 30, 2012
  21. //
  22. // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf
  23. //
  24. //===----------------------------------------------------------------------===//
  25. #ifndef LLVM_SUPPORT_ARMEHABI_H
  26. #define LLVM_SUPPORT_ARMEHABI_H
  27. namespace llvm {
  28. namespace ARM {
  29. namespace EHABI {
  30. /// ARM exception handling table entry kinds
  31. enum EHTEntryKind {
  32. EHT_GENERIC = 0x00,
  33. EHT_COMPACT = 0x80
  34. };
  35. enum {
  36. /// Special entry for the function never unwind
  37. EXIDX_CANTUNWIND = 0x1
  38. };
  39. /// ARM-defined frame unwinding opcodes
  40. enum UnwindOpcodes {
  41. // Format: 00xxxxxx
  42. // Purpose: vsp = vsp + ((x << 2) + 4)
  43. UNWIND_OPCODE_INC_VSP = 0x00,
  44. // Format: 01xxxxxx
  45. // Purpose: vsp = vsp - ((x << 2) + 4)
  46. UNWIND_OPCODE_DEC_VSP = 0x40,
  47. // Format: 10000000 00000000
  48. // Purpose: refuse to unwind
  49. UNWIND_OPCODE_REFUSE = 0x8000,
  50. // Format: 1000xxxx xxxxxxxx
  51. // Purpose: pop r[15:12], r[11:4]
  52. // Constraint: x != 0
  53. UNWIND_OPCODE_POP_REG_MASK_R4 = 0x8000,
  54. // Format: 1001xxxx
  55. // Purpose: vsp = r[x]
  56. // Constraint: x != 13 && x != 15
  57. UNWIND_OPCODE_SET_VSP = 0x90,
  58. // Format: 10100xxx
  59. // Purpose: pop r[(4+x):4]
  60. UNWIND_OPCODE_POP_REG_RANGE_R4 = 0xa0,
  61. // Format: 10101xxx
  62. // Purpose: pop r14, r[(4+x):4]
  63. UNWIND_OPCODE_POP_REG_RANGE_R4_R14 = 0xa8,
  64. // Format: 10110000
  65. // Purpose: finish
  66. UNWIND_OPCODE_FINISH = 0xb0,
  67. // Format: 10110100
  68. // Purpose: Pop Return Address Authetication Code
  69. UNWIND_OPCODE_POP_RA_AUTH_CODE = 0xb4,
  70. // Format: 10110001 0000xxxx
  71. // Purpose: pop r[3:0]
  72. // Constraint: x != 0
  73. UNWIND_OPCODE_POP_REG_MASK = 0xb100,
  74. // Format: 10110010 x(uleb128)
  75. // Purpose: vsp = vsp + ((x << 2) + 0x204)
  76. UNWIND_OPCODE_INC_VSP_ULEB128 = 0xb2,
  77. // Format: 10110011 xxxxyyyy
  78. // Purpose: pop d[(x+y):x]
  79. UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDX = 0xb300,
  80. // Format: 10111xxx
  81. // Purpose: pop d[(8+x):8]
  82. UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDX_D8 = 0xb8,
  83. // Format: 11000xxx
  84. // Purpose: pop wR[(10+x):10]
  85. UNWIND_OPCODE_POP_WIRELESS_MMX_REG_RANGE_WR10 = 0xc0,
  86. // Format: 11000110 xxxxyyyy
  87. // Purpose: pop wR[(x+y):x]
  88. UNWIND_OPCODE_POP_WIRELESS_MMX_REG_RANGE = 0xc600,
  89. // Format: 11000111 0000xxxx
  90. // Purpose: pop wCGR[3:0]
  91. // Constraint: x != 0
  92. UNWIND_OPCODE_POP_WIRELESS_MMX_REG_MASK = 0xc700,
  93. // Format: 11001000 xxxxyyyy
  94. // Purpose: pop d[(16+x+y):(16+x)]
  95. UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDD_D16 = 0xc800,
  96. // Format: 11001001 xxxxyyyy
  97. // Purpose: pop d[(x+y):x]
  98. UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDD = 0xc900,
  99. // Format: 11010xxx
  100. // Purpose: pop d[(8+x):8]
  101. UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDD_D8 = 0xd0
  102. };
  103. /// ARM-defined Personality Routine Index
  104. enum PersonalityRoutineIndex {
  105. // To make the exception handling table become more compact, ARM defined
  106. // several personality routines in EHABI. There are 3 different
  107. // personality routines in ARM EHABI currently. It is possible to have 16
  108. // pre-defined personality routines at most.
  109. AEABI_UNWIND_CPP_PR0 = 0,
  110. AEABI_UNWIND_CPP_PR1 = 1,
  111. AEABI_UNWIND_CPP_PR2 = 2,
  112. NUM_PERSONALITY_INDEX
  113. };
  114. }
  115. }
  116. }
  117. #endif
  118. #ifdef __GNUC__
  119. #pragma GCC diagnostic pop
  120. #endif