14#ifndef LLVM_CODEGEN_GLOBALISEL_GENERICMACHINEINSTRS_H
15#define LLVM_CODEGEN_GLOBALISEL_GENERICMACHINEINSTRS_H
87 switch (
MI->getOpcode()) {
88 case TargetOpcode::G_LOAD:
89 case TargetOpcode::G_STORE:
90 case TargetOpcode::G_ZEXTLOAD:
91 case TargetOpcode::G_SEXTLOAD:
117 return MI->getOpcode() == TargetOpcode::G_INDEXED_LOAD;
125 return MI->getOpcode() == TargetOpcode::G_INDEXED_SEXTLOAD ||
126 MI->getOpcode() == TargetOpcode::G_INDEXED_ZEXTLOAD;
134 switch (
MI->getOpcode()) {
135 case TargetOpcode::G_INDEXED_LOAD:
136 case TargetOpcode::G_INDEXED_ZEXTLOAD:
137 case TargetOpcode::G_INDEXED_SEXTLOAD:
149 return MI->getOpcode() == TargetOpcode::G_INDEXED_ZEXTLOAD;
157 return MI->getOpcode() == TargetOpcode::G_INDEXED_SEXTLOAD;
177 return MI->getOpcode() == TargetOpcode::G_INDEXED_STORE;
193 switch (
MI->getOpcode()) {
194 case TargetOpcode::G_LOAD:
195 case TargetOpcode::G_ZEXTLOAD:
196 case TargetOpcode::G_SEXTLOAD:
208 return MI->getOpcode() == TargetOpcode::G_LOAD;
216 return MI->getOpcode() == TargetOpcode::G_SEXTLOAD ||
217 MI->getOpcode() == TargetOpcode::G_ZEXTLOAD;
225 return MI->getOpcode() == TargetOpcode::G_SEXTLOAD;
233 return MI->getOpcode() == TargetOpcode::G_ZEXTLOAD;
244 return MI->getOpcode() == TargetOpcode::G_STORE;
257 return MI->getOpcode() == TargetOpcode::G_UNMERGE_VALUES;
272 switch (
MI->getOpcode()) {
273 case TargetOpcode::G_MERGE_VALUES:
274 case TargetOpcode::G_CONCAT_VECTORS:
275 case TargetOpcode::G_BUILD_VECTOR:
287 return MI->getOpcode() == TargetOpcode::G_MERGE_VALUES;
295 return MI->getOpcode() == TargetOpcode::G_CONCAT_VECTORS;
303 return MI->getOpcode() == TargetOpcode::G_BUILD_VECTOR;
311 return MI->getOpcode() == TargetOpcode::G_BUILD_VECTOR_TRUNC;
323 return MI->getOpcode() == TargetOpcode::G_SHUFFLE_VECTOR;
334 return MI->getOpcode() == TargetOpcode::G_PTR_ADD;
342 return MI->getOpcode() == TargetOpcode::G_IMPLICIT_DEF;
354 return MI->getOpcode() == TargetOpcode::G_SELECT;
368 return MI->getOpcode() == TargetOpcode::G_ICMP ||
369 MI->getOpcode() == TargetOpcode::G_FCMP;
377 return MI->getOpcode() == TargetOpcode::G_ICMP;
385 return MI->getOpcode() == TargetOpcode::G_FCMP;
404 switch (
MI->getOpcode()) {
405 case TargetOpcode::G_UADDO:
406 case TargetOpcode::G_SADDO:
407 case TargetOpcode::G_USUBO:
408 case TargetOpcode::G_SSUBO:
409 case TargetOpcode::G_UADDE:
410 case TargetOpcode::G_SADDE:
411 case TargetOpcode::G_USUBE:
412 case TargetOpcode::G_SSUBE:
413 case TargetOpcode::G_UMULO:
414 case TargetOpcode::G_SMULO:
431 case TargetOpcode::G_UADDO:
432 case TargetOpcode::G_SADDO:
433 case TargetOpcode::G_UADDE:
434 case TargetOpcode::G_SADDE:
444 case TargetOpcode::G_SADDO:
445 case TargetOpcode::G_SSUBO:
446 case TargetOpcode::G_SADDE:
447 case TargetOpcode::G_SSUBE:
456 switch (
MI->getOpcode()) {
457 case TargetOpcode::G_UADDO:
458 case TargetOpcode::G_SADDO:
459 case TargetOpcode::G_USUBO:
460 case TargetOpcode::G_SSUBO:
461 case TargetOpcode::G_UADDE:
462 case TargetOpcode::G_SADDE:
463 case TargetOpcode::G_USUBE:
464 case TargetOpcode::G_SSUBE:
479 switch (
MI->getOpcode()) {
480 case TargetOpcode::G_UADDO:
481 case TargetOpcode::G_SADDO:
496 switch (
MI->getOpcode()) {
497 case TargetOpcode::G_UADDE:
498 case TargetOpcode::G_SADDE:
499 case TargetOpcode::G_USUBE:
500 case TargetOpcode::G_SSUBE:
519 case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS:
520 case TargetOpcode::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS:
529 case TargetOpcode::G_INTRINSIC_CONVERGENT:
530 case TargetOpcode::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS:
538 switch (
MI->getOpcode()) {
539 case TargetOpcode::G_INTRINSIC:
540 case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS:
541 case TargetOpcode::G_INTRINSIC_CONVERGENT:
542 case TargetOpcode::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS:
554 switch (
MI->getOpcode()) {
555 case TargetOpcode::G_VECREDUCE_FADD:
556 case TargetOpcode::G_VECREDUCE_FMUL:
557 case TargetOpcode::G_VECREDUCE_FMAX:
558 case TargetOpcode::G_VECREDUCE_FMIN:
559 case TargetOpcode::G_VECREDUCE_FMAXIMUM:
560 case TargetOpcode::G_VECREDUCE_FMINIMUM:
561 case TargetOpcode::G_VECREDUCE_ADD:
562 case TargetOpcode::G_VECREDUCE_MUL:
563 case TargetOpcode::G_VECREDUCE_AND:
564 case TargetOpcode::G_VECREDUCE_OR:
565 case TargetOpcode::G_VECREDUCE_XOR:
566 case TargetOpcode::G_VECREDUCE_SMAX:
567 case TargetOpcode::G_VECREDUCE_SMIN:
568 case TargetOpcode::G_VECREDUCE_UMAX:
569 case TargetOpcode::G_VECREDUCE_UMIN:
581 case TargetOpcode::G_VECREDUCE_FADD:
582 ScalarOpc = TargetOpcode::G_FADD;
584 case TargetOpcode::G_VECREDUCE_FMUL:
585 ScalarOpc = TargetOpcode::G_FMUL;
587 case TargetOpcode::G_VECREDUCE_FMAX:
588 ScalarOpc = TargetOpcode::G_FMAXNUM;
590 case TargetOpcode::G_VECREDUCE_FMIN:
591 ScalarOpc = TargetOpcode::G_FMINNUM;
593 case TargetOpcode::G_VECREDUCE_FMAXIMUM:
594 ScalarOpc = TargetOpcode::G_FMAXIMUM;
596 case TargetOpcode::G_VECREDUCE_FMINIMUM:
597 ScalarOpc = TargetOpcode::G_FMINIMUM;
599 case TargetOpcode::G_VECREDUCE_ADD:
600 ScalarOpc = TargetOpcode::G_ADD;
602 case TargetOpcode::G_VECREDUCE_MUL:
603 ScalarOpc = TargetOpcode::G_MUL;
605 case TargetOpcode::G_VECREDUCE_AND:
606 ScalarOpc = TargetOpcode::G_AND;
608 case TargetOpcode::G_VECREDUCE_OR:
609 ScalarOpc = TargetOpcode::G_OR;
611 case TargetOpcode::G_VECREDUCE_XOR:
612 ScalarOpc = TargetOpcode::G_XOR;
614 case TargetOpcode::G_VECREDUCE_SMAX:
615 ScalarOpc = TargetOpcode::G_SMAX;
617 case TargetOpcode::G_VECREDUCE_SMIN:
618 ScalarOpc = TargetOpcode::G_SMIN;
620 case TargetOpcode::G_VECREDUCE_UMAX:
621 ScalarOpc = TargetOpcode::G_UMAX;
623 case TargetOpcode::G_VECREDUCE_UMIN:
624 ScalarOpc = TargetOpcode::G_UMIN;
648 return MI->getOpcode() == TargetOpcode::G_PHI;
659 switch (
MI->getOpcode()) {
661 case TargetOpcode::G_ADD:
662 case TargetOpcode::G_SUB:
663 case TargetOpcode::G_MUL:
664 case TargetOpcode::G_SDIV:
665 case TargetOpcode::G_UDIV:
666 case TargetOpcode::G_SREM:
667 case TargetOpcode::G_UREM:
668 case TargetOpcode::G_SMIN:
669 case TargetOpcode::G_SMAX:
670 case TargetOpcode::G_UMIN:
671 case TargetOpcode::G_UMAX:
673 case TargetOpcode::G_FMINNUM:
674 case TargetOpcode::G_FMAXNUM:
675 case TargetOpcode::G_FMINNUM_IEEE:
676 case TargetOpcode::G_FMAXNUM_IEEE:
677 case TargetOpcode::G_FMINIMUM:
678 case TargetOpcode::G_FMAXIMUM:
679 case TargetOpcode::G_FADD:
680 case TargetOpcode::G_FSUB:
681 case TargetOpcode::G_FMUL:
682 case TargetOpcode::G_FDIV:
683 case TargetOpcode::G_FPOW:
685 case TargetOpcode::G_AND:
686 case TargetOpcode::G_OR:
687 case TargetOpcode::G_XOR:
699 switch (
MI->getOpcode()) {
700 case TargetOpcode::G_ADD:
701 case TargetOpcode::G_SUB:
702 case TargetOpcode::G_MUL:
703 case TargetOpcode::G_SDIV:
704 case TargetOpcode::G_UDIV:
705 case TargetOpcode::G_SREM:
706 case TargetOpcode::G_UREM:
707 case TargetOpcode::G_SMIN:
708 case TargetOpcode::G_SMAX:
709 case TargetOpcode::G_UMIN:
710 case TargetOpcode::G_UMAX:
722 switch (
MI->getOpcode()) {
723 case TargetOpcode::G_FMINNUM:
724 case TargetOpcode::G_FMAXNUM:
725 case TargetOpcode::G_FMINNUM_IEEE:
726 case TargetOpcode::G_FMAXNUM_IEEE:
727 case TargetOpcode::G_FMINIMUM:
728 case TargetOpcode::G_FMAXIMUM:
729 case TargetOpcode::G_FADD:
730 case TargetOpcode::G_FSUB:
731 case TargetOpcode::G_FMUL:
732 case TargetOpcode::G_FDIV:
733 case TargetOpcode::G_FPOW:
745 switch (
MI->getOpcode()) {
746 case TargetOpcode::G_AND:
747 case TargetOpcode::G_OR:
748 case TargetOpcode::G_XOR:
760 return MI->getOpcode() == TargetOpcode::G_ADD;
768 return MI->getOpcode() == TargetOpcode::G_AND;
776 return MI->getOpcode() == TargetOpcode::G_OR;
787 return MI->getOpcode() == TargetOpcode::G_EXTRACT_VECTOR_ELT;
799 return MI->getOpcode() == TargetOpcode::G_INSERT_VECTOR_ELT;
809 return MI->getOpcode() == TargetOpcode::G_FREEZE;
821 switch (
MI->getOpcode()) {
822 case TargetOpcode::G_ADDRSPACE_CAST:
823 case TargetOpcode::G_FPEXT:
824 case TargetOpcode::G_FPTOSI:
825 case TargetOpcode::G_FPTOUI:
826 case TargetOpcode::G_FPTRUNC:
827 case TargetOpcode::G_INTTOPTR:
828 case TargetOpcode::G_PTRTOINT:
829 case TargetOpcode::G_SEXT:
830 case TargetOpcode::G_SITOFP:
831 case TargetOpcode::G_TRUNC:
832 case TargetOpcode::G_UITOFP:
833 case TargetOpcode::G_ZEXT:
834 case TargetOpcode::G_ANYEXT:
846 return MI->getOpcode() == TargetOpcode::G_SEXT;
854 return MI->getOpcode() == TargetOpcode::G_ZEXT;
862 return MI->getOpcode() == TargetOpcode::G_TRUNC;
872 return MI->getOpcode() == TargetOpcode::G_VSCALE;
880 return MI->getOpcode() == TargetOpcode::G_SUB;
888 return MI->getOpcode() == TargetOpcode::G_MUL;
899 return MI->getOpcode() == TargetOpcode::G_SHL;
912 switch (
MI->getOpcode()) {
913 case TargetOpcode::G_SCMP:
914 case TargetOpcode::G_UCMP:
926 switch (
MI->getOpcode()) {
927 case TargetOpcode::G_SEXT:
928 case TargetOpcode::G_ZEXT:
929 case TargetOpcode::G_ANYEXT:
941 switch (
MI->getOpcode()) {
942 case TargetOpcode::G_SEXT:
943 case TargetOpcode::G_ZEXT:
944 case TargetOpcode::G_ANYEXT:
945 case TargetOpcode::G_TRUNC:
This file implements a class to represent arbitrary precision integral constant values and operations...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
const APInt & getValue() const
Return the constant as an APInt value reference.
Represents overflowing add operations.
static bool classof(const MachineInstr *MI)
Represents overflowing add/sub operations that also consume a carry-in.
Register getCarryInReg() const
static bool classof(const MachineInstr *MI)
Represents overflowing add/sub operations.
static bool classof(const MachineInstr *MI)
Represents an integer addition.
static bool classof(const MachineInstr *MI)
Represents a logical and.
static bool classof(const MachineInstr *MI)
Represent a G_ICMP or G_FCMP.
static bool classof(const MachineInstr *MI)
CmpInst::Predicate getCond() const
Register getLHSReg() const
Register getRHSReg() const
Represents any generic load, including sign/zero extending variants.
Register getDstReg() const
Get the definition register of the loaded value.
static bool classof(const MachineInstr *MI)
const MDNode * getRanges() const
Returns the Ranges that describes the dereference.
Represents overflowing binary operations.
MachineOperand & getRHS()
MachineOperand & getLHS()
Register getCarryOutReg() const
Register getDstReg() const
static bool classof(const MachineInstr *MI)
Register getRHSReg() const
Register getLHSReg() const
Represents a binary operation, i.e, x = y op z.
Register getLHSReg() const
static bool classof(const MachineInstr *MI)
Register getRHSReg() const
Represents a G_BUILD_VECTOR_TRUNC.
static bool classof(const MachineInstr *MI)
Represents a G_BUILD_VECTOR.
static bool classof(const MachineInstr *MI)
Represents a cast operation.
static bool classof(const MachineInstr *MI)
Register getSrcReg() const
Represents a G_CONCAT_VECTORS.
static bool classof(const MachineInstr *MI)
Represents either a G_SEXTLOAD or G_ZEXTLOAD.
static bool classof(const MachineInstr *MI)
Represents an integer-like extending operation.
static bool classof(const MachineInstr *MI)
Represents an integer-like extending or truncating operation.
static bool classof(const MachineInstr *MI)
Represents a floating point binary operation.
static bool classof(const MachineInstr *MI)
static bool classof(const MachineInstr *MI)
Register getSourceReg() const
static bool classof(const MachineInstr *MI)
static bool classof(const MachineInstr *MI)
Represents a G_IMPLICIT_DEF.
static bool classof(const MachineInstr *MI)
Represents either G_INDEXED_LOAD, G_INDEXED_ZEXTLOAD or G_INDEXED_SEXTLOAD.
static bool classof(const MachineInstr *MI)
Represents a G_INDEX_ZEXTLOAD/G_INDEXED_SEXTLOAD.
static bool classof(const MachineInstr *MI)
Represents indexed loads.
static bool classof(const MachineInstr *MI)
Register getOffsetReg() const
Get the offset register of the pointer value.
Register getWritebackReg() const
Get the def register of the writeback value.
Register getDstReg() const
Get the definition register of the loaded value.
Register getBaseReg() const
Get the base register of the pointer value.
static bool classof(const MachineInstr *MI)
Represents indexed stores.
Register getOffsetReg() const
Get the offset register of the pointer value.
Register getValueReg() const
Get the stored value register.
Register getBaseReg() const
Get the base register of the pointer value.
static bool classof(const MachineInstr *MI)
Register getWritebackReg() const
Get the def register of the writeback value.
static bool classof(const MachineInstr *MI)
Represents an insert vector element.
Register getVectorReg() const
Register getIndexReg() const
Register getElementReg() const
static bool classof(const MachineInstr *MI)
Represents an integer binary operation.
static bool classof(const MachineInstr *MI)
Represents a call to an intrinsic.
bool isConvergent() const
Intrinsic::ID getIntrinsicID() const
bool is(Intrinsic::ID ID) const
static bool classof(const MachineInstr *MI)
bool hasSideEffects() const
Represents any type of generic load or store.
Register getPointerReg() const
Get the source register of the pointer value.
static bool classof(const MachineInstr *MI)
static bool classof(const MachineInstr *MI)
Represents a logical binary operation.
static bool classof(const MachineInstr *MI)
Provides common memory operand functionality.
MachineMemOperand & getMMO() const
Get the MachineMemOperand on this instruction.
LocationSize getMemSize() const
Returns the size in bytes of the memory access.
bool isUnordered() const
Returns true if this memory operation doesn't have any ordering constraints other than normal aliasin...
bool isAtomic() const
Returns true if the attached MachineMemOperand has the atomic flag set.
bool isVolatile() const
Returns true if the attached MachineMemOpeand as the volatile flag set.
static bool classof(const MachineInstr *MI)
LocationSize getMemSizeInBits() const
Returns the size in bits of the memory access.
bool isSimple() const
Returns true if the memory operation is neither atomic or volatile.
Represents G_BUILD_VECTOR, G_CONCAT_VECTORS or G_MERGE_VALUES.
Register getSourceReg(unsigned I) const
Returns the I'th source register.
unsigned getNumSources() const
Returns the number of source registers.
static bool classof(const MachineInstr *MI)
Represents a G_MERGE_VALUES.
static bool classof(const MachineInstr *MI)
Represents an integer multiplication.
static bool classof(const MachineInstr *MI)
static bool classof(const MachineInstr *MI)
MachineBasicBlock * getIncomingBlock(unsigned I) const
Returns the I'th incoming basic block.
Register getIncomingValue(unsigned I) const
Returns the I'th incoming vreg.
static bool classof(const MachineInstr *MI)
unsigned getNumIncomingValues() const
Returns the number of incoming values.
Register getOffsetReg() const
static bool classof(const MachineInstr *MI)
Register getBaseReg() const
static bool classof(const MachineInstr *MI)
Represents a threeway compare.
Register getRHSReg() const
Register getLHSReg() const
static bool classof(const MachineInstr *MI)
Register getCondReg() const
static bool classof(const MachineInstr *MI)
Register getFalseReg() const
Register getTrueReg() const
static bool classof(const MachineInstr *MI)
Register getShiftReg() const
static bool classof(const MachineInstr *MI)
Register getSrcReg() const
Represents a G_SHUFFLE_VECTOR.
static bool classof(const MachineInstr *MI)
Register getSrc2Reg() const
Register getSrc1Reg() const
ArrayRef< int > getMask() const
static bool classof(const MachineInstr *MI)
Register getValueReg() const
Get the stored value register.
Represents an integer subtraction.
static bool classof(const MachineInstr *MI)
static bool classof(const MachineInstr *MI)
Represents a G_UNMERGE_VALUES.
unsigned getNumDefs() const
Returns the number of def registers.
static bool classof(const MachineInstr *MI)
Register getSourceReg() const
Get the unmerge source register.
static bool classof(const MachineInstr *MI)
unsigned getScalarOpcForReduction()
Get the opcode for the equivalent scalar operation for this reduction.
static bool classof(const MachineInstr *MI)
static bool classof(const MachineInstr *MI)
static bool classof(const MachineInstr *MI)
A base class for all GenericMachineInstrs.
static bool classof(const MachineInstr *MI)
Register getReg(unsigned Idx) const
Access the Idx'th operand as a register and return it.
bool hasPoisonGeneratingFlags() const
void dropPoisonGeneratingFlags()
GenericMachineInstr()=delete
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
unsigned getNumOperands() const
Retuns the total number of operands.
void clearFlags(unsigned flags)
unsigned getNumExplicitDefs() const
Returns the number of non-implicit definitions.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
const MachineOperand & getOperand(unsigned i) const
uint32_t getFlags() const
Return the MI flags bitvector.
A description of a memory reference used in the backend.
LocationSize getSize() const
Return the size in bytes of the memory reference.
bool isUnordered() const
Returns true if this memory operation doesn't have any ordering constraints other than normal aliasin...
const MDNode * getRanges() const
Return the range tag for the memory reference.
bool isAtomic() const
Returns true if this operation has an atomic ordering requirement of unordered or higher,...
LocationSize getSizeInBits() const
Return the size in bits of the memory reference.
MachineOperand class - Representation of each machine instruction operand.
const ConstantInt * getCImm() const
MachineBasicBlock * getMBB() const
ArrayRef< int > getShuffleMask() const
Register getReg() const
getReg - Returns the register number.
Intrinsic::ID getIntrinsicID() const
unsigned getPredicate() const
Wrapper class representing virtual and physical registers.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
bool isPreISelGenericOpcode(unsigned Opcode)
Check whether the given Opcode is a generic opcode that is not supposed to appear after ISel.