| 1 | //===-- ARMBaseInfo.h - Top level definitions for ARM -------- --*- C++ -*-===//cxx . . $ `<file>/arch/ARM/ARMBaseInfo.h`/ |
| 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 contains small standalone helper functions and enum definitions for |
| 11 | // the ARM target useful for the compiler back-end and the MC libraries. |
| 12 | // As such, it deliberately does not include references to LLVM core |
| 13 | // code gen types, passes, etc.. |
| 14 | // |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
| 17 | /* Capstone Disassembly Engine */ |
| 18 | /* By Nguyen Anh Quynh <[email protected]>, 2013-2019 */ |
| 19 | |
| 20 | #ifndef CS_ARMBASEINFO_H |
| 21 | #define CS_ARMBASEINFO_Hcxx . . $ `arch/ARM/ARMBaseInfo.h:21:9`! |
| 22 | |
| 23 | #include "capstone/arm.h"cxx . . $ `<file>/include/capstone/arm.h`/ |
| 24 | |
| 25 | // Defines symbolic names for ARM registers. This defines a mapping from |
| 26 | // register name to register number. |
| 27 | // |
| 28 | #define GET_REGINFO_ENUMcxx . . $ `arch/ARM/ARMBaseInfo.h:28:9`! |
| 29 | #include "ARMGenRegisterInfo.inc"cxx . . $ `<file>/arch/ARM/ARMGenRegisterInfo.inc`/ |
| 30 | |
| 31 | // Enums corresponding to ARM condition codes |
| 32 | // The CondCodes constants map directly to the 4-bit encoding of the |
| 33 | // condition field for predicated instructions. |
| 34 | typedef enum ARMCC_CondCodescxx . . $ ARMCC_CondCodes# { // Meaning (integer) Meaning (floating-point) |
| 35 | ARMCC_EQcxx . . $ ARMCC_EQ., // Equal Equal |
| 36 | ARMCC_NEcxx . . $ ARMCC_NE., // Not equal Not equal, or unordered |
| 37 | ARMCC_HScxx . . $ ARMCC_HS., // Carry set >, ==, or unordered |
| 38 | ARMCC_LOcxx . . $ ARMCC_LO., // Carry clear Less than |
| 39 | ARMCC_MIcxx . . $ ARMCC_MI., // Minus, negative Less than |
| 40 | ARMCC_PLcxx . . $ ARMCC_PL., // Plus, positive or zero >, ==, or unordered |
| 41 | ARMCC_VScxx . . $ ARMCC_VS., // Overflow Unordered |
| 42 | ARMCC_VCcxx . . $ ARMCC_VC., // No overflow Not unordered |
| 43 | ARMCC_HIcxx . . $ ARMCC_HI., // Unsigned higher Greater than, or unordered |
| 44 | ARMCC_LScxx . . $ ARMCC_LS., // Unsigned lower or same Less than or equal |
| 45 | ARMCC_GEcxx . . $ ARMCC_GE., // Greater than or equal Greater than or equal |
| 46 | ARMCC_LTcxx . . $ ARMCC_LT., // Less than Less than, or unordered |
| 47 | ARMCC_GTcxx . . $ ARMCC_GT., // Greater than Greater than |
| 48 | ARMCC_LEcxx . . $ ARMCC_LE., // Less than or equal <, ==, or unordered |
| 49 | ARMCC_ALcxx . . $ ARMCC_AL. // Always (unconditional) Always (unconditional) |
| 50 | } ARMCC_CondCodescxx . . $ ARMCC_CondCodes#; |
| 51 | |
| 52 | inline static ARMCC_CondCodescxx . . $ ARMCC_CondCodes# ARMCC_getOppositeConditioncxx . . $ ARMCC_getOppositeCondition(f71705e0051f28f5).(ARMCC_CondCodescxx . . $ ARMCC_CondCodes# CC) |
| 53 | { |
| 54 | switch (CC) { |
| 55 | case ARMCC_EQcxx . . $ ARMCC_EQ.: return ARMCC_NEcxx . . $ ARMCC_NE.; |
| 56 | case ARMCC_NEcxx . . $ ARMCC_NE.: return ARMCC_EQcxx . . $ ARMCC_EQ.; |
| 57 | case ARMCC_HScxx . . $ ARMCC_HS.: return ARMCC_LOcxx . . $ ARMCC_LO.; |
| 58 | case ARMCC_LOcxx . . $ ARMCC_LO.: return ARMCC_HScxx . . $ ARMCC_HS.; |
| 59 | case ARMCC_MIcxx . . $ ARMCC_MI.: return ARMCC_PLcxx . . $ ARMCC_PL.; |
| 60 | case ARMCC_PLcxx . . $ ARMCC_PL.: return ARMCC_MIcxx . . $ ARMCC_MI.; |
| 61 | case ARMCC_VScxx . . $ ARMCC_VS.: return ARMCC_VCcxx . . $ ARMCC_VC.; |
| 62 | case ARMCC_VCcxx . . $ ARMCC_VC.: return ARMCC_VScxx . . $ ARMCC_VS.; |
| 63 | case ARMCC_HIcxx . . $ ARMCC_HI.: return ARMCC_LScxx . . $ ARMCC_LS.; |
| 64 | case ARMCC_LScxx . . $ ARMCC_LS.: return ARMCC_HIcxx . . $ ARMCC_HI.; |
| 65 | case ARMCC_GEcxx . . $ ARMCC_GE.: return ARMCC_LTcxx . . $ ARMCC_LT.; |
| 66 | case ARMCC_LTcxx . . $ ARMCC_LT.: return ARMCC_GEcxx . . $ ARMCC_GE.; |
| 67 | case ARMCC_GTcxx . . $ ARMCC_GT.: return ARMCC_LEcxx . . $ ARMCC_LE.; |
| 68 | case ARMCC_LEcxx . . $ ARMCC_LE.: return ARMCC_GTcxx . . $ ARMCC_GT.; |
| 69 | default: return ARMCC_ALcxx . . $ ARMCC_AL.; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | inline static const char *ARMCC_ARMCondCodeToStringcxx . . $ ARMCC_ARMCondCodeToString(8e124a371eac931a).(ARMCC_CondCodescxx . . $ ARMCC_CondCodes# CC) |
| 74 | { |
| 75 | switch (CC) { |
| 76 | case ARMCC_EQcxx . . $ ARMCC_EQ.: return "eq"; |
| 77 | case ARMCC_NEcxx . . $ ARMCC_NE.: return "ne"; |
| 78 | case ARMCC_HScxx . . $ ARMCC_HS.: return "hs"; |
| 79 | case ARMCC_LOcxx . . $ ARMCC_LO.: return "lo"; |
| 80 | case ARMCC_MIcxx . . $ ARMCC_MI.: return "mi"; |
| 81 | case ARMCC_PLcxx . . $ ARMCC_PL.: return "pl"; |
| 82 | case ARMCC_VScxx . . $ ARMCC_VS.: return "vs"; |
| 83 | case ARMCC_VCcxx . . $ ARMCC_VC.: return "vc"; |
| 84 | case ARMCC_HIcxx . . $ ARMCC_HI.: return "hi"; |
| 85 | case ARMCC_LScxx . . $ ARMCC_LS.: return "ls"; |
| 86 | case ARMCC_GEcxx . . $ ARMCC_GE.: return "ge"; |
| 87 | case ARMCC_LTcxx . . $ ARMCC_LT.: return "lt"; |
| 88 | case ARMCC_GTcxx . . $ ARMCC_GT.: return "gt"; |
| 89 | case ARMCC_LEcxx . . $ ARMCC_LE.: return "le"; |
| 90 | case ARMCC_ALcxx . . $ ARMCC_AL.: return "al"; |
| 91 | default: return ""; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | inline static const char *ARM_PROC_IFlagsToStringcxx . . $ ARM_PROC_IFlagsToString(81a3ae90da26a711).(unsigned val) |
| 96 | { |
| 97 | switch (val) { |
| 98 | case ARM_CPSFLAG_Fcxx . . $ ARM_CPSFLAG_F.: return "f"; |
| 99 | case ARM_CPSFLAG_Icxx . . $ ARM_CPSFLAG_I.: return "i"; |
| 100 | case ARM_CPSFLAG_Acxx . . $ ARM_CPSFLAG_A.: return "a"; |
| 101 | default: return ""; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | inline static const char *ARM_PROC_IModToStringcxx . . $ ARM_PROC_IModToString(81a3ae90da26a711).(unsigned val) |
| 106 | { |
| 107 | switch (val) { |
| 108 | case ARM_CPSMODE_IEcxx . . $ ARM_CPSMODE_IE.: return "ie"; |
| 109 | case ARM_CPSMODE_IDcxx . . $ ARM_CPSMODE_ID.: return "id"; |
| 110 | default: return ""; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | inline static const char *ARM_MB_MemBOptToStringcxx . . $ ARM_MB_MemBOptToString(173b488993fb3ace).(unsigned val, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! HasV8) |
| 115 | { |
| 116 | // TODO: add details |
| 117 | switch (val + 1) { |
| 118 | default: return "BUGBUG"; |
| 119 | case ARM_MB_SYcxx . . $ ARM_MB_SY.: return "sy"; |
| 120 | case ARM_MB_STcxx . . $ ARM_MB_ST.: return "st"; |
| 121 | case ARM_MB_LDcxx . . $ ARM_MB_LD.: return HasV8 ? "ld" : "#0xd"; |
| 122 | case ARM_MB_RESERVED_12cxx . . $ ARM_MB_RESERVED_12.: return "#0xc"; |
| 123 | case ARM_MB_ISHcxx . . $ ARM_MB_ISH.: return "ish"; |
| 124 | case ARM_MB_ISHSTcxx . . $ ARM_MB_ISHST.: return "ishst"; |
| 125 | case ARM_MB_ISHLDcxx . . $ ARM_MB_ISHLD.: return HasV8 ? "ishld" : "#9"; |
| 126 | case ARM_MB_RESERVED_8cxx . . $ ARM_MB_RESERVED_8.: return "#8"; |
| 127 | case ARM_MB_NSHcxx . . $ ARM_MB_NSH.: return "nsh"; |
| 128 | case ARM_MB_NSHSTcxx . . $ ARM_MB_NSHST.: return "nshst"; |
| 129 | case ARM_MB_NSHLDcxx . . $ ARM_MB_NSHLD.: return HasV8 ? "nshld" : "#5"; |
| 130 | case ARM_MB_RESERVED_4cxx . . $ ARM_MB_RESERVED_4.: return "#4"; |
| 131 | case ARM_MB_OSHcxx . . $ ARM_MB_OSH.: return "osh"; |
| 132 | case ARM_MB_OSHSTcxx . . $ ARM_MB_OSHST.: return "oshst"; |
| 133 | case ARM_MB_OSHLDcxx . . $ ARM_MB_OSHLD.: return HasV8 ? "oshld" : "#1"; |
| 134 | case ARM_MB_RESERVED_0cxx . . $ ARM_MB_RESERVED_0.: return "#0"; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | enum ARM_ISB_InstSyncBOptcxx . . $ ARM_ISB_InstSyncBOpt# { |
| 139 | ARM_ISB_RESERVED_0cxx . . $ ARM_ISB_RESERVED_0. = 0, |
| 140 | ARM_ISB_RESERVED_1cxx . . $ ARM_ISB_RESERVED_1. = 1, |
| 141 | ARM_ISB_RESERVED_2cxx . . $ ARM_ISB_RESERVED_2. = 2, |
| 142 | ARM_ISB_RESERVED_3cxx . . $ ARM_ISB_RESERVED_3. = 3, |
| 143 | ARM_ISB_RESERVED_4cxx . . $ ARM_ISB_RESERVED_4. = 4, |
| 144 | ARM_ISB_RESERVED_5cxx . . $ ARM_ISB_RESERVED_5. = 5, |
| 145 | ARM_ISB_RESERVED_6cxx . . $ ARM_ISB_RESERVED_6. = 6, |
| 146 | ARM_ISB_RESERVED_7cxx . . $ ARM_ISB_RESERVED_7. = 7, |
| 147 | ARM_ISB_RESERVED_8cxx . . $ ARM_ISB_RESERVED_8. = 8, |
| 148 | ARM_ISB_RESERVED_9cxx . . $ ARM_ISB_RESERVED_9. = 9, |
| 149 | ARM_ISB_RESERVED_10cxx . . $ ARM_ISB_RESERVED_10. = 10, |
| 150 | ARM_ISB_RESERVED_11cxx . . $ ARM_ISB_RESERVED_11. = 11, |
| 151 | ARM_ISB_RESERVED_12cxx . . $ ARM_ISB_RESERVED_12. = 12, |
| 152 | ARM_ISB_RESERVED_13cxx . . $ ARM_ISB_RESERVED_13. = 13, |
| 153 | ARM_ISB_RESERVED_14cxx . . $ ARM_ISB_RESERVED_14. = 14, |
| 154 | ARM_ISB_SYcxx . . $ ARM_ISB_SY. = 15 |
| 155 | }; |
| 156 | |
| 157 | inline static const char *ARM_ISB_InstSyncBOptToStringcxx . . $ ARM_ISB_InstSyncBOptToString(81a3ae90da26a711).(unsigned val) |
| 158 | { |
| 159 | switch (val) { |
| 160 | default: // never reach |
| 161 | case ARM_ISB_RESERVED_0cxx . . $ ARM_ISB_RESERVED_0.: return "#0x0"; |
| 162 | case ARM_ISB_RESERVED_1cxx . . $ ARM_ISB_RESERVED_1.: return "#0x1"; |
| 163 | case ARM_ISB_RESERVED_2cxx . . $ ARM_ISB_RESERVED_2.: return "#0x2"; |
| 164 | case ARM_ISB_RESERVED_3cxx . . $ ARM_ISB_RESERVED_3.: return "#0x3"; |
| 165 | case ARM_ISB_RESERVED_4cxx . . $ ARM_ISB_RESERVED_4.: return "#0x4"; |
| 166 | case ARM_ISB_RESERVED_5cxx . . $ ARM_ISB_RESERVED_5.: return "#0x5"; |
| 167 | case ARM_ISB_RESERVED_6cxx . . $ ARM_ISB_RESERVED_6.: return "#0x6"; |
| 168 | case ARM_ISB_RESERVED_7cxx . . $ ARM_ISB_RESERVED_7.: return "#0x7"; |
| 169 | case ARM_ISB_RESERVED_8cxx . . $ ARM_ISB_RESERVED_8.: return "#0x8"; |
| 170 | case ARM_ISB_RESERVED_9cxx . . $ ARM_ISB_RESERVED_9.: return "#0x9"; |
| 171 | case ARM_ISB_RESERVED_10cxx . . $ ARM_ISB_RESERVED_10.: return "#0xa"; |
| 172 | case ARM_ISB_RESERVED_11cxx . . $ ARM_ISB_RESERVED_11.: return "#0xb"; |
| 173 | case ARM_ISB_RESERVED_12cxx . . $ ARM_ISB_RESERVED_12.: return "#0xc"; |
| 174 | case ARM_ISB_RESERVED_13cxx . . $ ARM_ISB_RESERVED_13.: return "#0xd"; |
| 175 | case ARM_ISB_RESERVED_14cxx . . $ ARM_ISB_RESERVED_14.: return "#0xe"; |
| 176 | case ARM_ISB_SYcxx . . $ ARM_ISB_SY.: return "sy"; |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | /// isARMLowRegister - Returns true if the register is a low register (r0-r7). |
| 181 | /// |
| 182 | static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! isARMLowRegistercxx . . $ isARMLowRegister(dfa6e707f7696010).(unsigned Reg) |
| 183 | { |
| 184 | //using namespace ARM; |
| 185 | switch (Reg) { |
| 186 | case ARM_R0cxx . . $ ARM_R0.: case ARM_R1cxx . . $ ARM_R1.: case ARM_R2cxx . . $ ARM_R2.: case ARM_R3cxx . . $ ARM_R3.: |
| 187 | case ARM_R4cxx . . $ ARM_R4.: case ARM_R5cxx . . $ ARM_R5.: case ARM_R6cxx . . $ ARM_R6.: case ARM_R7cxx . . $ ARM_R7.: |
| 188 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 189 | default: |
| 190 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | /// ARMII - This namespace holds all of the target specific flags that |
| 195 | /// instruction info tracks. |
| 196 | /// |
| 197 | /// ARM Index Modes |
| 198 | enum ARMII_IndexModecxx . . $ ARMII_IndexMode# { |
| 199 | ARMII_IndexModeNonecxx . . $ ARMII_IndexModeNone. = 0, |
| 200 | ARMII_IndexModePrecxx . . $ ARMII_IndexModePre. = 1, |
| 201 | ARMII_IndexModePostcxx . . $ ARMII_IndexModePost. = 2, |
| 202 | ARMII_IndexModeUpdcxx . . $ ARMII_IndexModeUpd. = 3 |
| 203 | }; |
| 204 | |
| 205 | /// ARM Addressing Modes |
| 206 | typedef enum ARMII_AddrModecxx . . $ ARMII_AddrMode# { |
| 207 | ARMII_AddrModeNonecxx . . $ ARMII_AddrModeNone. = 0, |
| 208 | ARMII_AddrMode1cxx . . $ ARMII_AddrMode1. = 1, |
| 209 | ARMII_AddrMode2cxx . . $ ARMII_AddrMode2. = 2, |
| 210 | ARMII_AddrMode3cxx . . $ ARMII_AddrMode3. = 3, |
| 211 | ARMII_AddrMode4cxx . . $ ARMII_AddrMode4. = 4, |
| 212 | ARMII_AddrMode5cxx . . $ ARMII_AddrMode5. = 5, |
| 213 | ARMII_AddrMode6cxx . . $ ARMII_AddrMode6. = 6, |
| 214 | ARMII_AddrModeT1_1cxx . . $ ARMII_AddrModeT1_1. = 7, |
| 215 | ARMII_AddrModeT1_2cxx . . $ ARMII_AddrModeT1_2. = 8, |
| 216 | ARMII_AddrModeT1_4cxx . . $ ARMII_AddrModeT1_4. = 9, |
| 217 | ARMII_AddrModeT1_scxx . . $ ARMII_AddrModeT1_s. = 10, // i8 * 4 for pc and sp relative data |
| 218 | ARMII_AddrModeT2_i12cxx . . $ ARMII_AddrModeT2_i12. = 11, |
| 219 | ARMII_AddrModeT2_i8cxx . . $ ARMII_AddrModeT2_i8. = 12, |
| 220 | ARMII_AddrModeT2_socxx . . $ ARMII_AddrModeT2_so. = 13, |
| 221 | ARMII_AddrModeT2_pccxx . . $ ARMII_AddrModeT2_pc. = 14, // +/- i12 for pc relative data |
| 222 | ARMII_AddrModeT2_i8s4cxx . . $ ARMII_AddrModeT2_i8s4. = 15, // i8 * 4 |
| 223 | ARMII_AddrMode_i12cxx . . $ ARMII_AddrMode_i12. = 16 |
| 224 | } ARMII_AddrModecxx . . $ ARMII_AddrMode#; |
| 225 | |
| 226 | inline static const char *ARMII_AddrModeToStringcxx . . $ ARMII_AddrModeToString(8e2083d753f5ad2e).(ARMII_AddrModecxx . . $ ARMII_AddrMode# addrmode) |
| 227 | { |
| 228 | switch (addrmode) { |
| 229 | case ARMII_AddrModeNonecxx . . $ ARMII_AddrModeNone.: return "AddrModeNone"; |
| 230 | case ARMII_AddrMode1cxx . . $ ARMII_AddrMode1.: return "AddrMode1"; |
| 231 | case ARMII_AddrMode2cxx . . $ ARMII_AddrMode2.: return "AddrMode2"; |
| 232 | case ARMII_AddrMode3cxx . . $ ARMII_AddrMode3.: return "AddrMode3"; |
| 233 | case ARMII_AddrMode4cxx . . $ ARMII_AddrMode4.: return "AddrMode4"; |
| 234 | case ARMII_AddrMode5cxx . . $ ARMII_AddrMode5.: return "AddrMode5"; |
| 235 | case ARMII_AddrMode6cxx . . $ ARMII_AddrMode6.: return "AddrMode6"; |
| 236 | case ARMII_AddrModeT1_1cxx . . $ ARMII_AddrModeT1_1.: return "AddrModeT1_1"; |
| 237 | case ARMII_AddrModeT1_2cxx . . $ ARMII_AddrModeT1_2.: return "AddrModeT1_2"; |
| 238 | case ARMII_AddrModeT1_4cxx . . $ ARMII_AddrModeT1_4.: return "AddrModeT1_4"; |
| 239 | case ARMII_AddrModeT1_scxx . . $ ARMII_AddrModeT1_s.: return "AddrModeT1_s"; |
| 240 | case ARMII_AddrModeT2_i12cxx . . $ ARMII_AddrModeT2_i12.: return "AddrModeT2_i12"; |
| 241 | case ARMII_AddrModeT2_i8cxx . . $ ARMII_AddrModeT2_i8.: return "AddrModeT2_i8"; |
| 242 | case ARMII_AddrModeT2_socxx . . $ ARMII_AddrModeT2_so.: return "AddrModeT2_so"; |
| 243 | case ARMII_AddrModeT2_pccxx . . $ ARMII_AddrModeT2_pc.: return "AddrModeT2_pc"; |
| 244 | case ARMII_AddrModeT2_i8s4cxx . . $ ARMII_AddrModeT2_i8s4.: return "AddrModeT2_i8s4"; |
| 245 | case ARMII_AddrMode_i12cxx . . $ ARMII_AddrMode_i12.: return "AddrMode_i12"; |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | /// Target Operand Flag enum. |
| 250 | enum ARMII_TOFcxx . . $ ARMII_TOF# { |
| 251 | //===------------------------------------------------------------------===// |
| 252 | // ARM Specific MachineOperand flags. |
| 253 | |
| 254 | ARMII_MO_NO_FLAGcxx . . $ ARMII_MO_NO_FLAG., |
| 255 | |
| 256 | /// MO_LO16 - On a symbol operand, this represents a relocation containing |
| 257 | /// lower 16 bit of the address. Used only via movw instruction. |
| 258 | ARMII_MO_LO16cxx . . $ ARMII_MO_LO16., |
| 259 | |
| 260 | /// MO_HI16 - On a symbol operand, this represents a relocation containing |
| 261 | /// higher 16 bit of the address. Used only via movt instruction. |
| 262 | ARMII_MO_HI16cxx . . $ ARMII_MO_HI16., |
| 263 | |
| 264 | /// MO_LO16_NONLAZY - On a symbol operand "FOO", this represents a |
| 265 | /// relocation containing lower 16 bit of the non-lazy-ptr indirect symbol, |
| 266 | /// i.e. "FOO$non_lazy_ptr". |
| 267 | /// Used only via movw instruction. |
| 268 | ARMII_MO_LO16_NONLAZYcxx . . $ ARMII_MO_LO16_NONLAZY., |
| 269 | |
| 270 | /// MO_HI16_NONLAZY - On a symbol operand "FOO", this represents a |
| 271 | /// relocation containing lower 16 bit of the non-lazy-ptr indirect symbol, |
| 272 | /// i.e. "FOO$non_lazy_ptr". Used only via movt instruction. |
| 273 | ARMII_MO_HI16_NONLAZYcxx . . $ ARMII_MO_HI16_NONLAZY., |
| 274 | |
| 275 | /// MO_LO16_NONLAZY_PIC - On a symbol operand "FOO", this represents a |
| 276 | /// relocation containing lower 16 bit of the PC relative address of the |
| 277 | /// non-lazy-ptr indirect symbol, i.e. "FOO$non_lazy_ptr - LABEL". |
| 278 | /// Used only via movw instruction. |
| 279 | ARMII_MO_LO16_NONLAZY_PICcxx . . $ ARMII_MO_LO16_NONLAZY_PIC., |
| 280 | |
| 281 | /// MO_HI16_NONLAZY_PIC - On a symbol operand "FOO", this represents a |
| 282 | /// relocation containing lower 16 bit of the PC relative address of the |
| 283 | /// non-lazy-ptr indirect symbol, i.e. "FOO$non_lazy_ptr - LABEL". |
| 284 | /// Used only via movt instruction. |
| 285 | ARMII_MO_HI16_NONLAZY_PICcxx . . $ ARMII_MO_HI16_NONLAZY_PIC., |
| 286 | |
| 287 | /// MO_PLT - On a symbol operand, this represents an ELF PLT reference on a |
| 288 | /// call operand. |
| 289 | ARMII_MO_PLTcxx . . $ ARMII_MO_PLT. |
| 290 | }; |
| 291 | |
| 292 | enumcxx . . $ $anonymous_type_dc2a0a47fd19a417_0# { |
| 293 | //===------------------------------------------------------------------===// |
| 294 | // Instruction Flags. |
| 295 | |
| 296 | //===------------------------------------------------------------------===// |
| 297 | // This four-bit field describes the addressing mode used. |
| 298 | ARMII_AddrModeMaskcxx . . $ ARMII_AddrModeMask. = 0x1f, // The AddrMode enums are declared in ARMBaseInfo.h |
| 299 | |
| 300 | // IndexMode - Unindex, pre-indexed, or post-indexed are valid for load |
| 301 | // and store ops only. Generic "updating" flag is used for ld/st multiple. |
| 302 | // The index mode enums are declared in ARMBaseInfo.h |
| 303 | ARMII_IndexModeShiftcxx . . $ ARMII_IndexModeShift. = 5, |
| 304 | ARMII_IndexModeMaskcxx . . $ ARMII_IndexModeMask. = 3 << ARMII_IndexModeShiftcxx . . $ ARMII_IndexModeShift., |
| 305 | |
| 306 | //===------------------------------------------------------------------===// |
| 307 | // Instruction encoding formats. |
| 308 | // |
| 309 | ARMII_FormShiftcxx . . $ ARMII_FormShift. = 7, |
| 310 | ARMII_FormMaskcxx . . $ ARMII_FormMask. = 0x3f << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 311 | |
| 312 | // Pseudo instructions |
| 313 | ARMII_Pseudocxx . . $ ARMII_Pseudo. = 0 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 314 | |
| 315 | // Multiply instructions |
| 316 | ARMII_MulFrmcxx . . $ ARMII_MulFrm. = 1 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 317 | |
| 318 | // Branch instructions |
| 319 | ARMII_BrFrmcxx . . $ ARMII_BrFrm. = 2 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 320 | ARMII_BrMiscFrmcxx . . $ ARMII_BrMiscFrm. = 3 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 321 | |
| 322 | // Data Processing instructions |
| 323 | ARMII_DPFrmcxx . . $ ARMII_DPFrm. = 4 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 324 | ARMII_DPSoRegFrmcxx . . $ ARMII_DPSoRegFrm. = 5 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 325 | |
| 326 | // Load and Store |
| 327 | ARMII_LdFrmcxx . . $ ARMII_LdFrm. = 6 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 328 | ARMII_StFrmcxx . . $ ARMII_StFrm. = 7 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 329 | ARMII_LdMiscFrmcxx . . $ ARMII_LdMiscFrm. = 8 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 330 | ARMII_StMiscFrmcxx . . $ ARMII_StMiscFrm. = 9 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 331 | ARMII_LdStMulFrmcxx . . $ ARMII_LdStMulFrm. = 10 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 332 | |
| 333 | ARMII_LdStExFrmcxx . . $ ARMII_LdStExFrm. = 11 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 334 | |
| 335 | // Miscellaneous arithmetic instructions |
| 336 | ARMII_ArithMiscFrmcxx . . $ ARMII_ArithMiscFrm. = 12 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 337 | ARMII_SatFrmcxx . . $ ARMII_SatFrm. = 13 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 338 | |
| 339 | // Extend instructions |
| 340 | ARMII_ExtFrmcxx . . $ ARMII_ExtFrm. = 14 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 341 | |
| 342 | // VFP formats |
| 343 | ARMII_VFPUnaryFrmcxx . . $ ARMII_VFPUnaryFrm. = 15 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 344 | ARMII_VFPBinaryFrmcxx . . $ ARMII_VFPBinaryFrm. = 16 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 345 | ARMII_VFPConv1Frmcxx . . $ ARMII_VFPConv1Frm. = 17 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 346 | ARMII_VFPConv2Frmcxx . . $ ARMII_VFPConv2Frm. = 18 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 347 | ARMII_VFPConv3Frmcxx . . $ ARMII_VFPConv3Frm. = 19 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 348 | ARMII_VFPConv4Frmcxx . . $ ARMII_VFPConv4Frm. = 20 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 349 | ARMII_VFPConv5Frmcxx . . $ ARMII_VFPConv5Frm. = 21 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 350 | ARMII_VFPLdStFrmcxx . . $ ARMII_VFPLdStFrm. = 22 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 351 | ARMII_VFPLdStMulFrmcxx . . $ ARMII_VFPLdStMulFrm. = 23 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 352 | ARMII_VFPMiscFrmcxx . . $ ARMII_VFPMiscFrm. = 24 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 353 | |
| 354 | // Thumb format |
| 355 | ARMII_ThumbFrmcxx . . $ ARMII_ThumbFrm. = 25 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 356 | |
| 357 | // Miscelleaneous format |
| 358 | ARMII_MiscFrmcxx . . $ ARMII_MiscFrm. = 26 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 359 | |
| 360 | // NEON formats |
| 361 | ARMII_NGetLnFrmcxx . . $ ARMII_NGetLnFrm. = 27 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 362 | ARMII_NSetLnFrmcxx . . $ ARMII_NSetLnFrm. = 28 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 363 | ARMII_NDupFrmcxx . . $ ARMII_NDupFrm. = 29 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 364 | ARMII_NLdStFrmcxx . . $ ARMII_NLdStFrm. = 30 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 365 | ARMII_N1RegModImmFrmcxx . . $ ARMII_N1RegModImmFrm.= 31 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 366 | ARMII_N2RegFrmcxx . . $ ARMII_N2RegFrm. = 32 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 367 | ARMII_NVCVTFrmcxx . . $ ARMII_NVCVTFrm. = 33 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 368 | ARMII_NVDupLnFrmcxx . . $ ARMII_NVDupLnFrm. = 34 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 369 | ARMII_N2RegVShLFrmcxx . . $ ARMII_N2RegVShLFrm. = 35 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 370 | ARMII_N2RegVShRFrmcxx . . $ ARMII_N2RegVShRFrm. = 36 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 371 | ARMII_N3RegFrmcxx . . $ ARMII_N3RegFrm. = 37 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 372 | ARMII_N3RegVShFrmcxx . . $ ARMII_N3RegVShFrm. = 38 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 373 | ARMII_NVExtFrmcxx . . $ ARMII_NVExtFrm. = 39 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 374 | ARMII_NVMulSLFrmcxx . . $ ARMII_NVMulSLFrm. = 40 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 375 | ARMII_NVTBLFrmcxx . . $ ARMII_NVTBLFrm. = 41 << ARMII_FormShiftcxx . . $ ARMII_FormShift., |
| 376 | |
| 377 | //===------------------------------------------------------------------===// |
| 378 | // Misc flags. |
| 379 | |
| 380 | // UnaryDP - Indicates this is a unary data processing instruction, i.e. |
| 381 | // it doesn't have a Rn operand. |
| 382 | ARMII_UnaryDPcxx . . $ ARMII_UnaryDP. = 1 << 13, |
| 383 | |
| 384 | // Xform16Bit - Indicates this Thumb2 instruction may be transformed into |
| 385 | // a 16-bit Thumb instruction if certain conditions are met. |
| 386 | ARMII_Xform16Bitcxx . . $ ARMII_Xform16Bit. = 1 << 14, |
| 387 | |
| 388 | // ThumbArithFlagSetting - The instruction is a 16-bit flag setting Thumb |
| 389 | // instruction. Used by the parser to determine whether to require the 'S' |
| 390 | // suffix on the mnemonic (when not in an IT block) or preclude it (when |
| 391 | // in an IT block). |
| 392 | ARMII_ThumbArithFlagSettingcxx . . $ ARMII_ThumbArithFlagSetting. = 1 << 18, |
| 393 | |
| 394 | //===------------------------------------------------------------------===// |
| 395 | // Code domain. |
| 396 | ARMII_DomainShiftcxx . . $ ARMII_DomainShift. = 15, |
| 397 | ARMII_DomainMaskcxx . . $ ARMII_DomainMask. = 7 << ARMII_DomainShiftcxx . . $ ARMII_DomainShift., |
| 398 | ARMII_DomainGeneralcxx . . $ ARMII_DomainGeneral. = 0 << ARMII_DomainShiftcxx . . $ ARMII_DomainShift., |
| 399 | ARMII_DomainVFPcxx . . $ ARMII_DomainVFP. = 1 << ARMII_DomainShiftcxx . . $ ARMII_DomainShift., |
| 400 | ARMII_DomainNEONcxx . . $ ARMII_DomainNEON. = 2 << ARMII_DomainShiftcxx . . $ ARMII_DomainShift., |
| 401 | ARMII_DomainNEONA8cxx . . $ ARMII_DomainNEONA8. = 4 << ARMII_DomainShiftcxx . . $ ARMII_DomainShift., |
| 402 | |
| 403 | //===------------------------------------------------------------------===// |
| 404 | // Field shifts - such shifts are used to set field while generating |
| 405 | // machine instructions. |
| 406 | // |
| 407 | // FIXME: This list will need adjusting/fixing as the MC code emitter |
| 408 | // takes shape and the ARMCodeEmitter.cpp bits go away. |
| 409 | ARMII_ShiftTypeShiftcxx . . $ ARMII_ShiftTypeShift. = 4, |
| 410 | |
| 411 | ARMII_M_BitShiftcxx . . $ ARMII_M_BitShift. = 5, |
| 412 | ARMII_ShiftImmShiftcxx . . $ ARMII_ShiftImmShift. = 5, |
| 413 | ARMII_ShiftShiftcxx . . $ ARMII_ShiftShift. = 7, |
| 414 | ARMII_N_BitShiftcxx . . $ ARMII_N_BitShift. = 7, |
| 415 | ARMII_ImmHiShiftcxx . . $ ARMII_ImmHiShift. = 8, |
| 416 | ARMII_SoRotImmShiftcxx . . $ ARMII_SoRotImmShift. = 8, |
| 417 | ARMII_RegRsShiftcxx . . $ ARMII_RegRsShift. = 8, |
| 418 | ARMII_ExtRotImmShiftcxx . . $ ARMII_ExtRotImmShift. = 10, |
| 419 | ARMII_RegRdLoShiftcxx . . $ ARMII_RegRdLoShift. = 12, |
| 420 | ARMII_RegRdShiftcxx . . $ ARMII_RegRdShift. = 12, |
| 421 | ARMII_RegRdHiShiftcxx . . $ ARMII_RegRdHiShift. = 16, |
| 422 | ARMII_RegRnShiftcxx . . $ ARMII_RegRnShift. = 16, |
| 423 | ARMII_S_BitShiftcxx . . $ ARMII_S_BitShift. = 20, |
| 424 | ARMII_W_BitShiftcxx . . $ ARMII_W_BitShift. = 21, |
| 425 | ARMII_AM3_I_BitShiftcxx . . $ ARMII_AM3_I_BitShift. = 22, |
| 426 | ARMII_D_BitShiftcxx . . $ ARMII_D_BitShift. = 22, |
| 427 | ARMII_U_BitShiftcxx . . $ ARMII_U_BitShift. = 23, |
| 428 | ARMII_P_BitShiftcxx . . $ ARMII_P_BitShift. = 24, |
| 429 | ARMII_I_BitShiftcxx . . $ ARMII_I_BitShift. = 25, |
| 430 | ARMII_CondShiftcxx . . $ ARMII_CondShift. = 28 |
| 431 | }; |
| 432 | |
| 433 | typedef struct MClassSysRegcxx . . $ MClassSysReg# { |
| 434 | const char *Namecxx . . $ MClassSysReg#Name.; |
| 435 | arm_sysregcxx . . $ arm_sysreg# sysregcxx . . $ MClassSysReg#sysreg.; |
| 436 | uint16_tcxx . . $ uint16_t# M1Encoding12cxx . . $ MClassSysReg#M1Encoding12.; |
| 437 | uint16_tcxx . . $ uint16_t# M2M3Encoding8cxx . . $ MClassSysReg#M2M3Encoding8.; |
| 438 | uint16_tcxx . . $ uint16_t# Encodingcxx . . $ MClassSysReg#Encoding.; |
| 439 | int FeaturesRequiredcxx . . $ MClassSysReg#FeaturesRequired.[2]; // 2 is enough for MClassSysRegsList |
| 440 | } MClassSysRegcxx . . $ MClassSysReg#; |
| 441 | |
| 442 | enum TraceSyncBOptcxx . . $ TraceSyncBOpt# { |
| 443 | CSYNCcxx . . $ CSYNC. = 0 |
| 444 | }; |
| 445 | |
| 446 | const MClassSysRegcxx . . $ MClassSysReg# *lookupMClassSysRegByM2M3Encoding8cxx . . $ lookupMClassSysRegByM2M3Encoding8(79b2831c8b34aa0).(uint16_tcxx . . $ uint16_t# encoding); |
| 447 | const MClassSysRegcxx . . $ MClassSysReg# *lookupMClassSysRegByM1Encoding12cxx . . $ lookupMClassSysRegByM1Encoding12(79b2831c8b34aa0).(uint16_tcxx . . $ uint16_t# M1Encoding12); |
| 448 | |
| 449 | // returns APSR with _<bits> qualifier. |
| 450 | // Note: ARMv7-M deprecates using MSR APSR without a _<bits> qualifier |
| 451 | static inline const MClassSysRegcxx . . $ MClassSysReg# *lookupMClassSysRegAPSRNonDeprecatedcxx . . $ lookupMClassSysRegAPSRNonDeprecated(e9c54725daf69f50).(unsigned SYSm) |
| 452 | { |
| 453 | return lookupMClassSysRegByM2M3Encoding8cxx . . $ lookupMClassSysRegByM2M3Encoding8(79b2831c8b34aa0).((1<<9) | (SYSm & 0xFF)); |
| 454 | } |
| 455 | |
| 456 | static inline const MClassSysRegcxx . . $ MClassSysReg# *lookupMClassSysRegBy8bitSYSmValuecxx . . $ lookupMClassSysRegBy8bitSYSmValue(e9c54725daf69f50).(unsigned SYSm) |
| 457 | { |
| 458 | return lookupMClassSysRegByM2M3Encoding8cxx . . $ lookupMClassSysRegByM2M3Encoding8(79b2831c8b34aa0).((1<<8) | (SYSm & 0xFF)); |
| 459 | } |
| 460 | |
| 461 | // returns true if TestFeatures are all present in FeaturesRequired |
| 462 | static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MClassSysReg_isInRequiredFeaturescxx . . $ MClassSysReg_isInRequiredFeatures(4ac3c21492e79ae7).(const MClassSysRegcxx . . $ MClassSysReg# *TheReg, int TestFeatures) |
| 463 | { |
| 464 | return (TheReg->FeaturesRequiredcxx . . $ MClassSysReg#FeaturesRequired.[0] == TestFeatures || TheReg->FeaturesRequiredcxx . . $ MClassSysReg#FeaturesRequired.[1] == TestFeatures); |
| 465 | } |
| 466 | |
| 467 | // lookup system register using 12-bit SYSm value. |
| 468 | // Note: the search is uniqued using M1 mask |
| 469 | static inline const MClassSysRegcxx . . $ MClassSysReg# *lookupMClassSysRegBy12bitSYSmValuecxx . . $ lookupMClassSysRegBy12bitSYSmValue(e9c54725daf69f50).(unsigned SYSm) |
| 470 | { |
| 471 | return lookupMClassSysRegByM1Encoding12cxx . . $ lookupMClassSysRegByM1Encoding12(79b2831c8b34aa0).(SYSm); |
| 472 | } |
| 473 | |
| 474 | static inline const char *ARM_TSB_TraceSyncBOptToStringcxx . . $ ARM_TSB_TraceSyncBOptToString(81a3ae90da26a711).(unsigned val) |
| 475 | { |
| 476 | switch (val) { |
| 477 | default: |
| 478 | // llvm_unreachable("Unknown trace synchronization barrier operation"); |
| 479 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 480 | |
| 481 | case CSYNCcxx . . $ CSYNC.: |
| 482 | return "csync"; |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | #endif |