Debian Codegraph @

MCInst.h

raw symbols SCIP
1 //===-- llvm/MC/MCInst.h - MCInst class -------------------------*- C++ -*-===//cxx . . $ `<file>/MCInst.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 the declaration of the MCInst and MCOperand classes, which
11 // is the basic representation used to represent low-level machine code
12 // instructions.
13 //
14 //===----------------------------------------------------------------------===//
15
16 /* Capstone Disassembly Engine */
17 /* By Nguyen Anh Quynh <[email protected]>, 2013-2019 */
18
19 #ifndef CS_MCINST_H
20 #define CS_MCINST_Hcxx . . $ `MCInst.h:20:9`!
21
22 #include "include/capstone/capstone.h"cxx . . $ `<file>/include/capstone/capstone.h`/
23 #include "MCInstrDesc.h"cxx . . $ `<file>/MCInstrDesc.h`/
24 #include "MCRegisterInfo.h"cxx . . $ `<file>/MCRegisterInfo.h`/
25
26 typedef struct MCInstcxx . . $ MCInst# MCInstcxx . . $ MCInst#;
27 typedef struct cs_structcxx . . $ cs_struct# cs_structcxx . . $ cs_struct#;
28 typedef struct MCOperandcxx . . $ MCOperand# MCOperandcxx . . $ MCOperand#;
29
30 /// MCOperand - Instances of this class represent operands of the MCInst class.
31 /// This is a simple discriminated union.
32 struct MCOperandcxx . . $ MCOperand# {
33 enumcxx . . $ MCOperand#$anonymous_type_0# {
34 kInvalidcxx . . $ MCOperand#kInvalid. = 0, ///< Uninitialized.
35 kRegistercxx . . $ MCOperand#kRegister., ///< Register operand.
36 kImmediatecxx . . $ MCOperand#kImmediate., ///< Immediate operand.
37 kFPImmediatecxx . . $ MCOperand#kFPImmediate., ///< Floating-point immediate operand.
38 kDFPImmediatecxx . . $ MCOperand#kDFPImmediate., ///< Double-Floating-point immediate operand.
39 kExprcxx . . $ MCOperand#kExpr., ///< Relocatable immediate operand.
40 kInstcxx . . $ MCOperand#kInst. ///< Sub-instruction operand.
41
42 } MachineOperandTypecxx . . $ MCOperand#MachineOperandType.;
43 unsigned char Kindcxx . . $ MCOperand#Kind.;
44
45 unioncxx . . $ MCOperand#$anonymous_type_1# {
46 unsigned RegValcxx . . $ MCOperand#$anonymous_type_1#RegVal.;
47 int64_tcxx . . $ int64_t# ImmValcxx . . $ MCOperand#$anonymous_type_1#ImmVal.;
48 double FPImmValcxx . . $ MCOperand#$anonymous_type_1#FPImmVal.;
49 };
50 };
51
52 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperand_isValidcxx . . $ MCOperand_isValid(8be14e8515538be0).(const MCOperandcxx . . $ MCOperand# *op);
53
54 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperand_isRegcxx . . $ MCOperand_isReg(8be14e8515538be0).(const MCOperandcxx . . $ MCOperand# *op);
55
56 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(const MCOperandcxx . . $ MCOperand# *op);
57
58 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperand_isFPImmcxx . . $ MCOperand_isFPImm(8be14e8515538be0).(const MCOperandcxx . . $ MCOperand# *op);
59
60 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperand_isDFPImmcxx . . $ MCOperand_isDFPImm(8be14e8515538be0).(const MCOperandcxx . . $ MCOperand# *op);
61
62 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperand_isExprcxx . . $ MCOperand_isExpr(8be14e8515538be0).(const MCOperandcxx . . $ MCOperand# *op);
63
64 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperand_isInstcxx . . $ MCOperand_isInst(8be14e8515538be0).(const MCOperandcxx . . $ MCOperand# *op);
65
66 /// getReg - Returns the register number.
67 unsigned MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(const MCOperandcxx . . $ MCOperand# *op);
68
69 /// setReg - Set the register number.
70 void MCOperand_setRegcxx . . $ MCOperand_setReg(a7de7e2b93b98a5e).(MCOperandcxx . . $ MCOperand# *op, unsigned Reg);
71
72 int64_tcxx . . $ int64_t# MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCOperandcxx . . $ MCOperand# *op);
73
74 void MCOperand_setImmcxx . . $ MCOperand_setImm(6062e6a57a403332).(MCOperandcxx . . $ MCOperand# *op, int64_tcxx . . $ int64_t# Val);
75
76 double MCOperand_getFPImmcxx . . $ MCOperand_getFPImm(6f1dad62f05c77b7).(const MCOperandcxx . . $ MCOperand# *op);
77
78 void MCOperand_setFPImmcxx . . $ MCOperand_setFPImm(ef60f7f840c96669).(MCOperandcxx . . $ MCOperand# *op, double Val);
79
80 const MCInstcxx . . $ MCInst# *MCOperand_getInstcxx . . $ MCOperand_getInst(cea9cd76e52dc5fd).(const MCOperandcxx . . $ MCOperand# *op);
81
82 void MCOperand_setInstcxx . . $ MCOperand_setInst(be4004e8b51be499).(MCOperandcxx . . $ MCOperand# *op, const MCInstcxx . . $ MCInst# *Val);
83
84 // create Reg operand in the next slot
85 void MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(MCInstcxx . . $ MCInst# *inst, unsigned Reg);
86
87 // create Reg operand use the last-unused slot
88 MCOperandcxx . . $ MCOperand# *MCOperand_CreateReg1cxx . . $ MCOperand_CreateReg1(4687f87e75986a5b).(MCInstcxx . . $ MCInst# *inst, unsigned Reg);
89
90 // create Imm operand in the next slot
91 void MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(MCInstcxx . . $ MCInst# *inst, int64_tcxx . . $ int64_t# Val);
92
93 // create Imm operand in the last-unused slot
94 MCOperandcxx . . $ MCOperand# *MCOperand_CreateImm1cxx . . $ MCOperand_CreateImm1(d9aeb76e8d27515e).(MCInstcxx . . $ MCInst# *inst, int64_tcxx . . $ int64_t# Val);
95
96 #define MAX_MC_OPScxx . . $ `MCInst.h:96:9`! 48
97
98 /// MCInst - Instances of this class represent a single low-level machine
99 /// instruction.
100 struct MCInstcxx . . $ MCInst# {
101 unsigned OpcodePubcxx . . $ MCInst#OpcodePub.; // public opcode (<arch>_INS_yyy in header files <arch>.h)
102 uint8_tcxx . . $ uint8_t# sizecxx . . $ MCInst#size.; // number of operands
103 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! has_immcxx . . $ MCInst#has_imm.; // indicate this instruction has an X86_OP_IMM operand - used for ATT syntax
104 uint8_tcxx . . $ uint8_t# op1_sizecxx . . $ MCInst#op1_size.; // size of 1st operand - for X86 Intel syntax
105 unsigned Opcodecxx . . $ MCInst#Opcode.; // private opcode
106 MCOperandcxx . . $ MCOperand# Operandscxx . . $ MCInst#Operands.[MAX_MC_OPScxx . . $ `MCInst.h:96:9`!];
107 cs_insncxx . . $ cs_insn# *flat_insncxx . . $ MCInst#flat_insn.; // insn to be exposed to public
108 uint64_tcxx . . $ uint64_t# addresscxx . . $ MCInst#address.; // address of this insn
109 cs_structcxx . . $ cs_struct# *cshcxx . . $ MCInst#csh.; // save the main csh
110 uint8_tcxx . . $ uint8_t# x86opsizecxx . . $ MCInst#x86opsize.; // opsize for [mem] operand
111
112 // These flags could be used to pass some info from one target subcomponent
113 // to another, for example, from disassembler to asm printer. The values of
114 // the flags have any sense on target level only (e.g. prefixes on x86).
115 unsigned flagscxx . . $ MCInst#flags.;
116
117 // (Optional) instruction prefix, which can be up to 4 bytes.
118 // A prefix byte gets value 0 when irrelevant.
119 // This is copied from cs_x86 struct
120 uint8_tcxx . . $ uint8_t# x86_prefixcxx . . $ MCInst#x86_prefix.[4];
121 uint8_tcxx . . $ uint8_t# imm_sizecxx . . $ MCInst#imm_size.; // immediate size for X86_OP_IMM operand
122 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! writebackcxx . . $ MCInst#writeback.; // writeback for ARM
123 int8_tcxx . . $ int8_t# tied_op_idxcxx . . $ MCInst#tied_op_idx.
124 [MAX_MC_OPScxx . . $ `MCInst.h:96:9`!]; ///< Tied operand indices. Index = Src op; Value: Dest op
125 // operand access index for list of registers sharing the same access right (for ARM)
126 uint8_tcxx . . $ uint8_t# ac_idxcxx . . $ MCInst#ac_idx.;
127 uint8_tcxx . . $ uint8_t# popcode_adjustcxx . . $ MCInst#popcode_adjust.; // Pseudo X86 instruction adjust
128 char assemblycxx . . $ MCInst#assembly.[8]; // for special instruction, so that we dont need printer
129 unsigned char evm_datacxx . . $ MCInst#evm_data.[32]; // for EVM PUSH operand
130 cs_wasm_opcxx . . $ cs_wasm_op# wasm_datacxx . . $ MCInst#wasm_data.; // for WASM operand
131 MCRegisterInfocxx . . $ MCRegisterInfo# *MRIcxx . . $ MCInst#MRI.;
132 uint8_tcxx . . $ uint8_t# xAcquireReleasecxx . . $ MCInst#xAcquireRelease.; // X86 xacquire/xrelease
133 };
134
135 void MCInst_Initcxx . . $ MCInst_Init(94c8a3269074abe9).(MCInstcxx . . $ MCInst# *inst);
136
137 void MCInst_clearcxx . . $ MCInst_clear(94c8a3269074abe9).(MCInstcxx . . $ MCInst# *inst);
138
139 // do not free operand after inserting
140 void MCInst_insert0cxx . . $ MCInst_insert0(add3700b84a5c3fa).(MCInstcxx . . $ MCInst# *inst, int index, MCOperandcxx . . $ MCOperand# *Op);
141
142 void MCInst_setOpcodecxx . . $ MCInst_setOpcode(1d3fdd902ae43da2).(MCInstcxx . . $ MCInst# *inst, unsigned Op);
143
144 unsigned MCInst_getOpcodecxx . . $ MCInst_getOpcode(66549afbf0596d6c).(const MCInstcxx . . $ MCInst#*);
145
146 void MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MCInstcxx . . $ MCInst# *inst, unsigned Op);
147
148 unsigned MCInst_getOpcodePubcxx . . $ MCInst_getOpcodePub(66549afbf0596d6c).(const MCInstcxx . . $ MCInst#*);
149
150 MCOperandcxx . . $ MCOperand# *MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MCInstcxx . . $ MCInst# *inst, unsigned i);
151
152 unsigned MCInst_getNumOperandscxx . . $ MCInst_getNumOperands(66549afbf0596d6c).(const MCInstcxx . . $ MCInst# *inst);
153
154 // This addOperand2 function doesnt free Op
155 void MCInst_addOperand2cxx . . $ MCInst_addOperand2(c51f4ddcb6809868).(MCInstcxx . . $ MCInst# *inst, MCOperandcxx . . $ MCOperand# *Op);
156
157 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCInst_isPredicablecxx . . $ MCInst_isPredicable(64ccc6f291f11a49).(const MCInstrDesccxx . . $ MCInstrDesc# *MIDesc);
158
159 void MCInst_handleWritebackcxx . . $ MCInst_handleWriteback(bc2af1aac6b3a292).(MCInstcxx . . $ MCInst# *MI, const MCInstrDesccxx . . $ MCInstrDesc# *InstDesc);
160
161 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCInst_opIsTiedcxx . . $ MCInst_opIsTied(3f89b876b015f5e2).(const MCInstcxx . . $ MCInst# *MI, unsigned OpNum);
162
163 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCInst_opIsTyingcxx . . $ MCInst_opIsTying(3f89b876b015f5e2).(const MCInstcxx . . $ MCInst# *MI, unsigned OpNum);
164
165 #endif