1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
/*
Copyright (C) 2018-2019 de4dot@gmail.com

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

use core::fmt;

// GENERATOR-BEGIN: NumberBase
// ⚠️This was generated by GENERATOR!🦹‍♂️
/// Number base
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum NumberBase {
	/// Hex numbers (base 16)
	Hexadecimal,
	/// Decimal numbers (base 10)
	Decimal,
	/// Octal numbers (base 8)
	Octal,
	/// Binary numbers (base 2)
	Binary,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_NUMBER_BASE: [&str; 4] = [
	"Hexadecimal",
	"Decimal",
	"Octal",
	"Binary",
];
impl fmt::Debug for NumberBase {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_NUMBER_BASE[*self as usize])?;
		Ok(())
	}
}
impl Default for NumberBase {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		NumberBase::Hexadecimal
	}
}
// GENERATOR-END: NumberBase

// GENERATOR-BEGIN: MemorySizeOptions
// ⚠️This was generated by GENERATOR!🦹‍♂️
/// Memory size options used by the formatters
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum MemorySizeOptions {
	/// Show memory size if the assembler requires it, else don't show anything
	Default,
	/// Always show the memory size, even if the assembler doesn't need it
	Always,
	/// Show memory size if a human can't figure out the size of the operand
	Minimum,
	/// Never show memory size
	Never,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_MEMORY_SIZE_OPTIONS: [&str; 4] = [
	"Default",
	"Always",
	"Minimum",
	"Never",
];
impl fmt::Debug for MemorySizeOptions {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_MEMORY_SIZE_OPTIONS[*self as usize])?;
		Ok(())
	}
}
impl Default for MemorySizeOptions {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		MemorySizeOptions::Default
	}
}
// GENERATOR-END: MemorySizeOptions

// GENERATOR-BEGIN: FormatMnemonicOptions
// ⚠️This was generated by GENERATOR!🦹‍♂️
/// Format mnemonic options
#[allow(missing_copy_implementations)]
#[allow(missing_debug_implementations)]
pub struct FormatMnemonicOptions;
impl FormatMnemonicOptions {
	/// No option is set
	pub const NONE: u32 = 0x0000_0000;
	/// Don't add any prefixes
	pub const NO_PREFIXES: u32 = 0x0000_0001;
	/// Don't add the mnemonic
	pub const NO_MNEMONIC: u32 = 0x0000_0002;
}
// GENERATOR-END: FormatMnemonicOptions

// GENERATOR-BEGIN: PrefixKind
// ⚠️This was generated by GENERATOR!🦹‍♂️
/// Prefix
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[allow(missing_docs)]
pub enum PrefixKind {
	ES,
	CS,
	SS,
	DS,
	FS,
	GS,
	Lock,
	Rep,
	Repe,
	Repne,
	OperandSize,
	AddressSize,
	HintNotTaken,
	HintTaken,
	Bnd,
	Notrack,
	Xacquire,
	Xrelease,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_PREFIX_KIND: [&str; 18] = [
	"ES",
	"CS",
	"SS",
	"DS",
	"FS",
	"GS",
	"Lock",
	"Rep",
	"Repe",
	"Repne",
	"OperandSize",
	"AddressSize",
	"HintNotTaken",
	"HintTaken",
	"Bnd",
	"Notrack",
	"Xacquire",
	"Xrelease",
];
impl fmt::Debug for PrefixKind {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_PREFIX_KIND[*self as usize])?;
		Ok(())
	}
}
impl Default for PrefixKind {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		PrefixKind::ES
	}
}
// GENERATOR-END: PrefixKind

// GENERATOR-BEGIN: DecoratorKind
// ⚠️This was generated by GENERATOR!🦹‍♂️
/// Decorator
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[cfg_attr(all(not(feature = "exhaustive_enums"), has_non_exhaustive), non_exhaustive)]
pub enum DecoratorKind {
	/// Broadcast decorator, eg. `{1to4}`
	Broadcast,
	/// Rounding control, eg. `{rd-sae}`
	RoundingControl,
	/// Suppress all exceptions: `{sae}`
	SuppressAllExceptions,
	/// Zeroing masking: `{z}`
	ZeroingMasking,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_DECORATOR_KIND: [&str; 4] = [
	"Broadcast",
	"RoundingControl",
	"SuppressAllExceptions",
	"ZeroingMasking",
];
impl fmt::Debug for DecoratorKind {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_DECORATOR_KIND[*self as usize])?;
		Ok(())
	}
}
impl Default for DecoratorKind {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		DecoratorKind::Broadcast
	}
}
// GENERATOR-END: DecoratorKind

// GENERATOR-BEGIN: NumberKind
// ⚠️This was generated by GENERATOR!🦹‍♂️
/// Number kind
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[cfg_attr(all(not(feature = "exhaustive_enums"), has_non_exhaustive), non_exhaustive)]
#[allow(missing_docs)]
pub enum NumberKind {
	Int8,
	UInt8,
	Int16,
	UInt16,
	Int32,
	UInt32,
	Int64,
	UInt64,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_NUMBER_KIND: [&str; 8] = [
	"Int8",
	"UInt8",
	"Int16",
	"UInt16",
	"Int32",
	"UInt32",
	"Int64",
	"UInt64",
];
impl fmt::Debug for NumberKind {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_NUMBER_KIND[*self as usize])?;
		Ok(())
	}
}
impl Default for NumberKind {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		NumberKind::Int8
	}
}
// GENERATOR-END: NumberKind

// GENERATOR-BEGIN: FormatterTextKind
// ⚠️This was generated by GENERATOR!🦹‍♂️
/// Formatter text kind
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[cfg_attr(all(not(feature = "exhaustive_enums"), has_non_exhaustive), non_exhaustive)]
pub enum FormatterTextKind {
	/// Normal text
	Text,
	/// Assembler directive
	Directive,
	/// Any prefix
	Prefix,
	/// Any mnemonic
	Mnemonic,
	/// Any keyword
	Keyword,
	/// Any operator
	Operator,
	/// Any punctuation
	Punctuation,
	/// Number
	Number,
	/// Any register
	Register,
	/// A decorator, eg. `sae` in `{sae}`
	Decorator,
	/// Selector value (eg. far `JMP`/`CALL`)
	SelectorValue,
	/// Label address (eg. `JE XXXXXX`)
	LabelAddress,
	/// Function address (eg. `CALL XXXXXX`)
	FunctionAddress,
	/// Data symbol
	Data,
	/// Label symbol
	Label,
	/// Function symbol
	Function,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_FORMATTER_TEXT_KIND: [&str; 16] = [
	"Text",
	"Directive",
	"Prefix",
	"Mnemonic",
	"Keyword",
	"Operator",
	"Punctuation",
	"Number",
	"Register",
	"Decorator",
	"SelectorValue",
	"LabelAddress",
	"FunctionAddress",
	"Data",
	"Label",
	"Function",
];
impl fmt::Debug for FormatterTextKind {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_FORMATTER_TEXT_KIND[*self as usize])?;
		Ok(())
	}
}
impl Default for FormatterTextKind {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		FormatterTextKind::Text
	}
}
// GENERATOR-END: FormatterTextKind

// GENERATOR-BEGIN: SymbolFlags
// ⚠️This was generated by GENERATOR!🦹‍♂️
/// Symbol flags
#[allow(missing_copy_implementations)]
#[allow(missing_debug_implementations)]
pub struct SymbolFlags;
impl SymbolFlags {
	/// No bit is set
	pub const NONE: u32 = 0x0000_0000;
	/// It's a symbol relative to a register, eg. a struct offset `[ebx+some_struct.field1]`. If this is cleared, it's the address of a symbol.
	pub const RELATIVE: u32 = 0x0000_0001;
	/// It's a signed symbol and it should be displayed as `-symbol` or `reg-symbol` instead of `symbol` or `reg+symbol`
	pub const SIGNED: u32 = 0x0000_0002;
}
// GENERATOR-END: SymbolFlags

// GENERATOR-BEGIN: PseudoOpsKind
// ⚠️This was generated by GENERATOR!🦹‍♂️
#[derive(Copy, Clone, Eq, PartialEq)]
#[allow(non_camel_case_types)]
#[allow(dead_code)]
pub(crate) enum PseudoOpsKind {
	cmpps,
	vcmpps,
	cmppd,
	vcmppd,
	cmpss,
	vcmpss,
	cmpsd,
	vcmpsd,
	pclmulqdq,
	vpclmulqdq,
	vpcomb,
	vpcomw,
	vpcomd,
	vpcomq,
	vpcomub,
	vpcomuw,
	vpcomud,
	vpcomuq,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_PSEUDO_OPS_KIND: [&str; 18] = [
	"cmpps",
	"vcmpps",
	"cmppd",
	"vcmppd",
	"cmpss",
	"vcmpss",
	"cmpsd",
	"vcmpsd",
	"pclmulqdq",
	"vpclmulqdq",
	"vpcomb",
	"vpcomw",
	"vpcomd",
	"vpcomq",
	"vpcomub",
	"vpcomuw",
	"vpcomud",
	"vpcomuq",
];
impl fmt::Debug for PseudoOpsKind {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_PSEUDO_OPS_KIND[*self as usize])?;
		Ok(())
	}
}
impl Default for PseudoOpsKind {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		PseudoOpsKind::cmpps
	}
}
// GENERATOR-END: PseudoOpsKind

// GENERATOR-BEGIN: FormatterFlowControl
// ⚠️This was generated by GENERATOR!🦹‍♂️
#[derive(Copy, Clone, Eq, PartialEq)]
#[allow(dead_code)]
pub(crate) enum FormatterFlowControl {
	AlwaysShortBranch,
	ShortBranch,
	NearBranch,
	NearCall,
	FarBranch,
	FarCall,
	Xbegin,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_FORMATTER_FLOW_CONTROL: [&str; 7] = [
	"AlwaysShortBranch",
	"ShortBranch",
	"NearBranch",
	"NearCall",
	"FarBranch",
	"FarCall",
	"Xbegin",
];
impl fmt::Debug for FormatterFlowControl {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_FORMATTER_FLOW_CONTROL[*self as usize])?;
		Ok(())
	}
}
impl Default for FormatterFlowControl {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		FormatterFlowControl::AlwaysShortBranch
	}
}
// GENERATOR-END: FormatterFlowControl