Rizin
unix-like reverse engineering framework and cli tools
MCRegisterInfo.h
Go to the documentation of this file.
1 //=== MC/MCRegisterInfo.h - Target Register Description ---------*- 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 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 <aquynh@gmail.com>, 2013-2015 */
18 
19 #ifndef CS_LLVM_MC_MCREGISTERINFO_H
20 #define CS_LLVM_MC_MCREGISTERINFO_H
21 
22 #include "capstone/platform.h"
23 
27 typedef const MCPhysReg* iterator;
28 
29 typedef struct MCRegisterClass {
31  const uint8_t *RegSet;
36  uint16_t RegSize, Alignment; // Size & Alignment of register in bytes
40 
48 typedef struct MCRegisterDesc {
49  uint32_t Name; // Printable name for the reg (for debugging)
50  uint32_t SubRegs; // Sub-register set, described above
51  uint32_t SuperRegs; // Super-register set, described above
52 
53  // Offset into MCRI::SubRegIndices of a list of sub-register indices for each
54  // sub-register in SubRegs.
56 
57  // RegUnits - Points to the list of register units. The low 4 bits holds the
58  // Scale, the high bits hold an offset into DiffLists. See MCRegUnitIterator.
60 
65 
78 typedef struct MCRegisterInfo {
79  const MCRegisterDesc *Desc; // Pointer to the descriptor array
80  unsigned NumRegs; // Number of entries in the array
81  unsigned RAReg; // Return address register
82  unsigned PCReg; // Program counter register
83  const MCRegisterClass *Classes; // Pointer to the regclass array
84  unsigned NumClasses; // Number of entries in the array
85  unsigned NumRegUnits; // Number of regunits.
86  uint16_t (*RegUnitRoots)[2]; // Pointer to regunit root table.
87  const MCPhysReg *DiffLists; // Pointer to the difflists array
88  const char *RegStrings; // Pointer to the string table.
89  const uint16_t *SubRegIndices; // Pointer to the subreg lookup
90  // array.
91  unsigned NumSubRegIndices; // Number of subreg indices.
92  const uint16_t *RegEncodingTable; // Pointer to array of register
93  // encodings.
95 
97  const MCRegisterDesc *D, unsigned NR, unsigned RA,
98  unsigned PC,
99  const MCRegisterClass *C, unsigned NC,
100  uint16_t (*RURoots)[2],
101  unsigned NRU,
102  const MCPhysReg *DL,
103  const char *Strings,
104  const uint16_t *SubIndices,
105  unsigned NumIndices,
106  const uint16_t *RET);
107 
108 unsigned MCRegisterInfo_getMatchingSuperReg(const MCRegisterInfo *RI, unsigned Reg, unsigned SubIdx, const MCRegisterClass *RC);
109 
110 unsigned MCRegisterInfo_getSubReg(const MCRegisterInfo *RI, unsigned Reg, unsigned Idx);
111 
112 const MCRegisterClass* MCRegisterInfo_getRegClass(const MCRegisterInfo *RI, unsigned i);
113 
114 bool MCRegisterClass_contains(const MCRegisterClass *c, unsigned Reg);
115 
116 #endif
unsigned MCRegisterInfo_getMatchingSuperReg(const MCRegisterInfo *RI, unsigned Reg, unsigned SubIdx, const MCRegisterClass *RC)
const MCRegisterClass * MCRegisterInfo_getRegClass(const MCRegisterInfo *RI, unsigned i)
const MCPhysReg * iterator
void MCRegisterInfo_InitMCRegisterInfo(MCRegisterInfo *RI, const MCRegisterDesc *D, unsigned NR, unsigned RA, unsigned PC, const MCRegisterClass *C, unsigned NC, uint16_t(*RURoots)[2], unsigned NRU, const MCPhysReg *DL, const char *Strings, const uint16_t *SubIndices, unsigned NumIndices, const uint16_t *RET)
struct MCRegisterDesc MCRegisterDesc
bool MCRegisterClass_contains(const MCRegisterClass *c, unsigned Reg)
struct MCRegisterClass MCRegisterClass
uint16_t MCPhysReg
struct MCRegisterInfo MCRegisterInfo
unsigned MCRegisterInfo_getSubReg(const MCRegisterInfo *RI, unsigned Reg, unsigned Idx)
lzma_index ** i
Definition: index.h:629
#define RET
#define C(x)
Definition: arc.h:167
#define PC(addr, is_thumb)
Definition: arm_il32.c:108
#define D
Definition: block.c:38
#define NC
Definition: utils.h:42
unsigned short uint16_t
Definition: sftypes.h:30
unsigned int uint32_t
Definition: sftypes.h:29
unsigned char uint8_t
Definition: sftypes.h:31
char int8_t
Definition: sftypes.h:35
#define c(i)
Definition: sha256.c:43
iterator RegsBegin
uint16_t RegSetSize
uint16_t Alignment
const uint8_t * RegSet
uint16_t RegUnitLaneMasks
uint32_t SubRegIndices
uint32_t SubRegs
uint32_t RegUnits
uint32_t SuperRegs
unsigned NumClasses
const MCRegisterDesc * Desc
const uint16_t * SubRegIndices
const char * RegStrings
unsigned NumRegUnits
const MCRegisterClass * Classes
uint16_t(* RegUnitRoots)[2]
const MCPhysReg * DiffLists
unsigned NumSubRegIndices
const uint16_t * RegEncodingTable
unsigned NumRegs