• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
22 #ifndef LLVM_SUPPORT_ARMEHABI_H
23 #define LLVM_SUPPORT_ARMEHABI_H
24 
25 namespace llvm {
26 namespace ARM {
27 namespace EHABI {
28   /// ARM exception handling table entry kinds
29   enum EHTEntryKind {
30     EHT_GENERIC = 0x00,
31     EHT_COMPACT = 0x80
32   };
33 
34   enum {
35     /// Special entry for the function never unwind
36     EXIDX_CANTUNWIND = 0x1
37   };
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 
45     // Format: 01xxxxxx
46     // Purpose: vsp = vsp - ((x << 2) + 4)
47     UNWIND_OPCODE_DEC_VSP = 0x40,
48 
49     // Format: 10000000 00000000
50     // Purpose: refuse to unwind
51     UNWIND_OPCODE_REFUSE = 0x8000,
52 
53     // Format: 1000xxxx xxxxxxxx
54     // Purpose: pop r[15:12], r[11:4]
55     // Constraint: x != 0
56     UNWIND_OPCODE_POP_REG_MASK_R4 = 0x8000,
57 
58     // Format: 1001xxxx
59     // Purpose: vsp = r[x]
60     // Constraint: x != 13 && x != 15
61     UNWIND_OPCODE_SET_VSP = 0x90,
62 
63     // Format: 10100xxx
64     // Purpose: pop r[(4+x):4]
65     UNWIND_OPCODE_POP_REG_RANGE_R4 = 0xa0,
66 
67     // Format: 10101xxx
68     // Purpose: pop r14, r[(4+x):4]
69     UNWIND_OPCODE_POP_REG_RANGE_R4_R14 = 0xa8,
70 
71     // Format: 10110000
72     // Purpose: finish
73     UNWIND_OPCODE_FINISH = 0xb0,
74 
75     // Format: 10110001 0000xxxx
76     // Purpose: pop r[3:0]
77     // Constraint: x != 0
78     UNWIND_OPCODE_POP_REG_MASK = 0xb100,
79 
80     // Format: 10110010 x(uleb128)
81     // Purpose: vsp = vsp + ((x << 2) + 0x204)
82     UNWIND_OPCODE_INC_VSP_ULEB128 = 0xb2,
83 
84     // Format: 10110011 xxxxyyyy
85     // Purpose: pop d[(x+y):x]
86     UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDX = 0xb300,
87 
88     // Format: 10111xxx
89     // Purpose: pop d[(8+x):8]
90     UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDX_D8 = 0xb8,
91 
92     // Format: 11000xxx
93     // Purpose: pop wR[(10+x):10]
94     UNWIND_OPCODE_POP_WIRELESS_MMX_REG_RANGE_WR10 = 0xc0,
95 
96     // Format: 11000110 xxxxyyyy
97     // Purpose: pop wR[(x+y):x]
98     UNWIND_OPCODE_POP_WIRELESS_MMX_REG_RANGE = 0xc600,
99 
100     // Format: 11000111 0000xxxx
101     // Purpose: pop wCGR[3:0]
102     // Constraint: x != 0
103     UNWIND_OPCODE_POP_WIRELESS_MMX_REG_MASK = 0xc700,
104 
105     // Format: 11001000 xxxxyyyy
106     // Purpose: pop d[(16+x+y):(16+x)]
107     UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDD_D16 = 0xc800,
108 
109     // Format: 11001001 xxxxyyyy
110     // Purpose: pop d[(x+y):x]
111     UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDD = 0xc900,
112 
113     // Format: 11010xxx
114     // Purpose: pop d[(8+x):8]
115     UNWIND_OPCODE_POP_VFP_REG_RANGE_FSTMFDD_D8 = 0xd0
116   };
117 
118   /// ARM-defined Personality Routine Index
119   enum PersonalityRoutineIndex {
120     // To make the exception handling table become more compact, ARM defined
121     // several personality routines in EHABI.  There are 3 different
122     // personality routines in ARM EHABI currently.  It is possible to have 16
123     // pre-defined personality routines at most.
124     AEABI_UNWIND_CPP_PR0 = 0,
125     AEABI_UNWIND_CPP_PR1 = 1,
126     AEABI_UNWIND_CPP_PR2 = 2,
127 
128     NUM_PERSONALITY_INDEX
129   };
130 }
131 }
132 }
133 
134 #endif
135