14#ifndef LLVM_CODEGEN_GLOBALISEL_GENERICMACHINEINSTRS_H
15#define LLVM_CODEGEN_GLOBALISEL_GENERICMACHINEINSTRS_H
90 switch (
MI->getOpcode()) {
91 case TargetOpcode::G_LOAD:
92 case TargetOpcode::G_STORE:
93 case TargetOpcode::G_ZEXTLOAD:
94 case TargetOpcode::G_SEXTLOAD:
120 return MI->getOpcode() == TargetOpcode::G_INDEXED_LOAD;
128 return MI->getOpcode() == TargetOpcode::G_INDEXED_SEXTLOAD ||
129 MI->getOpcode() == TargetOpcode::G_INDEXED_ZEXTLOAD;
137 switch (
MI->getOpcode()) {
138 case TargetOpcode::G_INDEXED_LOAD:
139 case TargetOpcode::G_INDEXED_ZEXTLOAD:
140 case TargetOpcode::G_INDEXED_SEXTLOAD:
152 return MI->getOpcode() == TargetOpcode::G_INDEXED_ZEXTLOAD;
160 return MI->getOpcode() == TargetOpcode::G_INDEXED_SEXTLOAD;
180 return MI->getOpcode() == TargetOpcode::G_INDEXED_STORE;
196 switch (
MI->getOpcode()) {
197 case TargetOpcode::G_LOAD:
198 case TargetOpcode::G_ZEXTLOAD:
199 case TargetOpcode::G_SEXTLOAD:
211 return MI->getOpcode() == TargetOpcode::G_LOAD;
219 return MI->getOpcode() == TargetOpcode::G_SEXTLOAD ||
220 MI->getOpcode() == TargetOpcode::G_ZEXTLOAD;
228 return MI->getOpcode() == TargetOpcode::G_SEXTLOAD;
236 return MI->getOpcode() == TargetOpcode::G_ZEXTLOAD;
247 return MI->getOpcode() == TargetOpcode::G_STORE;
260 return MI->getOpcode() == TargetOpcode::G_UNMERGE_VALUES;
275 switch (
MI->getOpcode()) {
276 case TargetOpcode::G_MERGE_VALUES:
277 case TargetOpcode::G_CONCAT_VECTORS:
278 case TargetOpcode::G_BUILD_VECTOR:
290 return MI->getOpcode() == TargetOpcode::G_MERGE_VALUES;
298 return MI->getOpcode() == TargetOpcode::G_CONCAT_VECTORS;
306 return MI->getOpcode() == TargetOpcode::G_BUILD_VECTOR;
314 return MI->getOpcode() == TargetOpcode::G_BUILD_VECTOR_TRUNC;
326 return MI->getOpcode() == TargetOpcode::G_SHUFFLE_VECTOR;
337 return MI->getOpcode() == TargetOpcode::G_PTR_ADD;
345 return MI->getOpcode() == TargetOpcode::G_IMPLICIT_DEF;
357 return MI->getOpcode() == TargetOpcode::G_SELECT;
371 return MI->getOpcode() == TargetOpcode::G_ICMP ||
372 MI->getOpcode() == TargetOpcode::G_FCMP;
380 return MI->getOpcode() == TargetOpcode::G_ICMP;
388 return MI->getOpcode() == TargetOpcode::G_FCMP;
407 switch (
MI->getOpcode()) {
408 case TargetOpcode::G_UADDO:
409 case TargetOpcode::G_SADDO:
410 case TargetOpcode::G_USUBO:
411 case TargetOpcode::G_SSUBO:
412 case TargetOpcode::G_UADDE:
413 case TargetOpcode::G_SADDE:
414 case TargetOpcode::G_USUBE:
415 case TargetOpcode::G_SSUBE:
416 case TargetOpcode::G_UMULO:
417 case TargetOpcode::G_SMULO:
434 case TargetOpcode::G_UADDO:
435 case TargetOpcode::G_SADDO:
436 case TargetOpcode::G_UADDE:
437 case TargetOpcode::G_SADDE:
447 case TargetOpcode::G_SADDO:
448 case TargetOpcode::G_SSUBO:
449 case TargetOpcode::G_SADDE:
450 case TargetOpcode::G_SSUBE:
459 switch (
MI->getOpcode()) {
460 case TargetOpcode::G_UADDO:
461 case TargetOpcode::G_SADDO:
462 case TargetOpcode::G_USUBO:
463 case TargetOpcode::G_SSUBO:
464 case TargetOpcode::G_UADDE:
465 case TargetOpcode::G_SADDE:
466 case TargetOpcode::G_USUBE:
467 case TargetOpcode::G_SSUBE:
482 switch (
MI->getOpcode()) {
483 case TargetOpcode::G_UADDO:
484 case TargetOpcode::G_SADDO:
499 switch (
MI->getOpcode()) {
500 case TargetOpcode::G_USUBO:
501 case TargetOpcode::G_SSUBO:
516 switch (
MI->getOpcode()) {
517 case TargetOpcode::G_UADDE:
518 case TargetOpcode::G_SADDE:
519 case TargetOpcode::G_USUBE:
520 case TargetOpcode::G_SSUBE:
539 case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS:
540 case TargetOpcode::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS:
549 case TargetOpcode::G_INTRINSIC_CONVERGENT:
550 case TargetOpcode::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS:
558 switch (
MI->getOpcode()) {
559 case TargetOpcode::G_INTRINSIC:
560 case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS:
561 case TargetOpcode::G_INTRINSIC_CONVERGENT:
562 case TargetOpcode::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS:
574 switch (
MI->getOpcode()) {
575 case TargetOpcode::G_VECREDUCE_FADD:
576 case TargetOpcode::G_VECREDUCE_FMUL:
577 case TargetOpcode::G_VECREDUCE_FMAX:
578 case TargetOpcode::G_VECREDUCE_FMIN:
579 case TargetOpcode::G_VECREDUCE_FMAXIMUM:
580 case TargetOpcode::G_VECREDUCE_FMINIMUM:
581 case TargetOpcode::G_VECREDUCE_ADD:
582 case TargetOpcode::G_VECREDUCE_MUL:
583 case TargetOpcode::G_VECREDUCE_AND:
584 case TargetOpcode::G_VECREDUCE_OR:
585 case TargetOpcode::G_VECREDUCE_XOR:
586 case TargetOpcode::G_VECREDUCE_SMAX:
587 case TargetOpcode::G_VECREDUCE_SMIN:
588 case TargetOpcode::G_VECREDUCE_UMAX:
589 case TargetOpcode::G_VECREDUCE_UMIN:
601 case TargetOpcode::G_VECREDUCE_FADD:
602 ScalarOpc = TargetOpcode::G_FADD;
604 case TargetOpcode::G_VECREDUCE_FMUL:
605 ScalarOpc = TargetOpcode::G_FMUL;
607 case TargetOpcode::G_VECREDUCE_FMAX:
608 ScalarOpc = TargetOpcode::G_FMAXNUM;
610 case TargetOpcode::G_VECREDUCE_FMIN:
611 ScalarOpc = TargetOpcode::G_FMINNUM;
613 case TargetOpcode::G_VECREDUCE_FMAXIMUM:
614 ScalarOpc = TargetOpcode::G_FMAXIMUM;
616 case TargetOpcode::G_VECREDUCE_FMINIMUM:
617 ScalarOpc = TargetOpcode::G_FMINIMUM;
619 case TargetOpcode::G_VECREDUCE_ADD:
620 ScalarOpc = TargetOpcode::G_ADD;
622 case TargetOpcode::G_VECREDUCE_MUL:
623 ScalarOpc = TargetOpcode::G_MUL;
625 case TargetOpcode::G_VECREDUCE_AND:
626 ScalarOpc = TargetOpcode::G_AND;
628 case TargetOpcode::G_VECREDUCE_OR:
629 ScalarOpc = TargetOpcode::G_OR;
631 case TargetOpcode::G_VECREDUCE_XOR:
632 ScalarOpc = TargetOpcode::G_XOR;
634 case TargetOpcode::G_VECREDUCE_SMAX:
635 ScalarOpc = TargetOpcode::G_SMAX;
637 case TargetOpcode::G_VECREDUCE_SMIN:
638 ScalarOpc = TargetOpcode::G_SMIN;
640 case TargetOpcode::G_VECREDUCE_UMAX:
641 ScalarOpc = TargetOpcode::G_UMAX;
643 case TargetOpcode::G_VECREDUCE_UMIN:
644 ScalarOpc = TargetOpcode::G_UMIN;
668 return MI->getOpcode() == TargetOpcode::G_PHI;
679 switch (
MI->getOpcode()) {
681 case TargetOpcode::G_ADD:
682 case TargetOpcode::G_SUB:
683 case TargetOpcode::G_MUL:
684 case TargetOpcode::G_SDIV:
685 case TargetOpcode::G_UDIV:
686 case TargetOpcode::G_SREM:
687 case TargetOpcode::G_UREM:
688 case TargetOpcode::G_SMIN:
689 case TargetOpcode::G_SMAX:
690 case TargetOpcode::G_UMIN:
691 case TargetOpcode::G_UMAX:
693 case TargetOpcode::G_FMINNUM:
694 case TargetOpcode::G_FMAXNUM:
695 case TargetOpcode::G_FMINNUM_IEEE:
696 case TargetOpcode::G_FMAXNUM_IEEE:
697 case TargetOpcode::G_FMINIMUM:
698 case TargetOpcode::G_FMAXIMUM:
699 case TargetOpcode::G_FADD:
700 case TargetOpcode::G_FSUB:
701 case TargetOpcode::G_FMUL:
702 case TargetOpcode::G_FDIV:
703 case TargetOpcode::G_FPOW:
705 case TargetOpcode::G_AND:
706 case TargetOpcode::G_OR:
707 case TargetOpcode::G_XOR:
719 switch (
MI->getOpcode()) {
720 case TargetOpcode::G_ADD:
721 case TargetOpcode::G_SUB:
722 case TargetOpcode::G_MUL:
723 case TargetOpcode::G_SDIV:
724 case TargetOpcode::G_UDIV:
725 case TargetOpcode::G_SREM:
726 case TargetOpcode::G_UREM:
727 case TargetOpcode::G_SMIN:
728 case TargetOpcode::G_SMAX:
729 case TargetOpcode::G_UMIN:
730 case TargetOpcode::G_UMAX:
742 switch (
MI->getOpcode()) {
743 case TargetOpcode::G_FMINNUM:
744 case TargetOpcode::G_FMAXNUM:
745 case TargetOpcode::G_FMINNUM_IEEE:
746 case TargetOpcode::G_FMAXNUM_IEEE:
747 case TargetOpcode::G_FMINIMUM:
748 case TargetOpcode::G_FMAXIMUM:
749 case TargetOpcode::G_FADD:
750 case TargetOpcode::G_FSUB:
751 case TargetOpcode::G_FMUL:
752 case TargetOpcode::G_FDIV:
753 case TargetOpcode::G_FPOW:
765 switch (
MI->getOpcode()) {
766 case TargetOpcode::G_AND:
767 case TargetOpcode::G_OR:
768 case TargetOpcode::G_XOR:
780 return MI->getOpcode() == TargetOpcode::G_ADD;
788 return MI->getOpcode() == TargetOpcode::G_AND;
796 return MI->getOpcode() == TargetOpcode::G_OR;
807 return MI->getOpcode() == TargetOpcode::G_EXTRACT_VECTOR_ELT;
819 return MI->getOpcode() == TargetOpcode::G_INSERT_VECTOR_ELT;
830 return MI->getOpcode() == TargetOpcode::G_EXTRACT_SUBVECTOR;
842 return MI->getOpcode() == TargetOpcode::G_INSERT_SUBVECTOR;
852 return MI->getOpcode() == TargetOpcode::G_FREEZE;
864 switch (
MI->getOpcode()) {
865 case TargetOpcode::G_ADDRSPACE_CAST:
866 case TargetOpcode::G_FPEXT:
867 case TargetOpcode::G_FPTOSI:
868 case TargetOpcode::G_FPTOUI:
869 case TargetOpcode::G_FPTOSI_SAT:
870 case TargetOpcode::G_FPTOUI_SAT:
871 case TargetOpcode::G_FPTRUNC:
872 case TargetOpcode::G_INTTOPTR:
873 case TargetOpcode::G_PTRTOINT:
874 case TargetOpcode::G_SEXT:
875 case TargetOpcode::G_SITOFP:
876 case TargetOpcode::G_TRUNC:
877 case TargetOpcode::G_TRUNC_SSAT_S:
878 case TargetOpcode::G_TRUNC_SSAT_U:
879 case TargetOpcode::G_TRUNC_USAT_U:
880 case TargetOpcode::G_UITOFP:
881 case TargetOpcode::G_ZEXT:
882 case TargetOpcode::G_ANYEXT:
894 return MI->getOpcode() == TargetOpcode::G_SEXT;
902 return MI->getOpcode() == TargetOpcode::G_ZEXT;
910 return MI->getOpcode() == TargetOpcode::G_ANYEXT;
918 return MI->getOpcode() == TargetOpcode::G_TRUNC;
928 return MI->getOpcode() == TargetOpcode::G_VSCALE;
940 return MI->getOpcode() == TargetOpcode::G_STEP_VECTOR;
948 return MI->getOpcode() == TargetOpcode::G_SUB;
956 return MI->getOpcode() == TargetOpcode::G_MUL;
967 return MI->getOpcode() == TargetOpcode::G_SHL;
980 switch (
MI->getOpcode()) {
981 case TargetOpcode::G_SCMP:
982 case TargetOpcode::G_UCMP:
994 switch (
MI->getOpcode()) {
995 case TargetOpcode::G_SEXT:
996 case TargetOpcode::G_ZEXT:
997 case TargetOpcode::G_ANYEXT:
1009 switch (
MI->getOpcode()) {
1010 case TargetOpcode::G_SEXT:
1011 case TargetOpcode::G_ZEXT:
1012 case TargetOpcode::G_ANYEXT:
1013 case TargetOpcode::G_TRUNC:
1027 return MI->getOpcode() == TargetOpcode::G_SPLAT_VECTOR;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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
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.
Align getAlign() const
Return the minimum known alignment in bytes of the actual memory reference.
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)
LLVM_ABI 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,...
LLVM_ABI Align getAlign() const
Return the minimum known alignment in bytes of the actual memory reference.
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.
This struct is a compact representation of a valid (non-zero power of two) alignment.