ARMEHABI.h 3.7 KB

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