LLVM 22.0.0git
MCInstrDesc.h
Go to the documentation of this file.
1//===-- llvm/MC/MCInstrDesc.h - Instruction Descriptors -*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the MCOperandInfo and MCInstrDesc classes, which
10// are used to describe target instructions and their operands.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_MC_MCINSTRDESC_H
15#define LLVM_MC_MCINSTRDESC_H
16
17#include "llvm/ADT/ArrayRef.h"
19#include "llvm/MC/MCRegister.h"
21
22namespace llvm {
23class MCRegisterInfo;
24
25class MCInst;
26
27//===----------------------------------------------------------------------===//
28// Machine Operand Flags and Description
29//===----------------------------------------------------------------------===//
30
31namespace MCOI {
32/// Operand constraints. These are encoded in 16 bits with one of the
33/// low-order 3 bits specifying that a constraint is present and the
34/// corresponding high-order hex digit specifying the constraint value.
35/// This allows for a maximum of 3 constraints.
37 TIED_TO = 0, // Must be allocated the same register as specified value.
38 EARLY_CLOBBER // If present, operand is an early clobber register.
39};
40
41// Define a macro to produce each constraint value.
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/// These are flags set on operands, but should be considered
49/// private, all access should go through the MCOperandInfo accessors.
50/// See the accessors for a description of what these are.
56};
57
58/// Operands are tagged with one of the values of this enum.
65
74
78
80};
81
82} // namespace MCOI
83
84/// This holds information about one operand of a machine instruction,
85/// indicating the register class for register operands, etc.
87public:
88 /// This specifies the register class enumeration of the operand
89 /// if the operand is a register. If isLookupPtrRegClass is set, then this is
90 /// an index that is passed to TargetRegisterInfo::getPointerRegClass(x) to
91 /// get a dynamic register class.
92 int16_t RegClass;
93
94 /// These are flags from the MCOI::OperandFlags enum.
96
97 /// Information about the type of the operand.
99
100 /// Operand constraints (see OperandConstraint enum).
102
103 /// Set if this operand is a pointer value and it requires a callback
104 /// to look up its register class.
105 bool isLookupPtrRegClass() const {
106 return Flags & (1 << MCOI::LookupPtrRegClass);
107 }
108
109 /// Set if this is one of the operands that made up of the predicate
110 /// operand that controls an isPredicable() instruction.
111 bool isPredicate() const { return Flags & (1 << MCOI::Predicate); }
112
113 /// Set if this operand is a optional def.
114 bool isOptionalDef() const { return Flags & (1 << MCOI::OptionalDef); }
115
116 /// Set if this operand is a branch target.
117 bool isBranchTarget() const { return Flags & (1 << MCOI::BranchTarget); }
118
119 bool isGenericType() const {
122 }
123
124 unsigned getGenericTypeIndex() const {
125 assert(isGenericType() && "non-generic types don't have an index");
127 }
128
129 bool isGenericImm() const {
132 }
133
134 unsigned getGenericImmIndex() const {
135 assert(isGenericImm() && "non-generic immediates don't have an index");
137 }
138};
139
140//===----------------------------------------------------------------------===//
141// Machine Instruction Flags and Description
142//===----------------------------------------------------------------------===//
143
144namespace MCID {
145/// These should be considered private to the implementation of the
146/// MCInstrDesc class. Clients should use the predicate methods on MCInstrDesc,
147/// not use these directly. These all correspond to bitfields in the
148/// MCInstrDesc::Flags field.
149enum Flag {
191};
192} // namespace MCID
193
194/// Describe properties that are true of each instruction in the target
195/// description file. This captures information about side effects, register
196/// use and many other things. There is one instance of this struct for each
197/// target instruction class, and the MachineInstr class points to this struct
198/// directly to describe itself.
200public:
201 // FIXME: Disable copies and moves.
202 // Do not allow MCInstrDescs to be copied or moved. They should only exist in
203 // the <Target>Insts table because they rely on knowing their own address to
204 // find other information elsewhere in the same table.
205
206 unsigned short Opcode; // The opcode number
207 unsigned short NumOperands; // Num of args (may be more if variable_ops)
208 unsigned char NumDefs; // Num of args that are definitions
209 unsigned char Size; // Number of bytes in encoding.
210 unsigned short SchedClass; // enum identifying instr sched class
211 unsigned char NumImplicitUses; // Num of regs implicitly used
212 unsigned char NumImplicitDefs; // Num of regs implicitly defined
213 unsigned short OpInfoOffset; // Offset to info about operands
214 unsigned int ImplicitOffset; // Offset to start of implicit op list
215 uint64_t Flags; // Flags identifying machine instr class
216 uint64_t TSFlags; // Target Specific Flag values
217
218 /// Returns the value of the specified operand constraint if
219 /// it is present. Returns -1 if it is not present.
220 int getOperandConstraint(unsigned OpNum,
221 MCOI::OperandConstraint Constraint) const {
222 if (OpNum < NumOperands &&
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 /// Return the opcode number for this descriptor.
231 unsigned getOpcode() const { return Opcode; }
232
233 /// Return the number of declared MachineOperands for this
234 /// MachineInstruction. Note that variadic (isVariadic() returns true)
235 /// instructions may have additional operands at the end of the list, and note
236 /// that the machine instruction may include implicit register def/uses as
237 /// well.
238 unsigned getNumOperands() const { return NumOperands; }
239
241 auto OpInfo = reinterpret_cast<const MCOperandInfo *>(this + Opcode + 1);
242 return ArrayRef(OpInfo + OpInfoOffset, NumOperands);
243 }
244
245 /// Return the number of MachineOperands that are register
246 /// definitions. Register definitions always occur at the start of the
247 /// machine operand list. This is the number of "outs" in the .td file,
248 /// and does not include implicit defs.
249 unsigned getNumDefs() const { return NumDefs; }
250
251 /// Return flags of this instruction.
252 uint64_t getFlags() const { return Flags; }
253
254 /// \returns true if this instruction is emitted before instruction selection
255 /// and should be legalized/regbankselected/selected.
256 bool isPreISelOpcode() const { return Flags & (1ULL << MCID::PreISelOpcode); }
257
258 /// Return true if this instruction can have a variable number of
259 /// operands. In this case, the variable operands will be after the normal
260 /// operands but before the implicit definitions and uses (if any are
261 /// present).
262 bool isVariadic() const { return Flags & (1ULL << MCID::Variadic); }
263
264 /// Set if this instruction has an optional definition, e.g.
265 /// ARM instructions which can set condition code if 's' bit is set.
266 bool hasOptionalDef() const { return Flags & (1ULL << MCID::HasOptionalDef); }
267
268 /// Return true if this is a pseudo instruction that doesn't
269 /// correspond to a real machine instruction.
270 bool isPseudo() const { return Flags & (1ULL << MCID::Pseudo); }
271
272 /// Return true if this is a meta instruction that doesn't
273 /// produce any output in the form of executable instructions.
274 bool isMetaInstruction() const { return Flags & (1ULL << MCID::Meta); }
275
276 /// Return true if the instruction is a return.
277 bool isReturn() const { return Flags & (1ULL << MCID::Return); }
278
279 /// Return true if the instruction is an add instruction.
280 bool isAdd() const { return Flags & (1ULL << MCID::Add); }
281
282 /// Return true if this instruction is a trap.
283 bool isTrap() const { return Flags & (1ULL << MCID::Trap); }
284
285 /// Return true if the instruction is a register to register move.
286 bool isMoveReg() const { return Flags & (1ULL << MCID::MoveReg); }
287
288 /// Return true if the instruction is a call.
289 bool isCall() const { return Flags & (1ULL << MCID::Call); }
290
291 /// Returns true if the specified instruction stops control flow
292 /// from executing the instruction immediately following it. Examples include
293 /// unconditional branches and return instructions.
294 bool isBarrier() const { return Flags & (1ULL << MCID::Barrier); }
295
296 /// Returns true if this instruction part of the terminator for
297 /// a basic block. Typically this is things like return and branch
298 /// instructions.
299 ///
300 /// Various passes use this to insert code into the bottom of a basic block,
301 /// but before control flow occurs.
302 bool isTerminator() const { return Flags & (1ULL << MCID::Terminator); }
303
304 /// Returns true if this is a conditional, unconditional, or
305 /// indirect branch. Predicates below can be used to discriminate between
306 /// these cases, and the TargetInstrInfo::analyzeBranch method can be used to
307 /// get more information.
308 bool isBranch() const { return Flags & (1ULL << MCID::Branch); }
309
310 /// Return true if this is an indirect branch, such as a
311 /// branch through a register.
312 bool isIndirectBranch() const { return Flags & (1ULL << MCID::IndirectBranch); }
313
314 /// Return true if this is a branch which may fall
315 /// through to the next instruction or may transfer control flow to some other
316 /// block. The TargetInstrInfo::analyzeBranch method can be used to get more
317 /// information about this branch.
318 bool isConditionalBranch() const {
319 return isBranch() && !isBarrier() && !isIndirectBranch();
320 }
321
322 /// Return true if this is a branch which always
323 /// transfers control flow to some other block. The
324 /// TargetInstrInfo::analyzeBranch method can be used to get more information
325 /// about this branch.
327 return isBranch() && isBarrier() && !isIndirectBranch();
328 }
329
330 /// Return true if this is a branch or an instruction which directly
331 /// writes to the program counter. Considered 'may' affect rather than
332 /// 'does' affect as things like predication are not taken into account.
334 const MCRegisterInfo &RI) const;
335
336 /// Return true if this instruction has a predicate operand
337 /// that controls execution. It may be set to 'always', or may be set to other
338 /// values. There are various methods in TargetInstrInfo that can be used to
339 /// control and modify the predicate in this instruction.
340 bool isPredicable() const { return Flags & (1ULL << MCID::Predicable); }
341
342 /// Return true if this instruction is a comparison.
343 bool isCompare() const { return Flags & (1ULL << MCID::Compare); }
344
345 /// Return true if this instruction is a move immediate
346 /// (including conditional moves) instruction.
347 bool isMoveImmediate() const { return Flags & (1ULL << MCID::MoveImm); }
348
349 /// Return true if this instruction is a bitcast instruction.
350 bool isBitcast() const { return Flags & (1ULL << MCID::Bitcast); }
351
352 /// Return true if this is a select instruction.
353 bool isSelect() const { return Flags & (1ULL << MCID::Select); }
354
355 /// Return true if this instruction cannot be safely
356 /// duplicated. For example, if the instruction has a unique labels attached
357 /// to it, duplicating it would cause multiple definition errors.
358 bool isNotDuplicable() const { return Flags & (1ULL << MCID::NotDuplicable); }
359
360 /// Returns true if the specified instruction has a delay slot which
361 /// must be filled by the code generator.
362 bool hasDelaySlot() const { return Flags & (1ULL << MCID::DelaySlot); }
363
364 /// Return true for instructions that can be folded as memory operands
365 /// in other instructions. The most common use for this is instructions that
366 /// are simple loads from memory that don't modify the loaded value in any
367 /// way, but it can also be used for instructions that can be expressed as
368 /// constant-pool loads, such as V_SETALLONES on x86, to allow them to be
369 /// folded when it is beneficial. This should only be set on instructions
370 /// that return a value in their only virtual register definition.
371 bool canFoldAsLoad() const { return Flags & (1ULL << MCID::FoldableAsLoad); }
372
373 /// Return true if this instruction behaves
374 /// the same way as the generic REG_SEQUENCE instructions.
375 /// E.g., on ARM,
376 /// dX VMOVDRR rY, rZ
377 /// is equivalent to
378 /// dX = REG_SEQUENCE rY, ssub_0, rZ, ssub_1.
379 ///
380 /// Note that for the optimizers to be able to take advantage of
381 /// this property, TargetInstrInfo::getRegSequenceLikeInputs has to be
382 /// override accordingly.
383 bool isRegSequenceLike() const { return Flags & (1ULL << MCID::RegSequence); }
384
385 /// Return true if this instruction behaves
386 /// the same way as the generic EXTRACT_SUBREG instructions.
387 /// E.g., on ARM,
388 /// rX, rY VMOVRRD dZ
389 /// is equivalent to two EXTRACT_SUBREG:
390 /// rX = EXTRACT_SUBREG dZ, ssub_0
391 /// rY = EXTRACT_SUBREG dZ, ssub_1
392 ///
393 /// Note that for the optimizers to be able to take advantage of
394 /// this property, TargetInstrInfo::getExtractSubregLikeInputs has to be
395 /// override accordingly.
396 bool isExtractSubregLike() const {
397 return Flags & (1ULL << MCID::ExtractSubreg);
398 }
399
400 /// Return true if this instruction behaves
401 /// the same way as the generic INSERT_SUBREG instructions.
402 /// E.g., on ARM,
403 /// dX = VSETLNi32 dY, rZ, Imm
404 /// is equivalent to a INSERT_SUBREG:
405 /// dX = INSERT_SUBREG dY, rZ, translateImmToSubIdx(Imm)
406 ///
407 /// Note that for the optimizers to be able to take advantage of
408 /// this property, TargetInstrInfo::getInsertSubregLikeInputs has to be
409 /// override accordingly.
410 bool isInsertSubregLike() const { return Flags & (1ULL << MCID::InsertSubreg); }
411
412
413 /// Return true if this instruction is convergent.
414 ///
415 /// Convergent instructions may not be made control-dependent on any
416 /// additional values.
417 bool isConvergent() const { return Flags & (1ULL << MCID::Convergent); }
418
419 /// Return true if variadic operands of this instruction are definitions.
420 bool variadicOpsAreDefs() const {
421 return Flags & (1ULL << MCID::VariadicOpsAreDefs);
422 }
423
424 /// Return true if this instruction authenticates a pointer (e.g. LDRAx/BRAx
425 /// from ARMv8.3, which perform loads/branches with authentication).
426 ///
427 /// An authenticated instruction may fail in an ABI-defined manner when
428 /// operating on an invalid signed pointer.
429 bool isAuthenticated() const {
430 return Flags & (1ULL << MCID::Authenticated);
431 }
432
433 //===--------------------------------------------------------------------===//
434 // Side Effect Analysis
435 //===--------------------------------------------------------------------===//
436
437 /// Return true if this instruction could possibly read memory.
438 /// Instructions with this flag set are not necessarily simple load
439 /// instructions, they may load a value and modify it, for example.
440 bool mayLoad() const { return Flags & (1ULL << MCID::MayLoad); }
441
442 /// Return true if this instruction could possibly modify memory.
443 /// Instructions with this flag set are not necessarily simple store
444 /// instructions, they may store a modified value based on their operands, or
445 /// may not actually modify anything, for example.
446 bool mayStore() const { return Flags & (1ULL << MCID::MayStore); }
447
448 /// Return true if this instruction may raise a floating-point exception.
449 bool mayRaiseFPException() const {
450 return Flags & (1ULL << MCID::MayRaiseFPException);
451 }
452
453 /// Return true if this instruction has side
454 /// effects that are not modeled by other flags. This does not return true
455 /// for instructions whose effects are captured by:
456 ///
457 /// 1. Their operand list and implicit definition/use list. Register use/def
458 /// info is explicit for instructions.
459 /// 2. Memory accesses. Use mayLoad/mayStore.
460 /// 3. Calling, branching, returning: use isCall/isReturn/isBranch.
461 ///
462 /// Examples of side effects would be modifying 'invisible' machine state like
463 /// a control register, flushing a cache, modifying a register invisible to
464 /// LLVM, etc.
466 return Flags & (1ULL << MCID::UnmodeledSideEffects);
467 }
468
469 //===--------------------------------------------------------------------===//
470 // Flags that indicate whether an instruction can be modified by a method.
471 //===--------------------------------------------------------------------===//
472
473 /// Return true if this may be a 2- or 3-address instruction (of the
474 /// form "X = op Y, Z, ..."), which produces the same result if Y and Z are
475 /// exchanged. If this flag is set, then the
476 /// TargetInstrInfo::commuteInstruction method may be used to hack on the
477 /// instruction.
478 ///
479 /// Note that this flag may be set on instructions that are only commutable
480 /// sometimes. In these cases, the call to commuteInstruction will fail.
481 /// Also note that some instructions require non-trivial modification to
482 /// commute them.
483 bool isCommutable() const { return Flags & (1ULL << MCID::Commutable); }
484
485 /// Return true if this is a 2-address instruction which can be changed
486 /// into a 3-address instruction if needed. Doing this transformation can be
487 /// profitable in the register allocator, because it means that the
488 /// instruction can use a 2-address form if possible, but degrade into a less
489 /// efficient form if the source and dest register cannot be assigned to the
490 /// same register. For example, this allows the x86 backend to turn a "shl
491 /// reg, 3" instruction into an LEA instruction, which is the same speed as
492 /// the shift but has bigger code size.
493 ///
494 /// If this returns true, then the target must implement the
495 /// TargetInstrInfo::convertToThreeAddress method for this instruction, which
496 /// is allowed to fail if the transformation isn't valid for this specific
497 /// instruction (e.g. shl reg, 4 on x86).
498 ///
499 bool isConvertibleTo3Addr() const {
500 return Flags & (1ULL << MCID::ConvertibleTo3Addr);
501 }
502
503 /// Return true if this instruction requires custom insertion support
504 /// when the DAG scheduler is inserting it into a machine basic block. If
505 /// this is true for the instruction, it basically means that it is a pseudo
506 /// instruction used at SelectionDAG time that is expanded out into magic code
507 /// by the target when MachineInstrs are formed.
508 ///
509 /// If this is true, the TargetLoweringInfo::InsertAtEndOfBasicBlock method
510 /// is used to insert this into the MachineBasicBlock.
512 return Flags & (1ULL << MCID::UsesCustomInserter);
513 }
514
515 /// Return true if this instruction requires *adjustment* after
516 /// instruction selection by calling a target hook. For example, this can be
517 /// used to fill in ARM 's' optional operand depending on whether the
518 /// conditional flag register is used.
519 bool hasPostISelHook() const { return Flags & (1ULL << MCID::HasPostISelHook); }
520
521 /// Returns true if this instruction is a candidate for remat. This
522 /// flag is only used in TargetInstrInfo method isTriviallyRematerializable.
523 ///
524 /// If this flag is set, the isReallyTriviallyReMaterializable() method is
525 /// called to verify the instruction is really rematerializable.
526 bool isRematerializable() const {
527 return Flags & (1ULL << MCID::Rematerializable);
528 }
529
530 /// Returns true if this instruction has the same cost (or less) than a
531 /// move instruction. This is useful during certain types of optimizations
532 /// (e.g., remat during two-address conversion or machine licm) where we would
533 /// like to remat or hoist the instruction, but not if it costs more than
534 /// moving the instruction into the appropriate register. Note, we are not
535 /// marking copies from and to the same register class with this flag.
536 ///
537 /// This method could be called by interface TargetInstrInfo::isAsCheapAsAMove
538 /// for different subtargets.
539 bool isAsCheapAsAMove() const { return Flags & (1ULL << MCID::CheapAsAMove); }
540
541 /// Returns true if this instruction source operands have special
542 /// register allocation requirements that are not captured by the operand
543 /// register classes. e.g. ARM::STRD's two source registers must be an even /
544 /// odd pair, ARM::STM registers have to be in ascending order. Post-register
545 /// allocation passes should not attempt to change allocations for sources of
546 /// instructions with this flag.
548 return Flags & (1ULL << MCID::ExtraSrcRegAllocReq);
549 }
550
551 /// Returns true if this instruction def operands have special register
552 /// allocation requirements that are not captured by the operand register
553 /// classes. e.g. ARM::LDRD's two def registers must be an even / odd pair,
554 /// ARM::LDM registers have to be in ascending order. Post-register
555 /// allocation passes should not attempt to change allocations for definitions
556 /// of instructions with this flag.
558 return Flags & (1ULL << MCID::ExtraDefRegAllocReq);
559 }
560
561 /// Return a list of registers that are potentially read by any
562 /// instance of this machine instruction. For example, on X86, the "adc"
563 /// instruction adds two register operands and adds the carry bit in from the
564 /// flags register. In this case, the instruction is marked as implicitly
565 /// reading the flags. Likewise, the variable shift instruction on X86 is
566 /// marked as implicitly reading the 'CL' register, which it always does.
568 auto ImplicitOps =
569 reinterpret_cast<const MCPhysReg *>(this + Opcode + 1) + ImplicitOffset;
570 return {ImplicitOps, NumImplicitUses};
571 }
572
573 /// Return a list of registers that are potentially written by any
574 /// instance of this machine instruction. For example, on X86, many
575 /// instructions implicitly set the flags register. In this case, they are
576 /// marked as setting the FLAGS. Likewise, many instructions always deposit
577 /// their result in a physical register. For example, the X86 divide
578 /// instruction always deposits the quotient and remainder in the EAX/EDX
579 /// registers. For that instruction, this will return a list containing the
580 /// EAX/EDX/EFLAGS registers.
582 auto ImplicitOps =
583 reinterpret_cast<const MCPhysReg *>(this + Opcode + 1) + ImplicitOffset;
584 return {ImplicitOps + NumImplicitUses, NumImplicitDefs};
585 }
586
587 /// Return true if this instruction implicitly
588 /// uses the specified physical register.
590 return is_contained(implicit_uses(), Reg);
591 }
592
593 /// Return true if this instruction implicitly
594 /// defines the specified physical register.
595 LLVM_ABI bool
597 const MCRegisterInfo *MRI = nullptr) const;
598
599 /// Return the scheduling class for this instruction. The
600 /// scheduling class is an index into the InstrItineraryData table. This
601 /// returns zero if there is no known scheduling information for the
602 /// instruction.
603 unsigned getSchedClass() const { return SchedClass; }
604
605 /// Return the number of bytes in the encoding of this instruction,
606 /// or zero if the encoding size cannot be known from the opcode.
607 unsigned getSize() const { return Size; }
608
609 /// Find the index of the first operand in the
610 /// operand list that is used to represent the predicate. It returns -1 if
611 /// none is found.
613 if (isPredicable()) {
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 /// Return true if this instruction defines the specified physical
622 /// register, either explicitly or implicitly.
624 const MCRegisterInfo &RI) const;
625};
626
627} // end namespace llvm
628
629#endif
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition: Compiler.h:213
IRTranslator LLVM IR MI
Register Reg
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:188
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
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
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...
Definition: MCInstrDesc.cpp:40
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.
Definition: MCInstrDesc.cpp:20
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.
Definition: MCInstrDesc.cpp:32
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 isLookupPtrRegClass() const
Set if this operand is a pointer value and it requires a callback 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.
Definition: MCRegister.h:33
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:149
@ ExtraDefRegAllocReq
Definition: MCInstrDesc.h:182
@ VariadicOpsAreDefs
Definition: MCInstrDesc.h:189
@ ConvertibleTo3Addr
Definition: MCInstrDesc.h:176
@ MayRaiseFPException
Definition: MCInstrDesc.h:171
@ Rematerializable
Definition: MCInstrDesc.h:179
@ ExtraSrcRegAllocReq
Definition: MCInstrDesc.h:181
@ UsesCustomInserter
Definition: MCInstrDesc.h:177
@ UnmodeledSideEffects
Definition: MCInstrDesc.h:174
OperandFlags
These are flags set on operands, but should be considered private, all access should go through the M...
Definition: MCInstrDesc.h:51
@ LookupPtrRegClass
Definition: MCInstrDesc.h:52
OperandConstraint
Operand constraints.
Definition: MCInstrDesc.h:36
OperandType
Operands are tagged with one of the values of this enum.
Definition: MCInstrDesc.h:59
@ OPERAND_GENERIC_4
Definition: MCInstrDesc.h:71
@ 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.
Definition: AddressRanges.h:18
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition: STLExtras.h:1916