libTriton version 1.0 build 1590
Loading...
Searching...
No Matches
armOperandProperties.cpp
Go to the documentation of this file.
1
2/*
3** Copyright (C) - Triton
4**
5** This program is under the terms of the Apache License 2.0.
6*/
7
9#include <triton/cpuSize.hpp>
10#include <triton/exceptions.hpp>
11
12
13
14namespace triton {
15 namespace arch {
16 namespace arm {
17
28
29
31 this->extendSize = other.extendSize;
32 this->extendType = other.extendType;
33 this->shiftType = other.shiftType;
36 this->subtracted = other.subtracted;
37 this->vasType = other.vasType;
38 this->vectorIndex = other.vectorIndex;
39 }
40
41
43 this->extendSize = other.extendSize;
44 this->extendType = other.extendType;
45 this->shiftType = other.shiftType;
48 this->subtracted = other.subtracted;
49 this->vasType = other.vasType;
50 this->vectorIndex = other.vectorIndex;
51 return *this;
52 }
53
54
58
59
63
64
68
69
73
74
78
79
83
84
85 std::string ArmOperandProperties::getVASName(void) const {
86 switch (this->vasType) {
87 case ID_VAS_16B: return "16B";
88 case ID_VAS_8B: return "8B";
89 case ID_VAS_8H: return "8H";
90 case ID_VAS_4H: return "4H";
91 case ID_VAS_4S: return "4S";
92 case ID_VAS_2S: return "2S";
93 case ID_VAS_2D: return "2D";
94 case ID_VAS_1D: return "1D";
95 default: return "invalid";
96 }
97 }
98
99
101 switch (this->vasType) {
102 case ID_VAS_16B: return triton::size::dqword;
103 case ID_VAS_8H: return triton::size::dqword;
104 case ID_VAS_4S: return triton::size::dqword;
105 case ID_VAS_2D: return triton::size::dqword;
106 case ID_VAS_8B: return triton::size::qword;
107 case ID_VAS_4H: return triton::size::qword;
108 case ID_VAS_2S: return triton::size::qword;
109 case ID_VAS_1D: return triton::size::qword;
110 default: return 0;
111 }
112 }
113
114
116 return this->extendSize;
117 }
118
119
121 return this->subtracted;
122 }
123
124
128
129
133
134
137 throw triton::exceptions::ArmOperandProperties("ArmOperandProperties::setShiftType(): invalid type of shift.");
138 this->shiftType = type;
139 }
140
141
144 throw triton::exceptions::ArmOperandProperties("ArmOperandProperties::setExtendType(): invalid type of extend.");
145 this->extendType = type;
146 }
147
148
151 throw triton::exceptions::ArmOperandProperties("ArmOperandProperties::setVASType(): invalid type of VAS.");
152 this->vasType = type;
153 }
154
155
157 switch (this->extendType) {
160 this->extendSize = dstSize - 8;
161 break;
162
165 this->extendSize = dstSize - 16;
166 break;
167
170 this->extendSize = dstSize - 32;
171 break;
172
175 this->extendSize = dstSize - 64;
176 break;
177
178 default:
179 throw triton::exceptions::ArmOperandProperties("ArmOperandProperties::setExtendedSize(): invalid type of extend");
180 }
181
182 if (this->extendSize > 64)
183 throw triton::exceptions::ArmOperandProperties("ArmOperandProperties::setExtendedSize(): invalid size of extension (integer overflow).");
184
185 if (dstSize != 8 && dstSize != 16 && dstSize != 32 && dstSize != 64)
186 throw triton::exceptions::ArmOperandProperties("ArmOperandProperties::setExtendedSize(): size must be 8, 16, 32 or 64.");
187 }
188
189
191 this->subtracted = value;
192 }
193
194
198
199 }; /* arm namespace */
200 }; /* arch namespace */
201}; /* triton namespace */
This class is used to represent specific properties of an Arm operand.
triton::arch::register_e shiftValueRegister
The shift value register.
triton::arch::arm::shift_e shiftType
The shift type.
TRITON_EXPORT void setVectorIndex(triton::sint32 index)
Sets the vector index.
TRITON_EXPORT ArmOperandProperties & operator=(const ArmOperandProperties &other)
Copy an ArmOperandProperties.
TRITON_EXPORT triton::arch::arm::shift_e getShiftType(void) const
Returns the type of the shift.
TRITON_EXPORT triton::arch::register_e getShiftRegister(void) const
Returns the value of the shift register.
TRITON_EXPORT void setVASType(triton::arch::arm::vas_e type)
Sets the type of vector arrangement specifier.
triton::arch::arm::vas_e vasType
Vector arrangement specifier.
TRITON_EXPORT triton::arch::arm::extend_e getExtendType(void) const
Returns the type of the extend.
TRITON_EXPORT void setShiftType(triton::arch::arm::shift_e type)
Sets the type of the shift.
TRITON_EXPORT void setExtendedSize(triton::uint32 dstSize)
Sets the extended size (in bits) after extension.
TRITON_EXPORT std::string getVASName(void) const
Returns the vector arrangement specifier string name.
TRITON_EXPORT triton::uint32 getExtendSize(void) const
Returns the size (in bits) of the extend.
TRITON_EXPORT void setSubtracted(bool value)
Sets subtracted flag.
TRITON_EXPORT ArmOperandProperties()
Constructor.
TRITON_EXPORT void setExtendType(triton::arch::arm::extend_e type)
Sets the type of the extend.
bool subtracted
The subtracted flag. Used in memory access operands and determines whether this operand has to be add...
triton::uint32 shiftValueImmediate
The shift value immediate.
TRITON_EXPORT triton::sint32 getVectorIndex(void) const
Returns the vector index (-1 if irrelevant).
TRITON_EXPORT triton::uint32 getShiftImmediate(void) const
Returns the value of the shift immediate.
TRITON_EXPORT triton::arch::arm::vas_e getVASType(void) const
Returns the vector arrangement specifier.
TRITON_EXPORT bool isSubtracted(void) const
Returns true if the operand has to be subtracted when computing a memory access.
triton::uint32 extendSize
The extend size (in bits).
triton::sint32 vectorIndex
Vector index (-1 if irrelevant).
TRITON_EXPORT triton::uint32 getVASSize(void) const
Returns the vector arrangement specifier size (64 or 128 bits).
TRITON_EXPORT void setShiftValue(triton::uint32 imm)
Sets the value of the shift immediate.
triton::arch::arm::extend_e extendType
The extend type.
The exception class used by shift mode.
register_e
Types of register.
Definition archEnums.hpp:64
@ ID_REG_INVALID
invalid = 0
Definition archEnums.hpp:65
shift_e
Types of shift.
vas_e
Vector arrangement specifier.
extend_e
Types of extend.
@ ID_SHIFT_LAST_ITEM
Must be the last item.
@ ID_SHIFT_INVALID
invalid
@ ID_VAS_4S
4 lanes, each containing a 32-bit element.
@ ID_VAS_2D
2 lanes, each containing a 64-bit element.
@ ID_VAS_1D
1 lane containing a 64-bit element.
@ ID_VAS_16B
16 lanes, each containing an 8-bit element.
@ ID_VAS_8B
8 lanes, each containing an 8-bit element.
@ ID_VAS_INVALID
invalid
@ ID_VAS_8H
8 lanes, each containing a 16-bit element.
@ ID_VAS_4H
4 lanes, each containing a 16-bit element.
@ ID_VAS_LAST_ITEM
must be the last item.
@ ID_VAS_2S
2 lanes, each containing a 32-bit element.
@ ID_EXTEND_SXTW
Extracts a word (32-bit) value from a register and zero extends it to the size of the register.
@ ID_EXTEND_UXTX
Use the whole 64-bit register.
@ ID_EXTEND_SXTX
Use the whole 64-bit register.
@ ID_EXTEND_SXTH
Extracts a halfword (16-bit) value from a register and zero extends it to the size of the register.
@ ID_EXTEND_UXTB
Extracts a byte (8-bit) value from a register and zero extends it to the size of the register.
@ ID_EXTEND_INVALID
invalid
@ ID_EXTEND_UXTW
Extracts a word (32-bit) value from a register and zero extends it to the size of the register.
@ ID_EXTEND_SXTB
Extracts a byte (8-bit) value from a register and zero extends it to the size of the register.
@ ID_EXTEND_UXTH
Extracts a halfword (16-bit) value from a register and zero extends it to the size of the register.
@ ID_EXTEND_LAST_ITEM
Must be the last item.
constexpr triton::uint32 dqword
dqword size in byte
Definition cpuSize.hpp:40
constexpr triton::uint32 qword
qword size in byte
Definition cpuSize.hpp:36
std::int32_t sint32
signed 32-bits
std::uint32_t uint32
unisgned 32-bits
The Triton namespace.