LLVM: include/llvm/MC/MCInstrDesc.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_MC_MCINSTRDESC_H
15#define LLVM_MC_MCINSTRDESC_H
16
21
22namespace llvm {
24
26
27
28
29
30
32
33
34
35
40
41
42#define MCOI_TIED_TO(op) \
43 ((1 << MCOI::TIED_TO) | ((op) << (4 + MCOI::TIED_TO * 4)))
44
45#define MCOI_EARLY_CLOBBER \
46 (1 << MCOI::EARLY_CLOBBER)
47
48
49
50
57
58
81
82}
83
84
85
87public:
88
89
90
91
93
94
96
97
99
100
102
103
104
108
109
110
112
113
115
116
118
123
128
133
138};
139
140
141
142
143
193
194
195
196
197
198
200public:
201
202
203
204
205
207 unsigned short NumOperands;
210 unsigned short SchedClass;
213 unsigned short OpInfoOffset;
214 unsigned int ImplicitOffset;
217
218
219
223 (operands()[OpNum].Constraints & (1 << Constraint))) {
224 unsigned ValuePos = 4 + Constraint * 4;
225 return (int)(operands()[OpNum].Constraints >> ValuePos) & 0x0f;
226 }
227 return -1;
228 }
229
230
232
233
234
235
236
237
239
244
245
246
247
248
250
251
253
254
255
257
258
259
260
261
263
264
265
267
268
269
271
272
273
275
276
278
279
281
282
284
285
287
288
290
291
292
293
295
296
297
298
299
300
301
303
304
305
306
307
309
310
311
313
314
315
316
317
321
322
323
324
325
329
330
331
332
335
336
337
338
339
341
342
344
345
346
348
349
351
352
354
355
356
357
359
360
361
363
364
365
366
367
368
369
370
372
373
374
375
376
377
378
379
380
381
382
384
385
386
387
388
389
390
391
392
393
394
395
399
400
401
402
403
404
405
406
407
408
409
411
412
413
414
415
416
418
419
423
424
425
426
427
428
432
433
434
435
436
437
438
439
441
442
443
444
445
447
448
452
453
454
455
456
457
458
459
460
461
462
463
464
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
502
503
504
505
506
507
508
509
510
514
515
516
517
518
520
521
522
523
524
525
529
530
531
532
533
534
535
536
537
538
540
541
542
543
544
545
546
550
551
552
553
554
555
556
560
561
562
563
564
565
566
568 auto ImplicitOps =
571 }
572
573
574
575
576
577
578
579
580
582 auto ImplicitOps =
585 }
586
587
588
592
593
594
598
599
600
601
602
604
605
606
608
609
610
611
614 for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
615 if (operands()[i].isPredicate())
616 return i;
617 }
618 return -1;
619 }
620
621
622
625};
626
627}
628
629#endif
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Instances of this class represent a single low-level machine instruction.
Describe properties that are true of each instruction in the target description file.
Definition MCInstrDesc.h:199
unsigned char NumImplicitUses
Definition MCInstrDesc.h:211
unsigned getSchedClass() const
Return the scheduling class for this instruction.
Definition MCInstrDesc.h:603
uint64_t getFlags() const
Return flags of this instruction.
Definition MCInstrDesc.h:252
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
Definition MCInstrDesc.h:238
unsigned char NumImplicitDefs
Definition MCInstrDesc.h:212
ArrayRef< MCOperandInfo > operands() const
Definition MCInstrDesc.h:240
bool isInsertSubregLike() const
Return true if this instruction behaves the same way as the generic INSERT_SUBREG instructions.
Definition MCInstrDesc.h:410
bool mayStore() const
Return true if this instruction could possibly modify memory.
Definition MCInstrDesc.h:446
bool isBitcast() const
Return true if this instruction is a bitcast instruction.
Definition MCInstrDesc.h:350
bool isIndirectBranch() const
Return true if this is an indirect branch, such as a branch through a register.
Definition MCInstrDesc.h:312
int findFirstPredOperandIdx() const
Find the index of the first operand in the operand list that is used to represent the predicate.
Definition MCInstrDesc.h:612
bool usesCustomInsertionHook() const
Return true if this instruction requires custom insertion support when the DAG scheduler is inserting...
Definition MCInstrDesc.h:511
uint64_t Flags
Definition MCInstrDesc.h:215
bool isBarrier() const
Returns true if the specified instruction stops control flow from executing the instruction immediate...
Definition MCInstrDesc.h:294
bool isSelect() const
Return true if this is a select instruction.
Definition MCInstrDesc.h:353
bool isAsCheapAsAMove() const
Returns true if this instruction has the same cost (or less) than a move instruction.
Definition MCInstrDesc.h:539
bool mayLoad() const
Return true if this instruction could possibly read memory.
Definition MCInstrDesc.h:440
bool hasOptionalDef() const
Set if this instruction has an optional definition, e.g.
Definition MCInstrDesc.h:266
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
Definition MCInstrDesc.h:249
bool isConvergent() const
Return true if this instruction is convergent.
Definition MCInstrDesc.h:417
uint64_t TSFlags
Definition MCInstrDesc.h:216
bool canFoldAsLoad() const
Return true for instructions that can be folded as memory operands in other instructions.
Definition MCInstrDesc.h:371
bool isMoveReg() const
Return true if the instruction is a register to register move.
Definition MCInstrDesc.h:286
LLVM_ABI bool hasDefOfPhysReg(const MCInst &MI, MCRegister Reg, const MCRegisterInfo &RI) const
Return true if this instruction defines the specified physical register, either explicitly or implici...
unsigned short NumOperands
Definition MCInstrDesc.h:207
LLVM_ABI bool mayAffectControlFlow(const MCInst &MI, const MCRegisterInfo &RI) const
Return true if this is a branch or an instruction which directly writes to the program counter.
bool isRematerializable() const
Returns true if this instruction is a candidate for remat.
Definition MCInstrDesc.h:526
bool isCompare() const
Return true if this instruction is a comparison.
Definition MCInstrDesc.h:343
bool isMetaInstruction() const
Return true if this is a meta instruction that doesn't produce any output in the form of executable i...
Definition MCInstrDesc.h:274
bool isBranch() const
Returns true if this is a conditional, unconditional, or indirect branch.
Definition MCInstrDesc.h:308
bool variadicOpsAreDefs() const
Return true if variadic operands of this instruction are definitions.
Definition MCInstrDesc.h:420
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specified operand constraint if it is present.
Definition MCInstrDesc.h:220
bool hasExtraDefRegAllocReq() const
Returns true if this instruction def operands have special register allocation requirements that are ...
Definition MCInstrDesc.h:557
bool mayRaiseFPException() const
Return true if this instruction may raise a floating-point exception.
Definition MCInstrDesc.h:449
unsigned int ImplicitOffset
Definition MCInstrDesc.h:214
ArrayRef< MCPhysReg > implicit_defs() const
Return a list of registers that are potentially written by any instance of this machine instruction.
Definition MCInstrDesc.h:581
bool isUnconditionalBranch() const
Return true if this is a branch which always transfers control flow to some other block.
Definition MCInstrDesc.h:326
unsigned char Size
Definition MCInstrDesc.h:209
bool isPredicable() const
Return true if this instruction has a predicate operand that controls execution.
Definition MCInstrDesc.h:340
bool isCommutable() const
Return true if this may be a 2- or 3-address instruction (of the form "X = op Y, Z,...
Definition MCInstrDesc.h:483
bool isNotDuplicable() const
Return true if this instruction cannot be safely duplicated.
Definition MCInstrDesc.h:358
bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by other flags.
Definition MCInstrDesc.h:465
bool hasPostISelHook() const
Return true if this instruction requires adjustment after instruction selection by calling a target h...
Definition MCInstrDesc.h:519
bool isExtractSubregLike() const
Return true if this instruction behaves the same way as the generic EXTRACT_SUBREG instructions.
Definition MCInstrDesc.h:396
bool isCall() const
Return true if the instruction is a call.
Definition MCInstrDesc.h:289
bool isConvertibleTo3Addr() const
Return true if this is a 2-address instruction which can be changed into a 3-address instruction if n...
Definition MCInstrDesc.h:499
unsigned short SchedClass
Definition MCInstrDesc.h:210
bool isTerminator() const
Returns true if this instruction part of the terminator for a basic block.
Definition MCInstrDesc.h:302
bool hasDelaySlot() const
Returns true if the specified instruction has a delay slot which must be filled by the code generator...
Definition MCInstrDesc.h:362
bool isReturn() const
Return true if the instruction is a return.
Definition MCInstrDesc.h:277
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...
Definition MCInstrDesc.h:607
bool isAdd() const
Return true if the instruction is an add instruction.
Definition MCInstrDesc.h:280
unsigned short Opcode
Definition MCInstrDesc.h:206
bool isVariadic() const
Return true if this instruction can have a variable number of operands.
Definition MCInstrDesc.h:262
bool isTrap() const
Return true if this instruction is a trap.
Definition MCInstrDesc.h:283
bool hasImplicitUseOfPhysReg(MCRegister Reg) const
Return true if this instruction implicitly uses the specified physical register.
Definition MCInstrDesc.h:589
bool isMoveImmediate() const
Return true if this instruction is a move immediate (including conditional moves) instruction.
Definition MCInstrDesc.h:347
bool isPreISelOpcode() const
Definition MCInstrDesc.h:256
bool isConditionalBranch() const
Return true if this is a branch which may fall through to the next instruction or may transfer contro...
Definition MCInstrDesc.h:318
ArrayRef< MCPhysReg > implicit_uses() const
Return a list of registers that are potentially read by any instance of this machine instruction.
Definition MCInstrDesc.h:567
bool isAuthenticated() const
Return true if this instruction authenticates a pointer (e.g.
Definition MCInstrDesc.h:429
unsigned getOpcode() const
Return the opcode number for this descriptor.
Definition MCInstrDesc.h:231
unsigned char NumDefs
Definition MCInstrDesc.h:208
bool isPseudo() const
Return true if this is a pseudo instruction that doesn't correspond to a real machine instruction.
Definition MCInstrDesc.h:270
unsigned short OpInfoOffset
Definition MCInstrDesc.h:213
bool isRegSequenceLike() const
Return true if this instruction behaves the same way as the generic REG_SEQUENCE instructions.
Definition MCInstrDesc.h:383
bool hasExtraSrcRegAllocReq() const
Returns true if this instruction source operands have special register allocation requirements that a...
Definition MCInstrDesc.h:547
LLVM_ABI bool hasImplicitDefOfPhysReg(MCRegister Reg, const MCRegisterInfo *MRI=nullptr) const
Return true if this instruction implicitly defines the specified physical register.
This holds information about one operand of a machine instruction, indicating the register class for ...
Definition MCInstrDesc.h:86
unsigned getGenericTypeIndex() const
Definition MCInstrDesc.h:124
bool isOptionalDef() const
Set if this operand is a optional def.
Definition MCInstrDesc.h:114
unsigned getGenericImmIndex() const
Definition MCInstrDesc.h:134
bool isBranchTarget() const
Set if this operand is a branch target.
Definition MCInstrDesc.h:117
uint16_t Constraints
Operand constraints (see OperandConstraint enum).
Definition MCInstrDesc.h:101
uint8_t OperandType
Information about the type of the operand.
Definition MCInstrDesc.h:98
bool isLookupRegClassByHwMode() const
Set if this operand is a value that requires the current hwmode to look up its register class.
Definition MCInstrDesc.h:105
uint8_t Flags
These are flags from the MCOI::OperandFlags enum.
Definition MCInstrDesc.h:95
bool isGenericImm() const
Definition MCInstrDesc.h:129
int16_t RegClass
This specifies the register class enumeration of the operand if the operand is a register.
Definition MCInstrDesc.h:92
bool isGenericType() const
Definition MCInstrDesc.h:119
bool isPredicate() const
Set if this is one of the operands that made up of the predicate operand that controls an isPredicabl...
Definition MCInstrDesc.h:111
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
Definition MCInstrDesc.h:144
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition MCInstrDesc.h:149
@ Variadic
Definition MCInstrDesc.h:151
@ Trap
Definition MCInstrDesc.h:188
@ Compare
Definition MCInstrDesc.h:162
@ ExtraDefRegAllocReq
Definition MCInstrDesc.h:182
@ Bitcast
Definition MCInstrDesc.h:165
@ Barrier
Definition MCInstrDesc.h:158
@ Add
Definition MCInstrDesc.h:187
@ Select
Definition MCInstrDesc.h:166
@ HasOptionalDef
Definition MCInstrDesc.h:152
@ Branch
Definition MCInstrDesc.h:160
@ DelaySlot
Definition MCInstrDesc.h:167
@ MoveReg
Definition MCInstrDesc.h:164
@ Commutable
Definition MCInstrDesc.h:175
@ VariadicOpsAreDefs
Definition MCInstrDesc.h:189
@ Call
Definition MCInstrDesc.h:157
@ CheapAsAMove
Definition MCInstrDesc.h:180
@ ConvertibleTo3Addr
Definition MCInstrDesc.h:176
@ HasPostISelHook
Definition MCInstrDesc.h:178
@ MayStore
Definition MCInstrDesc.h:170
@ MayLoad
Definition MCInstrDesc.h:169
@ Return
Definition MCInstrDesc.h:155
@ EHScopeReturn
Definition MCInstrDesc.h:156
@ Convergent
Definition MCInstrDesc.h:186
@ MayRaiseFPException
Definition MCInstrDesc.h:171
@ Rematerializable
Definition MCInstrDesc.h:179
@ NotDuplicable
Definition MCInstrDesc.h:173
@ Predicable
Definition MCInstrDesc.h:172
@ ExtraSrcRegAllocReq
Definition MCInstrDesc.h:181
@ PreISelOpcode
Definition MCInstrDesc.h:150
@ RegSequence
Definition MCInstrDesc.h:183
@ FoldableAsLoad
Definition MCInstrDesc.h:168
@ MoveImm
Definition MCInstrDesc.h:163
@ Pseudo
Definition MCInstrDesc.h:153
@ IndirectBranch
Definition MCInstrDesc.h:161
@ UsesCustomInserter
Definition MCInstrDesc.h:177
@ InsertSubreg
Definition MCInstrDesc.h:185
@ Meta
Definition MCInstrDesc.h:154
@ ExtractSubreg
Definition MCInstrDesc.h:184
@ Authenticated
Definition MCInstrDesc.h:190
@ Terminator
Definition MCInstrDesc.h:159
@ UnmodeledSideEffects
Definition MCInstrDesc.h:174
Definition MCInstrDesc.h:31
OperandFlags
These are flags set on operands, but should be considered private, all access should go through the M...
Definition MCInstrDesc.h:51
@ OptionalDef
Definition MCInstrDesc.h:54
@ BranchTarget
Definition MCInstrDesc.h:55
@ Predicate
Definition MCInstrDesc.h:53
@ LookupRegClassByHwMode
Definition MCInstrDesc.h:52
OperandConstraint
Operand constraints.
Definition MCInstrDesc.h:36
@ EARLY_CLOBBER
Definition MCInstrDesc.h:38
@ TIED_TO
Definition MCInstrDesc.h:37
OperandType
Operands are tagged with one of the values of this enum.
Definition MCInstrDesc.h:59
@ OPERAND_GENERIC_4
Definition MCInstrDesc.h:71
@ OPERAND_PCREL
Definition MCInstrDesc.h:64
@ OPERAND_GENERIC_2
Definition MCInstrDesc.h:69
@ OPERAND_GENERIC_1
Definition MCInstrDesc.h:68
@ OPERAND_REGISTER
Definition MCInstrDesc.h:62
@ OPERAND_FIRST_TARGET
Definition MCInstrDesc.h:79
@ OPERAND_GENERIC_IMM_0
Definition MCInstrDesc.h:76
@ OPERAND_GENERIC_3
Definition MCInstrDesc.h:70
@ OPERAND_IMMEDIATE
Definition MCInstrDesc.h:61
@ OPERAND_MEMORY
Definition MCInstrDesc.h:63
@ OPERAND_UNKNOWN
Definition MCInstrDesc.h:60
@ OPERAND_LAST_GENERIC
Definition MCInstrDesc.h:73
@ OPERAND_FIRST_GENERIC
Definition MCInstrDesc.h:66
@ OPERAND_GENERIC_0
Definition MCInstrDesc.h:67
@ OPERAND_GENERIC_5
Definition MCInstrDesc.h:72
@ OPERAND_FIRST_GENERIC_IMM
Definition MCInstrDesc.h:75
@ OPERAND_LAST_GENERIC_IMM
Definition MCInstrDesc.h:77
This is an optimization pass for GlobalISel generic memory operations.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
ArrayRef(const T &OneElt) -> ArrayRef< T >
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.