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_USUBO:
498 case TargetOpcode::G_SSUBO:
513 switch (
MI->getOpcode()) {
514 case TargetOpcode::G_UADDE:
515 case TargetOpcode::G_SADDE:
516 case TargetOpcode::G_USUBE:
517 case TargetOpcode::G_SSUBE:
536 case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS:
537 case TargetOpcode::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS:
546 case TargetOpcode::G_INTRINSIC_CONVERGENT:
547 case TargetOpcode::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS:
555 switch (
MI->getOpcode()) {
556 case TargetOpcode::G_INTRINSIC:
557 case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS:
558 case TargetOpcode::G_INTRINSIC_CONVERGENT:
559 case TargetOpcode::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS:
571 switch (
MI->getOpcode()) {
572 case TargetOpcode::G_VECREDUCE_FADD:
573 case TargetOpcode::G_VECREDUCE_FMUL:
574 case TargetOpcode::G_VECREDUCE_FMAX:
575 case TargetOpcode::G_VECREDUCE_FMIN:
576 case TargetOpcode::G_VECREDUCE_FMAXIMUM:
577 case TargetOpcode::G_VECREDUCE_FMINIMUM:
578 case TargetOpcode::G_VECREDUCE_ADD:
579 case TargetOpcode::G_VECREDUCE_MUL:
580 case TargetOpcode::G_VECREDUCE_AND:
581 case TargetOpcode::G_VECREDUCE_OR:
582 case TargetOpcode::G_VECREDUCE_XOR:
583 case TargetOpcode::G_VECREDUCE_SMAX:
584 case TargetOpcode::G_VECREDUCE_SMIN:
585 case TargetOpcode::G_VECREDUCE_UMAX:
586 case TargetOpcode::G_VECREDUCE_UMIN:
598 case TargetOpcode::G_VECREDUCE_FADD:
599 ScalarOpc = TargetOpcode::G_FADD;
601 case TargetOpcode::G_VECREDUCE_FMUL:
602 ScalarOpc = TargetOpcode::G_FMUL;
604 case TargetOpcode::G_VECREDUCE_FMAX:
605 ScalarOpc = TargetOpcode::G_FMAXNUM;
607 case TargetOpcode::G_VECREDUCE_FMIN:
608 ScalarOpc = TargetOpcode::G_FMINNUM;
610 case TargetOpcode::G_VECREDUCE_FMAXIMUM:
611 ScalarOpc = TargetOpcode::G_FMAXIMUM;
613 case TargetOpcode::G_VECREDUCE_FMINIMUM:
614 ScalarOpc = TargetOpcode::G_FMINIMUM;
616 case TargetOpcode::G_VECREDUCE_ADD:
617 ScalarOpc = TargetOpcode::G_ADD;
619 case TargetOpcode::G_VECREDUCE_MUL:
620 ScalarOpc = TargetOpcode::G_MUL;
622 case TargetOpcode::G_VECREDUCE_AND:
623 ScalarOpc = TargetOpcode::G_AND;
625 case TargetOpcode::G_VECREDUCE_OR:
626 ScalarOpc = TargetOpcode::G_OR;
628 case TargetOpcode::G_VECREDUCE_XOR:
629 ScalarOpc = TargetOpcode::G_XOR;
631 case TargetOpcode::G_VECREDUCE_SMAX:
632 ScalarOpc = TargetOpcode::G_SMAX;
634 case TargetOpcode::G_VECREDUCE_SMIN:
635 ScalarOpc = TargetOpcode::G_SMIN;
637 case TargetOpcode::G_VECREDUCE_UMAX:
638 ScalarOpc = TargetOpcode::G_UMAX;
640 case TargetOpcode::G_VECREDUCE_UMIN:
641 ScalarOpc = TargetOpcode::G_UMIN;
665 return MI->getOpcode() == TargetOpcode::G_PHI;
676 switch (
MI->getOpcode()) {
678 case TargetOpcode::G_ADD:
679 case TargetOpcode::G_SUB:
680 case TargetOpcode::G_MUL:
681 case TargetOpcode::G_SDIV:
682 case TargetOpcode::G_UDIV:
683 case TargetOpcode::G_SREM:
684 case TargetOpcode::G_UREM:
685 case TargetOpcode::G_SMIN:
686 case TargetOpcode::G_SMAX:
687 case TargetOpcode::G_UMIN:
688 case TargetOpcode::G_UMAX:
690 case TargetOpcode::G_FMINNUM:
691 case TargetOpcode::G_FMAXNUM:
692 case TargetOpcode::G_FMINNUM_IEEE:
693 case TargetOpcode::G_FMAXNUM_IEEE:
694 case TargetOpcode::G_FMINIMUM:
695 case TargetOpcode::G_FMAXIMUM:
696 case TargetOpcode::G_FADD:
697 case TargetOpcode::G_FSUB:
698 case TargetOpcode::G_FMUL:
699 case TargetOpcode::G_FDIV:
700 case TargetOpcode::G_FPOW:
702 case TargetOpcode::G_AND:
703 case TargetOpcode::G_OR:
704 case TargetOpcode::G_XOR:
716 switch (
MI->getOpcode()) {
717 case TargetOpcode::G_ADD:
718 case TargetOpcode::G_SUB:
719 case TargetOpcode::G_MUL:
720 case TargetOpcode::G_SDIV:
721 case TargetOpcode::G_UDIV:
722 case TargetOpcode::G_SREM:
723 case TargetOpcode::G_UREM:
724 case TargetOpcode::G_SMIN:
725 case TargetOpcode::G_SMAX:
726 case TargetOpcode::G_UMIN:
727 case TargetOpcode::G_UMAX:
739 switch (
MI->getOpcode()) {
740 case TargetOpcode::G_FMINNUM:
741 case TargetOpcode::G_FMAXNUM:
742 case TargetOpcode::G_FMINNUM_IEEE:
743 case TargetOpcode::G_FMAXNUM_IEEE:
744 case TargetOpcode::G_FMINIMUM:
745 case TargetOpcode::G_FMAXIMUM:
746 case TargetOpcode::G_FADD:
747 case TargetOpcode::G_FSUB:
748 case TargetOpcode::G_FMUL:
749 case TargetOpcode::G_FDIV:
750 case TargetOpcode::G_FPOW:
762 switch (
MI->getOpcode()) {
763 case TargetOpcode::G_AND:
764 case TargetOpcode::G_OR:
765 case TargetOpcode::G_XOR:
777 return MI->getOpcode() == TargetOpcode::G_ADD;
785 return MI->getOpcode() == TargetOpcode::G_AND;
793 return MI->getOpcode() == TargetOpcode::G_OR;
804 return MI->getOpcode() == TargetOpcode::G_EXTRACT_VECTOR_ELT;
816 return MI->getOpcode() == TargetOpcode::G_INSERT_VECTOR_ELT;
827 return MI->getOpcode() == TargetOpcode::G_EXTRACT_SUBVECTOR;
839 return MI->getOpcode() == TargetOpcode::G_INSERT_SUBVECTOR;
849 return MI->getOpcode() == TargetOpcode::G_FREEZE;
861 switch (
MI->getOpcode()) {
862 case TargetOpcode::G_ADDRSPACE_CAST:
863 case TargetOpcode::G_FPEXT:
864 case TargetOpcode::G_FPTOSI:
865 case TargetOpcode::G_FPTOUI:
866 case TargetOpcode::G_FPTOSI_SAT:
867 case TargetOpcode::G_FPTOUI_SAT:
868 case TargetOpcode::G_FPTRUNC:
869 case TargetOpcode::G_INTTOPTR:
870 case TargetOpcode::G_PTRTOINT:
871 case TargetOpcode::G_SEXT:
872 case TargetOpcode::G_SITOFP:
873 case TargetOpcode::G_TRUNC:
874 case TargetOpcode::G_UITOFP:
875 case TargetOpcode::G_ZEXT:
876 case TargetOpcode::G_ANYEXT:
888 return MI->getOpcode() == TargetOpcode::G_SEXT;
896 return MI->getOpcode() == TargetOpcode::G_ZEXT;
904 return MI->getOpcode() == TargetOpcode::G_ANYEXT;
912 return MI->getOpcode() == TargetOpcode::G_TRUNC;
922 return MI->getOpcode() == TargetOpcode::G_VSCALE;
934 return MI->getOpcode() == TargetOpcode::G_STEP_VECTOR;
942 return MI->getOpcode() == TargetOpcode::G_SUB;
950 return MI->getOpcode() == TargetOpcode::G_MUL;
961 return MI->getOpcode() == TargetOpcode::G_SHL;
974 switch (
MI->getOpcode()) {
975 case TargetOpcode::G_SCMP:
976 case TargetOpcode::G_UCMP:
988 switch (
MI->getOpcode()) {
989 case TargetOpcode::G_SEXT:
990 case TargetOpcode::G_ZEXT:
991 case TargetOpcode::G_ANYEXT:
1003 switch (
MI->getOpcode()) {
1004 case TargetOpcode::G_SEXT:
1005 case TargetOpcode::G_ZEXT:
1006 case TargetOpcode::G_ANYEXT:
1007 case TargetOpcode::G_TRUNC:
1021 return MI->getOpcode() == TargetOpcode::G_SPLAT_VECTOR;
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.
uint64_t getZExtValue() const
Get zero extended value.
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
static bool classof(const MachineInstr *MI)
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 a insert subvector.
Register getSubVec() const
Register getBigVec() const
uint64_t getIndexImm() const
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
Represents a splat vector.
Register getScalarReg() const
static bool classof(const MachineInstr *MI)
Represents a step vector.
static bool classof(const MachineInstr *MI)
static bool classof(const MachineInstr *MI)
Register getValueReg() const
Get the stored value register.
Represents overflowing sub operations.
static bool classof(const MachineInstr *MI)
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.