| 1 | //=== MC/MCRegisterInfo.h - Target Register Description ---------*- C++ -*-===//cxx . . $ `<file>/MCRegisterInfo.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 describes an abstract interface used to get information about a |
| 11 | // target machines register file. This information is used for a variety of |
| 12 | // purposed, especially register allocation. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | /* Capstone Disassembly Engine */ |
| 17 | /* By Nguyen Anh Quynh <[email protected]>, 2013-2019 */ |
| 18 | |
| 19 | #ifndef CS_LLVM_MC_MCREGISTERINFO_H |
| 20 | #define CS_LLVM_MC_MCREGISTERINFO_Hcxx . . $ `MCRegisterInfo.h:20:9`! |
| 21 | |
| 22 | #include "capstone/platform.h"cxx . . $ `<file>/include/capstone/platform.h`/ |
| 23 | |
| 24 | /// An unsigned integer type large enough to represent all physical registers, |
| 25 | /// but not necessarily virtual registers. |
| 26 | typedef uint16_tcxx . . $ uint16_t# MCPhysRegcxx . . $ MCPhysReg#; |
| 27 | typedef const MCPhysRegcxx . . $ MCPhysReg#* iteratorcxx . . $ iterator#; |
| 28 | |
| 29 | typedef struct MCRegisterClass2cxx . . $ MCRegisterClass2# { |
| 30 | iteratorcxx . . $ iterator# RegsBegincxx . . $ MCRegisterClass2#RegsBegin.; |
| 31 | const uint8_tcxx . . $ uint8_t# *RegSetcxx . . $ MCRegisterClass2#RegSet.; |
| 32 | uint8_tcxx . . $ uint8_t# RegsSizecxx . . $ MCRegisterClass2#RegsSize.; |
| 33 | uint8_tcxx . . $ uint8_t# RegSetSizecxx . . $ MCRegisterClass2#RegSetSize.; |
| 34 | } MCRegisterClass2cxx . . $ MCRegisterClass2#; |
| 35 | |
| 36 | typedef struct MCRegisterClasscxx . . $ MCRegisterClass# { |
| 37 | iteratorcxx . . $ iterator# RegsBegincxx . . $ MCRegisterClass#RegsBegin.; |
| 38 | const uint8_tcxx . . $ uint8_t# *RegSetcxx . . $ MCRegisterClass#RegSet.; |
| 39 | uint16_tcxx . . $ uint16_t# RegSetSizecxx . . $ MCRegisterClass#RegSetSize.; |
| 40 | } MCRegisterClasscxx . . $ MCRegisterClass#; |
| 41 | |
| 42 | /// MCRegisterDesc - This record contains information about a particular |
| 43 | /// register. The SubRegs field is a zero terminated array of registers that |
| 44 | /// are sub-registers of the specific register, e.g. AL, AH are sub-registers |
| 45 | /// of AX. The SuperRegs field is a zero terminated array of registers that are |
| 46 | /// super-registers of AX. |
| 47 | typedef struct MCRegisterDesccxx . . $ MCRegisterDesc# { |
| 48 | uint32_tcxx . . $ uint32_t# Namecxx . . $ MCRegisterDesc#Name.; // Printable name for the reg (for debugging) |
| 49 | uint32_tcxx . . $ uint32_t# SubRegscxx . . $ MCRegisterDesc#SubRegs.; // Sub-register set, described above |
| 50 | uint32_tcxx . . $ uint32_t# SuperRegscxx . . $ MCRegisterDesc#SuperRegs.; // Super-register set, described above |
| 51 | |
| 52 | // Offset into MCRI::SubRegIndices of a list of sub-register indices for each |
| 53 | // sub-register in SubRegs. |
| 54 | uint32_tcxx . . $ uint32_t# SubRegIndicescxx . . $ MCRegisterDesc#SubRegIndices.; |
| 55 | |
| 56 | // RegUnits - Points to the list of register units. The low 4 bits holds the |
| 57 | // Scale, the high bits hold an offset into DiffLists. See MCRegUnitIterator. |
| 58 | uint32_tcxx . . $ uint32_t# RegUnitscxx . . $ MCRegisterDesc#RegUnits.; |
| 59 | |
| 60 | /// Index into list with lane mask sequences. The sequence contains a lanemask |
| 61 | /// for every register unit. |
| 62 | uint16_tcxx . . $ uint16_t# RegUnitLaneMaskscxx . . $ MCRegisterDesc#RegUnitLaneMasks.; // ??? |
| 63 | } MCRegisterDesccxx . . $ MCRegisterDesc#; |
| 64 | |
| 65 | /// MCRegisterInfo base class - We assume that the target defines a static |
| 66 | /// array of MCRegisterDesc objects that represent all of the machine |
| 67 | /// registers that the target has. As such, we simply have to track a pointer |
| 68 | /// to this array so that we can turn register number into a register |
| 69 | /// descriptor. |
| 70 | /// |
| 71 | /// Note this class is designed to be a base class of TargetRegisterInfo, which |
| 72 | /// is the interface used by codegen. However, specific targets *should never* |
| 73 | /// specialize this class. MCRegisterInfo should only contain getters to access |
| 74 | /// TableGen generated physical register data. It must not be extended with |
| 75 | /// virtual methods. |
| 76 | typedef struct MCRegisterInfocxx . . $ MCRegisterInfo# { |
| 77 | const MCRegisterDesccxx . . $ MCRegisterDesc# *Desccxx . . $ MCRegisterInfo#Desc.; // Pointer to the descriptor array |
| 78 | unsigned NumRegscxx . . $ MCRegisterInfo#NumRegs.; // Number of entries in the array |
| 79 | unsigned RARegcxx . . $ MCRegisterInfo#RAReg.; // Return address register |
| 80 | unsigned PCRegcxx . . $ MCRegisterInfo#PCReg.; // Program counter register |
| 81 | const MCRegisterClasscxx . . $ MCRegisterClass# *Classescxx . . $ MCRegisterInfo#Classes.; // Pointer to the regclass array |
| 82 | unsigned NumClassescxx . . $ MCRegisterInfo#NumClasses.; // Number of entries in the array |
| 83 | unsigned NumRegUnitscxx . . $ MCRegisterInfo#NumRegUnits.; // Number of regunits. |
| 84 | uint16_tcxx . . $ uint16_t# (*RegUnitRootscxx . . $ MCRegisterInfo#RegUnitRoots.)[2]; // Pointer to regunit root table. |
| 85 | const MCPhysRegcxx . . $ MCPhysReg# *DiffListscxx . . $ MCRegisterInfo#DiffLists.; // Pointer to the difflists array |
| 86 | // const LaneBitmask *RegUnitMaskSequences; // Pointer to lane mask sequences |
| 87 | const char *RegStringscxx . . $ MCRegisterInfo#RegStrings.; // Pointer to the string table. |
| 88 | // const char *RegClassStrings; // Pointer to the class strings. |
| 89 | const uint16_tcxx . . $ uint16_t# *SubRegIndicescxx . . $ MCRegisterInfo#SubRegIndices.; // Pointer to the subreg lookup |
| 90 | // array. |
| 91 | unsigned NumSubRegIndicescxx . . $ MCRegisterInfo#NumSubRegIndices.; // Number of subreg indices. |
| 92 | const uint16_tcxx . . $ uint16_t# *RegEncodingTablecxx . . $ MCRegisterInfo#RegEncodingTable.; // Pointer to array of register |
| 93 | // encodings. |
| 94 | } MCRegisterInfocxx . . $ MCRegisterInfo#; |
| 95 | |
| 96 | void MCRegisterInfo_InitMCRegisterInfocxx . . $ MCRegisterInfo_InitMCRegisterInfo(5e86a0227010d6ff).(MCRegisterInfocxx . . $ MCRegisterInfo# *RI, |
| 97 | const MCRegisterDesccxx . . $ MCRegisterDesc# *D, unsigned NR, unsigned RA, |
| 98 | unsigned PC, |
| 99 | const MCRegisterClasscxx . . $ MCRegisterClass# *C, unsigned NC, |
| 100 | uint16_tcxx . . $ uint16_t# (*RURoots)[2], |
| 101 | unsigned NRU, |
| 102 | const MCPhysRegcxx . . $ MCPhysReg# *DL, |
| 103 | const char *Strings, |
| 104 | const uint16_tcxx . . $ uint16_t# *SubIndices, |
| 105 | unsigned NumIndices, |
| 106 | const uint16_tcxx . . $ uint16_t# *RET); |
| 107 | |
| 108 | unsigned MCRegisterInfo_getMatchingSuperRegcxx . . $ MCRegisterInfo_getMatchingSuperReg(3ade1747ec5307e4).(const MCRegisterInfocxx . . $ MCRegisterInfo# *RI, unsigned Reg, unsigned SubIdx, const MCRegisterClasscxx . . $ MCRegisterClass# *RC); |
| 109 | |
| 110 | unsigned MCRegisterInfo_getSubRegcxx . . $ MCRegisterInfo_getSubReg(5122505b0a81e722).(const MCRegisterInfocxx . . $ MCRegisterInfo# *RI, unsigned Reg, unsigned Idx); |
| 111 | |
| 112 | const MCRegisterClasscxx . . $ MCRegisterClass#* MCRegisterInfo_getRegClasscxx . . $ MCRegisterInfo_getRegClass(43e5681d1534da22).(const MCRegisterInfocxx . . $ MCRegisterInfo# *RI, unsigned i); |
| 113 | |
| 114 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCRegisterClass_containscxx . . $ MCRegisterClass_contains(606e0a92b949c89f).(const MCRegisterClasscxx . . $ MCRegisterClass# *c, unsigned Reg); |
| 115 | |
| 116 | #endif |