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