77 "print-whole-regmask",
78 cl::desc(
"Print the full contents of regmask operands in IR dumps"),
86 if (
getReg() == Reg)
return;
96 SmallContents.RegNo =
Reg;
102 SmallContents.RegNo =
Reg;
130 assert(
isReg() &&
"Wrong MachineOperand accessor");
131 assert((!Val || !
isDebug()) &&
"Marking a debug operation as def");
149 void MachineOperand::removeRegFromUses() {
150 if (!
isReg() || !isOnRegUseList())
156 MF->getRegInfo().removeRegOperandFromUseList(
this);
179 Contents.CFP = FPImm;
184 "Cannot change a tied operand into an external symbol");
189 Contents.OffsetedInfo.Val.SymbolName = SymName;
196 "Cannot change a tied operand into an MCSymbol");
206 "Cannot change a tied operand into a FrameIndex");
218 bool isKill,
bool isDead,
bool isUndef,
224 RegInfo = &MF->getRegInfo();
227 bool WasReg =
isReg();
228 if (RegInfo && WasReg)
233 SmallContents.RegNo =
Reg;
234 SubReg_TargetFlags = 0;
240 IsInternalRead =
false;
241 IsEarlyClobber =
false;
244 Contents.Reg.Prev =
nullptr;
295 if (RegMask == OtherRegMask)
301 unsigned RegMaskSize = (TRI->
getNumRegs() + 31) / 32;
304 return std::equal(RegMask, RegMask + RegMaskSize, OtherRegMask);
371 print(OS, DummyMST, TRI, IntrinsicInfo);
384 bool NeedComma =
false;
386 if (NeedComma) OS <<
',';
388 OS <<
"earlyclobber,";
403 if (NeedComma) OS <<
',';
408 if (NeedComma) OS <<
',';
413 if (NeedComma) OS <<
',';
418 if (NeedComma) OS <<
',';
423 if (NeedComma) OS <<
',';
431 case MachineOperand::MO_Immediate:
434 case MachineOperand::MO_CImmediate:
435 getCImm()->getValue().print(OS, false);
437 case MachineOperand::MO_FPImmediate:
438 if (getFPImm()->getType()->isFloatTy()) {
439 OS << getFPImm()->getValueAPF().convertToFloat();
440 } else if (getFPImm()->getType()->isHalfTy()) {
441 APFloat APF = getFPImm()->getValueAPF();
443 APF.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, &Unused);
444 OS << "half " << APF.convertToFloat();
445 } else if (getFPImm()->getType()->isFP128Ty()) {
446 APFloat APF = getFPImm()->getValueAPF();
448 getFPImm()->getValueAPF().toString(Str);
449 OS << "quad " << Str;
450 } else if (getFPImm()->getType()->isX86_FP80Ty()) {
451 APFloat APF = getFPImm()->getValueAPF();
452 OS << "x86_fp80 0xK";
453 APInt API = APF.bitcastToAPInt();
454 OS << format_hex_no_prefix(API.getHiBits(16).getZExtValue(), 4,
456 OS << format_hex_no_prefix(API.getLoBits(64).getZExtValue(), 16,
459 OS << getFPImm()->getValueAPF().convertToDouble();
462 case MachineOperand::MO_MachineBasicBlock:
463 OS << "<BB#" << getMBB()->getNumber() << ">";
465 case MachineOperand::MO_FrameIndex:
466 OS << "<fi#" << getIndex() << '>
';
468 case MachineOperand::MO_ConstantPoolIndex:
469 OS << "<cp#" << getIndex();
470 if (getOffset()) OS << "+" << getOffset();
473 case MachineOperand::MO_TargetIndex:
474 OS << "<ti#" << getIndex();
475 if (getOffset()) OS << "+" << getOffset();
478 case MachineOperand::MO_JumpTableIndex:
479 OS << "<jt#" << getIndex() << '>
';
481 case MachineOperand::MO_GlobalAddress:
483 getGlobal()->printAsOperand(OS, /*PrintType=*/false, MST);
484 if (getOffset()) OS << "+" << getOffset();
487 case MachineOperand::MO_ExternalSymbol:
488 OS << "<es:" << getSymbolName();
489 if (getOffset()) OS << "+" << getOffset();
492 case MachineOperand::MO_BlockAddress:
494 getBlockAddress()->printAsOperand(OS, /*PrintType=*/false, MST);
495 if (getOffset()) OS << "+" << getOffset();
498 case MachineOperand::MO_RegisterMask: {
499 unsigned NumRegsInMask = 0;
500 unsigned NumRegsEmitted = 0;
502 for (unsigned i = 0; i < TRI->getNumRegs(); ++i) {
503 unsigned MaskWord = i / 32;
504 unsigned MaskBit = i % 32;
505 if (getRegMask()[MaskWord] & (1 << MaskBit)) {
506 if (PrintWholeRegMask || NumRegsEmitted <= 10) {
507 OS << " " << PrintReg(i, TRI);
513 if (NumRegsEmitted != NumRegsInMask)
514 OS << " and " << (NumRegsInMask - NumRegsEmitted) << " more...";
518 case MachineOperand::MO_RegisterLiveOut:
519 OS << "<regliveout>";
521 case MachineOperand::MO_Metadata:
523 getMetadata()->printAsOperand(OS, MST);
526 case MachineOperand::MO_MCSymbol:
527 OS << "<MCSym=" << *getMCSymbol() << '>
';
529 case MachineOperand::MO_CFIIndex:
530 OS << "<call frame instruction>";
532 case MachineOperand::MO_IntrinsicID: {
533 Intrinsic::ID ID = getIntrinsicID();
534 if (ID < Intrinsic::num_intrinsics)
535 OS << "<intrinsic:@" << Intrinsic::getName(ID, None) << '>
';
536 else if (IntrinsicInfo)
537 OS << "<intrinsic:@" << IntrinsicInfo->getName(ID) << '>
';
539 OS << "<intrinsic:" << ID << '>
';
542 case MachineOperand::MO_Predicate: {
543 auto Pred = static_cast<CmpInst::Predicate>(getPredicate());
544 OS << '<
' << (CmpInst::isIntPredicate(Pred) ? "intpred" : "floatpred")
545 << CmpInst::getPredicateName(Pred) << '>
';
549 if (unsigned TF = getTargetFlags())
550 OS << "[TF=" << TF << ']
';
553 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
554 LLVM_DUMP_METHOD void MachineOperand::dump() const {
555 dbgs() << *this << '\n
';
559 //===----------------------------------------------------------------------===//
560 // MachineMemOperand Implementation
561 //===----------------------------------------------------------------------===//
565 unsigned MachinePointerInfo::getAddrSpace() const {
566 if (V.isNull() || V.is<const PseudoSourceValue*>()) return 0;
567 return cast<PointerType>(V.get<const Value*>()->getType())->getAddressSpace();
572 bool MachinePointerInfo::isDereferenceable(unsigned Size, LLVMContext &C,
573 const DataLayout &DL) const {
574 if (!V.is<const Value*>())
577 const Value *BasePtr = V.get<const Value*>();
578 if (BasePtr == nullptr)
581 return isDereferenceableAndAlignedPointer(
582 BasePtr, 1, APInt(DL.getPointerSizeInBits(), Offset + Size), DL);
587 MachinePointerInfo MachinePointerInfo::getConstantPool(MachineFunction &MF) {
588 return MachinePointerInfo(MF.getPSVManager().getConstantPool());
593 MachinePointerInfo MachinePointerInfo::getFixedStack(MachineFunction &MF,
594 int FI, int64_t Offset) {
595 return MachinePointerInfo(MF.getPSVManager().getFixedStack(FI), Offset);
598 MachinePointerInfo MachinePointerInfo::getJumpTable(MachineFunction &MF) {
599 return MachinePointerInfo(MF.getPSVManager().getJumpTable());
602 MachinePointerInfo MachinePointerInfo::getGOT(MachineFunction &MF) {
603 return MachinePointerInfo(MF.getPSVManager().getGOT());
606 MachinePointerInfo MachinePointerInfo::getStack(MachineFunction &MF,
608 return MachinePointerInfo(MF.getPSVManager().getStack(), Offset);
611 MachineMemOperand::MachineMemOperand(MachinePointerInfo ptrinfo, Flags f,
612 uint64_t s, unsigned int a,
613 const AAMDNodes &AAInfo,
614 const MDNode *Ranges,
616 AtomicOrdering Ordering,
617 AtomicOrdering FailureOrdering)
618 : PtrInfo(ptrinfo), Size(s), FlagVals(f), BaseAlignLog2(Log2_32(a) + 1),
619 AAInfo(AAInfo), Ranges(Ranges) {
620 assert((PtrInfo.V.isNull() || PtrInfo.V.is<const PseudoSourceValue*>() ||
621 isa<PointerType>(PtrInfo.V.get<const Value*>()->getType())) &&
622 "invalid pointer value");
623 assert(getBaseAlignment() == a && "Alignment is not a power of 2!");
624 assert((isLoad() || isStore()) && "Not a load/store!");
626 AtomicInfo.SSID = static_cast<unsigned>(SSID);
627 assert(getSyncScopeID() == SSID && "Value truncated");
628 AtomicInfo.Ordering = static_cast<unsigned>(Ordering);
629 assert(getOrdering() == Ordering && "Value truncated");
630 AtomicInfo.FailureOrdering = static_cast<unsigned>(FailureOrdering);
631 assert(getFailureOrdering() == FailureOrdering && "Value truncated");
636 void MachineMemOperand::Profile(FoldingSetNodeID &ID) const {
637 ID.AddInteger(getOffset());
639 ID.AddPointer(getOpaqueValue());
640 ID.AddInteger(getFlags());
641 ID.AddInteger(getBaseAlignment());
644 void MachineMemOperand::refineAlignment(const MachineMemOperand *MMO) {
645 // The Value and Offset may differ due to CSE. But the flags and size
646 // should be the same.
647 assert(MMO->getFlags() == getFlags() && "Flags mismatch!");
648 assert(MMO->getSize() == getSize() && "Size mismatch!");
650 if (MMO->getBaseAlignment() >= getBaseAlignment()) {
651 // Update the alignment value.
652 BaseAlignLog2 = Log2_32(MMO->getBaseAlignment()) + 1;
653 // Also update the base and offset, because the new alignment may
654 // not be applicable with the old ones.
655 PtrInfo = MMO->PtrInfo;
661 uint64_t MachineMemOperand::getAlignment() const {
662 return MinAlign(getBaseAlignment(), getOffset());
665 void MachineMemOperand::print(raw_ostream &OS) const {
666 ModuleSlotTracker DummyMST(nullptr);
669 void MachineMemOperand::print(raw_ostream &OS, ModuleSlotTracker &MST) const {
670 assert((isLoad() || isStore()) &&
671 "SV has to be a load, store or both.");
682 // Print the address information.
684 if (const Value *V = getValue())
685 V->printAsOperand(OS, /*PrintType=*/false, MST);
686 else if (const PseudoSourceValue *PSV = getPseudoValue())
687 PSV->printCustom(OS);
691 unsigned AS = getAddrSpace();
693 OS << "(addrspace=" << AS << ')
';
695 // If the alignment of the memory reference itself differs from the alignment
696 // of the base pointer, print the base alignment explicitly, next to the base
698 if (getBaseAlignment() != getAlignment())
699 OS << "(align=" << getBaseAlignment() << ")";
701 if (getOffset() != 0)
702 OS << "+" << getOffset();
705 // Print the alignment of the reference.
706 if (getBaseAlignment() != getAlignment() || getBaseAlignment() != getSize())
707 OS << "(align=" << getAlignment() << ")";
710 if (const MDNode *TBAAInfo = getAAInfo().TBAA) {
712 if (TBAAInfo->getNumOperands() > 0)
713 TBAAInfo->getOperand(0)->printAsOperand(OS, MST);
719 // Print AA scope info.
720 if (const MDNode *ScopeInfo = getAAInfo().Scope) {
721 OS << "(alias.scope=";
722 if (ScopeInfo->getNumOperands() > 0)
723 for (unsigned i = 0, ie = ScopeInfo->getNumOperands(); i != ie; ++i) {
724 ScopeInfo->getOperand(i)->printAsOperand(OS, MST);
733 // Print AA noalias scope info.
734 if (const MDNode *NoAliasInfo = getAAInfo().NoAlias) {
736 if (NoAliasInfo->getNumOperands() > 0)
737 for (unsigned i = 0, ie = NoAliasInfo->getNumOperands(); i != ie; ++i) {
738 NoAliasInfo->getOperand(i)->printAsOperand(OS, MST);
748 OS << "(nontemporal)";
749 if (isDereferenceable())
750 OS << "(dereferenceable)";
753 if (getFlags() & MOTargetFlag1)
755 if (getFlags() & MOTargetFlag2)
757 if (getFlags() & MOTargetFlag3)
761 //===----------------------------------------------------------------------===//
762 // MachineInstr Implementation
763 //===----------------------------------------------------------------------===//
765 void MachineInstr::addImplicitDefUseOperands(MachineFunction &MF) {
766 if (MCID->ImplicitDefs)
767 for (const MCPhysReg *ImpDefs = MCID->getImplicitDefs(); *ImpDefs;
769 addOperand(MF, MachineOperand::CreateReg(*ImpDefs, true, true));
770 if (MCID->ImplicitUses)
771 for (const MCPhysReg *ImpUses = MCID->getImplicitUses(); *ImpUses;
773 addOperand(MF, MachineOperand::CreateReg(*ImpUses, false, true));
779 MachineInstr::MachineInstr(MachineFunction &MF, const MCInstrDesc &tid,
780 DebugLoc dl, bool NoImp)
781 : MCID(&tid), debugLoc(std::move(dl)) {
782 assert(debugLoc.hasTrivialDestructor() && "Expected trivial destructor");
784 // Reserve space for the expected number of operands.
785 if (unsigned NumOps = MCID->getNumOperands() +
786 MCID->getNumImplicitDefs() + MCID->getNumImplicitUses()) {
787 CapOperands = OperandCapacity::get(NumOps);
788 Operands = MF.allocateOperandArray(CapOperands);
792 addImplicitDefUseOperands(MF);
797 MachineInstr::MachineInstr(MachineFunction &MF, const MachineInstr &MI)
798 : MCID(&MI.getDesc()), NumMemRefs(MI.NumMemRefs), MemRefs(MI.MemRefs),
799 debugLoc(MI.getDebugLoc()) {
800 assert(debugLoc.hasTrivialDestructor() && "Expected trivial destructor");
802 CapOperands = OperandCapacity::get(MI.getNumOperands());
803 Operands = MF.allocateOperandArray(CapOperands);
806 for (const MachineOperand &MO : MI.operands())
809 // Copy all the sensible flags.
816 MachineRegisterInfo *MachineInstr::getRegInfo() {
817 if (MachineBasicBlock *MBB = getParent())
818 return &MBB->getParent()->getRegInfo();
825 void MachineInstr::RemoveRegOperandsFromUseLists(MachineRegisterInfo &MRI) {
826 for (MachineOperand &MO : operands())
828 MRI.removeRegOperandFromUseList(&MO);
834 void MachineInstr::AddRegOperandsToUseLists(MachineRegisterInfo &MRI) {
835 for (MachineOperand &MO : operands())
837 MRI.addRegOperandToUseList(&MO);
840 void MachineInstr::addOperand(const MachineOperand &Op) {
841 MachineBasicBlock *MBB = getParent();
842 assert(MBB && "Use MachineInstrBuilder to add operands to dangling instrs");
843 MachineFunction *MF = MBB->getParent();
844 assert(MF && "Use MachineInstrBuilder to add operands to dangling instrs");
850 static void moveOperands(MachineOperand *Dst, MachineOperand *Src,
851 unsigned NumOps, MachineRegisterInfo *MRI) {
853 return MRI->moveOperands(Dst, Src, NumOps);
855 // MachineOperand is a trivially copyable type so we can just use memmove.
856 std::memmove(Dst, Src, NumOps * sizeof(MachineOperand));
863 void MachineInstr::addOperand(MachineFunction &MF, const MachineOperand &Op) {
864 assert(MCID && "Cannot add operands before providing an instr descriptor");
866 // Check if we're adding one of our existing operands.
867 if (&
Op >= Operands && &
Op < Operands + NumOperands) {
882 unsigned OpNo = getNumOperands();
883 bool isImpReg =
Op.isReg() &&
Op.isImplicit();
884 if (!isImpReg && !isInlineAsm()) {
885 while (OpNo && Operands[OpNo-1].
isReg() && Operands[OpNo-1].
isImplicit()) {
887 assert(!Operands[OpNo].
isTied() &&
"Cannot move tied operands");
896 assert((isImpReg ||
Op.isRegMask() || MCID->isVariadic() ||
897 OpNo < MCID->getNumOperands() || isMetaDataOp) &&
898 "Trying to add an operand to a machine instr that is already done!");
905 OperandCapacity OldCap = CapOperands;
907 if (!OldOperands || OldCap.getSize() == getNumOperands()) {
908 CapOperands = OldOperands ? OldCap.getNext() : OldCap.get(1);
909 Operands = MF.allocateOperandArray(CapOperands);
916 if (OpNo != NumOperands)
917 moveOperands(Operands + OpNo + 1, OldOperands + OpNo, NumOperands - OpNo,
922 if (OldOperands != Operands && OldOperands)
923 MF.deallocateOperandArray(OldCap, OldOperands);
927 NewMO->ParentMI =
this;
930 if (NewMO->
isReg()) {
932 NewMO->Contents.
Reg.Prev =
nullptr;
943 if (NewMO->
isUse()) {
944 int DefIdx = MCID->getOperandConstraint(OpNo,
MCOI::TIED_TO);
946 tieOperands(DefIdx, OpNo);
959 assert(OpNo < getNumOperands() &&
"Invalid operand number");
960 untieRegOperand(OpNo);
964 for (
unsigned i = OpNo + 1, e = getNumOperands(); i != e; ++i)
965 if (Operands[i].
isReg())
966 assert(!Operands[i].
isTied() &&
"Cannot move tied operands");
970 if (MRI && Operands[OpNo].
isReg())
977 if (
unsigned N = NumOperands - 1 - OpNo)
988 unsigned OldNumMemRefs = NumMemRefs;
990 unsigned NewNum = NumMemRefs + 1;
993 std::copy(OldMemRefs, OldMemRefs + OldNumMemRefs, NewMemRefs);
994 NewMemRefs[NewNum - 1] = MO;
995 setMemRefs(NewMemRefs, NewMemRefs + NewNum);
1003 if ((E1 - I1) != (E2 - I2))
1005 for (; I1 != E1; ++I1, ++I2) {
1012 std::pair<MachineInstr::mmo_iterator, unsigned>
1018 return std::make_pair(
nullptr, 0);
1025 return std::make_pair(MemRefs, NumMemRefs);
1029 size_t CombinedNumMemRefs = NumMemRefs + Other.NumMemRefs;
1034 if (CombinedNumMemRefs != uint8_t(CombinedNumMemRefs))
1035 return std::make_pair(
nullptr, 0);
1039 mmo_iterator MemEnd = std::copy(memoperands_begin(), memoperands_end(),
1046 return std::make_pair(MemBegin, CombinedNumMemRefs);
1049 bool MachineInstr::hasPropertyInBundle(
unsigned Mask, QueryType
Type)
const {
1050 assert(!isBundledWithPred() &&
"Must be called on bundle header");
1052 if (MII->getDesc().getFlags() &
Mask) {
1053 if (Type == AnyInBundle)
1056 if (Type == AllInBundle && !MII->isBundle())
1060 if (!MII->isBundledWithSucc())
1061 return Type == AllInBundle;
1077 assert(Other.
isBundle() &&
"Expected that both instructions are bundles.");
1082 while (I1->isBundledWithSucc() && I2->isBundledWithSucc()) {
1085 if (!I1->isIdenticalTo(*I2, Check))
1090 if (I1->isBundledWithSucc() || I2->isBundledWithSucc())
1095 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i) {
1108 if (Check == IgnoreDefs)
1110 else if (Check == IgnoreVRegDefs) {
1118 if (Check == CheckKillDead && MO.
isDead() != OMO.
isDead())
1124 if (Check == CheckKillDead && MO.
isKill() != OMO.
isKill())
1155 assert(MF &&
"Not embedded in a function!");
1161 if (!MO.isReg() || !MO.isDef())
1163 unsigned Reg = MO.getReg();
1179 unsigned NumOperands = MCID->getNumOperands();
1180 if (!MCID->isVariadic())
1183 for (
unsigned i = NumOperands, e = getNumOperands(); i != e; ++i) {
1192 assert(!isBundledWithPred() &&
"MI is already bundled with its predecessor");
1193 setFlag(BundledPred);
1196 assert(!Pred->isBundledWithSucc() &&
"Inconsistent bundle flags");
1197 Pred->setFlag(BundledSucc);
1201 assert(!isBundledWithSucc() &&
"MI is already bundled with its successor");
1202 setFlag(BundledSucc);
1205 assert(!Succ->isBundledWithPred() &&
"Inconsistent bundle flags");
1206 Succ->setFlag(BundledPred);
1210 assert(isBundledWithPred() &&
"MI isn't bundled with its predecessor");
1211 clearFlag(BundledPred);
1214 assert(Pred->isBundledWithSucc() &&
"Inconsistent bundle flags");
1215 Pred->clearFlag(BundledSucc);
1219 assert(isBundledWithSucc() &&
"MI isn't bundled with its successor");
1220 clearFlag(BundledSucc);
1223 assert(Succ->isBundledWithPred() &&
"Inconsistent bundle flags");
1224 Succ->clearFlag(BundledPred);
1228 if (isInlineAsm()) {
1237 assert(isInlineAsm() &&
"getInlineAsmDialect() only works for inline asms!");
1243 unsigned *GroupNo)
const {
1244 assert(isInlineAsm() &&
"Expected an inline asm instruction");
1245 assert(OpIdx < getNumOperands() &&
"OpIdx out of range");
1257 if (!FlagMO.
isImm())
1260 if (i + NumOps > OpIdx) {
1271 assert(isDebugValue() &&
"not a DBG_VALUE");
1272 return cast<DILocalVariable>(getOperand(2).getMetadata());
1276 assert(isDebugValue() &&
"not a DBG_VALUE");
1277 return cast<DIExpression>(getOperand(3).getMetadata());
1292 if (!getOperand(OpIdx).
isReg())
1297 if (getOperand(OpIdx).
isUse() && isRegTiedToDefOperand(OpIdx, &DefIdx))
1301 int FlagIdx = findInlineAsmFlagIdx(OpIdx);
1305 unsigned Flag = getOperand(FlagIdx).getImm();
1328 CurRC = OpndIt->getParent()->getRegClassConstraintEffectForVRegImpl(
1329 OpndIt.getOperandNo(),
Reg, CurRC,
TII, TRI);
1332 for (
unsigned i = 0, e = NumOperands; i < e && CurRC; ++i)
1333 CurRC = getRegClassConstraintEffectForVRegImpl(i, Reg, CurRC, TII, TRI);
1340 assert(CurRC &&
"Invalid initial register class");
1346 return getRegClassConstraintEffect(OpIdx, CurRC, TII, TRI);
1355 "Cannot get register constraints for non-register operand");
1356 assert(CurRC &&
"Invalid initial register class");
1372 while (I->isBundledWithSucc()) {
1382 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i) {
1395 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i) {
1399 unsigned MOReg = MO.
getReg();
1405 if (!isKill || MO.
isKill())
1414 std::pair<bool,bool>
1417 bool PartDef =
false;
1418 bool FullDef =
false;
1421 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i) {
1436 return std::make_pair(Use || (PartDef && !FullDef), PartDef || FullDef);
1447 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i) {
1455 unsigned MOReg = MO.
getReg();
1456 bool Found = (MOReg ==
Reg);
1457 if (!Found && TRI && isPhys &&
1464 if (Found && (!isDead || MO.
isDead()))
1480 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i)
1506 assert(DefMO.
isDef() &&
"DefIdx must be a def operand");
1507 assert(UseMO.
isUse() &&
"UseIdx must be a use operand");
1508 assert(!DefMO.
isTied() &&
"Def is already tied to another use");
1509 assert(!UseMO.
isTied() &&
"Use is already tied to another def");
1511 if (DefIdx < TiedMax)
1512 UseMO.TiedTo = DefIdx + 1;
1517 assert(isInlineAsm() &&
"DefIdx out of range");
1522 DefMO.TiedTo =
std::min(UseIdx + 1, TiedMax);
1533 if (MO.TiedTo < TiedMax)
1534 return MO.TiedTo - 1;
1537 if (!isInlineAsm()) {
1542 for (
unsigned i = TiedMax - 1, e = getNumOperands(); i != e; ++i) {
1544 if (UseMO.
isReg() && UseMO.
isUse() && UseMO.TiedTo == OpIdx + 1)
1553 unsigned OpIdxGroup = ~0u;
1558 assert(FlagMO.
isImm() &&
"Invalid tied operand on inline asm");
1559 unsigned CurGroup = GroupIdx.
size();
1563 if (OpIdx > i && OpIdx < i + NumOps)
1564 OpIdxGroup = CurGroup;
1570 unsigned Delta = i - GroupIdx[TiedGroup];
1573 if (OpIdxGroup == CurGroup)
1574 return OpIdx - Delta;
1577 if (OpIdxGroup == TiedGroup)
1578 return OpIdx + Delta;
1598 ToReg = RegInfo.
getSubReg(ToReg, SubIdx);
1622 if (mayStore() || isCall() ||
1623 (mayLoad() && hasOrderedMemoryRef())) {
1628 if (isPosition() || isDebugValue() || isTerminator() ||
1629 hasUnmodeledSideEffects())
1637 if (mayLoad() && !isDereferenceableInvariantLoad(AA))
1652 if (!mayStore() && !Other.
mayStore())
1688 assert((MMOa->
getOffset() >= 0) &&
"Negative MachineMemOperand offset");
1689 assert((MMOb->
getOffset() >= 0) &&
"Negative MachineMemOperand offset");
1713 !hasUnmodeledSideEffects())
1718 if (memoperands_empty())
1737 if (memoperands_empty())
1743 if (MMO->isVolatile())
return false;
1744 if (MMO->isStore())
return false;
1745 if (MMO->isInvariant() && MMO->isDereferenceable())
1750 if (PSV->isConstant(&MFI))
1753 if (
const Value *V = MMO->getValue()) {
1775 assert(getNumOperands() >= 3 &&
1776 "It's illegal to have a PHI without source operands");
1778 unsigned Reg = getOperand(1).getReg();
1779 for (
unsigned i = 3, e = getNumOperands(); i < e; i += 2)
1780 if (getOperand(i).
getReg() != Reg)
1788 if (isInlineAsm()) {
1798 return mayStore() || isCall() || hasUnmodeledSideEffects();
1825 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1834 const Module *M =
nullptr;
1840 print(OS, MST, SkipOpers, SkipDebugLoc, TII);
1844 bool SkipOpers,
bool SkipDebugLoc,
1867 unsigned StartOp = 0, e = getNumOperands();
1868 for (; StartOp < e && getOperand(StartOp).isReg() &&
1869 getOperand(StartOp).isDef() &&
1870 !getOperand(StartOp).isImplicit();
1872 if (StartOp != 0) OS <<
", ";
1873 getOperand(StartOp).print(OS, MST, TRI, IntrinsicInfo);
1874 unsigned Reg = getOperand(StartOp).getReg();
1879 OS <<
'(' << Ty <<
')';
1888 OS << TII->
getName(getOpcode());
1896 bool FirstOp =
true;
1897 unsigned AsmDescOp = ~0u;
1898 unsigned AsmOpCount = 0;
1908 OS <<
" [sideeffect]";
1912 OS <<
" [maystore]";
1914 OS <<
" [isconvergent]";
1916 OS <<
" [alignstack]";
1918 OS <<
" [attdialect]";
1920 OS <<
" [inteldialect]";
1926 for (
unsigned i = StartOp, e = getNumOperands(); i != e; ++i) {
1932 if (FirstOp) FirstOp =
false;
else OS <<
",";
1944 if (DIV && !DIV->getName().empty())
1945 OS <<
"!\"" << DIV->getName() <<
'\"';
1947 MO.
print(OS, MST, TRI);
1948 }
else if (TRI && (isInsertSubreg() || isRegSequence() ||
1949 (isSubregToReg() && i == 3)) && MO.
isImm()) {
1951 }
else if (i == AsmDescOp && MO.
isImm()) {
1953 OS <<
'$' << AsmOpCount++;
1971 OS <<
":RC" << RCID;
1997 default: OS <<
":?";
break;
2001 unsigned TiedTo = 0;
2003 OS <<
" tiedto:$" << TiedTo;
2010 MO.
print(OS, MST, TRI);
2013 bool HaveSemi =
false;
2014 const unsigned PrintableFlags = FrameSetup | FrameDestroy;
2015 if (
Flags & PrintableFlags) {
2022 if (
Flags & FrameSetup)
2025 if (
Flags & FrameDestroy)
2026 OS <<
"FrameDestroy";
2029 if (!memoperands_empty()) {
2036 for (
mmo_iterator i = memoperands_begin(), e = memoperands_end();
2038 (*i)->print(OS, MST);
2039 if (std::next(i) != e)
2045 if (MRI && !VirtRegs.
empty()) {
2050 for (
unsigned i = 0; i != VirtRegs.
size(); ++i) {
2060 OS <<
':' <<
PrintReg(VirtRegs[i]);
2061 for (
unsigned j = i+1; j != VirtRegs.
size();) {
2066 if (VirtRegs[i] != VirtRegs[j])
2067 OS <<
"," <<
PrintReg(VirtRegs[j]);
2074 if (isDebugValue() && getOperand(e - 2).isMetadata()) {
2077 auto *DV = cast<DILocalVariable>(getOperand(e - 2).getMetadata());
2078 OS <<
" line no:" << DV->getLine();
2079 if (
auto *InlinedAt = debugLoc->getInlinedAt()) {
2081 if (InlinedAtDL && MF) {
2082 OS <<
" inlined @[ ";
2083 InlinedAtDL.
print(OS);
2087 if (isIndirectDebugValue())
2089 }
else if (SkipDebugLoc) {
2091 }
else if (debugLoc && MF) {
2103 bool AddIfNotFound) {
2105 bool hasAliases = isPhysReg &&
2109 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i) {
2120 unsigned Reg = MO.
getReg();
2124 if (Reg == IncomingReg) {
2129 if (isPhysReg && isRegTiedToDefOperand(i))
2135 }
else if (hasAliases && MO.
isKill() &&
2146 while (!DeadOps.
empty()) {
2147 unsigned OpIdx = DeadOps.
back();
2149 RemoveOperand(OpIdx);
2151 getOperand(OpIdx).setIsKill(
false);
2157 if (!Found && AddIfNotFound) {
2174 unsigned OpReg = MO.
getReg();
2175 if ((RegInfo && RegInfo->
regsOverlap(Reg, OpReg)) || Reg == OpReg)
2182 bool AddIfNotFound) {
2184 bool hasAliases = isPhysReg &&
2188 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i) {
2192 unsigned MOReg = MO.
getReg();
2199 }
else if (hasAliases && MO.
isDead() &&
2210 while (!DeadOps.
empty()) {
2211 unsigned OpIdx = DeadOps.
back();
2213 RemoveOperand(OpIdx);
2215 getOperand(OpIdx).setIsDead(
false);
2221 if (Found || !AddIfNotFound)
2251 MachineOperand *MO = findRegisterDefOperand(Reg,
false, RegInfo);
2268 bool HasRegMask =
false;
2275 unsigned Reg = MO.
getReg();
2288 addRegisterDefined(*
I, &TRI);
2309 unsigned LocCookie = 0;
2310 const MDNode *LocMD =
nullptr;
2311 for (
unsigned i = getNumOperands(); i != 0; --i) {
2316 mdconst::dyn_extract<ConstantInt>(LocMD->
getOperand(0))) {
2325 return MF->getMMI().getModule()->getContext().emitError(LocCookie, Msg);
2331 unsigned Reg,
unsigned Offset,
2333 assert(isa<DILocalVariable>(Variable) &&
"not a variable");
2334 assert(cast<DIExpression>(Expr)->
isValid() &&
"not an expression");
2335 assert(cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
2336 "Expected inlined-at fields to agree");
2344 assert(Offset == 0 &&
"A direct address cannot have an offset.");
2356 bool IsIndirect,
unsigned Reg,
2359 assert(isa<DILocalVariable>(Variable) &&
"not a variable");
2360 assert(cast<DIExpression>(Expr)->
isValid() &&
"not an expression");
2363 BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, Variable, Expr);
2377 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
2378 "Expected inlined-at fields to agree");
2385 .addFrameIndex(FrameIndex)
static bool Check(DecodeStatus &Out, DecodeStatus In)
void bundleWithPred()
Bundle this instruction with its predecessor.
const MachineInstrBuilder & addMetadata(const MDNode *MD) const
void push_back(const T &Elt)
virtual bool areMemAccessesTriviallyDisjoint(MachineInstr &MIa, MachineInstr &MIb, AliasAnalysis *AA=nullptr) const
Sometimes, it is possible for the target to tell, even without aliasing information, that two MIs access different memory addresses.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
const GlobalValue * getGlobal() const
bool isLoadFoldBarrier() const
Returns true if it is illegal to fold a load across this instruction.
bool isPredicate() const
Set if this is one of the operands that made up of the predicate operand that controls an isPredicabl...
void print(raw_ostream &os, const TargetRegisterInfo *TRI=nullptr, const TargetIntrinsicInfo *IntrinsicInfo=nullptr) const
LLT getType(unsigned VReg) const
Get the low-level type of VReg or LLT{} if VReg is not a generic (target independent) virtual registe...
void removeRegOperandFromUseList(MachineOperand *MO)
Remove MO from its use-def list.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
void setTargetFlags(unsigned F)
const ConstantFP * getFPImm() const
void ChangeToRegister(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isDebug=false)
ChangeToRegister - Replace this operand with a new register operand of the specified value...
MachineBasicBlock * getMBB() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
void setRegisterDefReadUndef(unsigned Reg, bool IsUndef=true)
Mark all subregister defs of register Reg with the undef flag.
bool addRegisterDead(unsigned Reg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI defined a register without a use.
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
unsigned getNumOperands() const
Return number of MDNode operands.
void setIsDef(bool Val=true)
Change a def to a use, or a use to a def.
Describe properties that are true of each instruction in the target description file.
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
void setIsUndef(bool Val=true)
bool hasRegisterImplicitUseOperand(unsigned Reg) const
Returns true if the MachineInstr has an implicit-use operand of exactly the given register (not consi...
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
Address of indexed Jump Table for switch.
bool hasOrderedMemoryRef() const
Return true if this instruction may have an ordered or volatile memory reference, or if the informati...
bool isBundle(MCInst const &MCI)
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
MachineBasicBlock reference.
const char * getSymbolName() const
The two locations do not alias at all.
void setIsDead(bool Val=true)
bool isSubRegister(unsigned RegA, unsigned RegB) const
Returns true if RegB is a sub-register of RegA.
Manage lifetime of a slot tracker for printing IR.
void print(raw_ostream &OS, bool SkipOpers=false, bool SkipDebugLoc=false, const TargetInstrInfo *TII=nullptr) const
Debugging supportPrint this MI to OS.
const MDNode * getMetadata() const
void reserve(size_type N)
Mask of live-out registers.
iterator_range< mop_iterator > operands()
void substVirtReg(unsigned Reg, unsigned SubIdx, const TargetRegisterInfo &)
substVirtReg - Substitute the current register with the virtual subregister Reg:SubReg.
bool isMetadata() const
isMetadata - Tests if this is a MO_Metadata operand.
void markUsesInDebugValueAsUndef(unsigned Reg) const
markUsesInDebugValueAsUndef - Mark every DBG_VALUE referencing the specified register as undefined wh...
void setPhysRegsDeadExcept(ArrayRef< unsigned > UsedRegs, const TargetRegisterInfo &TRI)
Mark every physreg used by this instruction as dead except those in the UsedRegs list.
static bool isImmKind(unsigned Flag)
static bool isUseOperandTiedToDef(unsigned Flag, unsigned &Idx)
isUseOperandTiedToDef - Return true if the flag of the inline asm operand indicates it is an use oper...
bool allDefsAreDead() const
Return true if all the defs of this instruction are dead.
Mask of preserved registers.
const TargetRegisterClass * getRegClassConstraintEffect(unsigned OpIdx, const TargetRegisterClass *CurRC, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const
Applies the constraints (def/use) implied by the OpIdx operand to the given CurRC.
static MCDisassembler::DecodeStatus addOperand(MCInst &Inst, const MCOperand &Opnd)
bool isDereferenceableInvariantLoad(AliasAnalysis *AA) const
Return true if this load instruction never traps and points to a memory location whose value doesn't ...
void ChangeToMCSymbol(MCSymbol *Sym)
ChangeToMCSymbol - Replace this operand with a new MC symbol operand.
void clearKillInfo()
Clears kill flags on all operands.
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
The main low level interface to the alias analysis implementation.
unsigned getBundleSize() const
Return the number of instructions inside the MI bundle, excluding the bundle header.
A description of a memory reference used in the backend.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineInstr * buildDbgValueForSpill(MachineBasicBlock &BB, MachineBasicBlock::iterator I, const MachineInstr &Orig, int FrameIndex)
Clone a DBG_VALUE whose value has been spilled to FrameIndex.
const HexagonInstrInfo * TII
unsigned getCFIIndex() const
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false)
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
const TargetRegisterClass * getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
A Use represents the edge between a Value definition and its users.
void ChangeToES(const char *SymName, unsigned char TargetFlags=0)
ChangeToES - Replace this operand with a new external symbol operand.
Target-dependent index+offset operand.
std::pair< bool, bool > readsWritesVirtualRegister(unsigned Reg, SmallVectorImpl< unsigned > *Ops=nullptr) const
Return a pair of bools (reads, writes) indicating if this instruction reads or writes Reg...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
StringRef getName(unsigned Opcode) const
Returns the name for the instructions with the given opcode.
Name of external global symbol.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly...
Reg
All possible values of the reg field in the ModR/M byte.
static StringRef getName(Value *V)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
void bundleWithSucc()
Bundle this instruction with its successor.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
void print(raw_ostream &OS) const
prints source location /path/to/file.exe:line:col @[inlined at]
void eraseFromParentAndMarkDBGValuesForRemoval()
Unlink 'this' from the containing basic block and delete it.
LLVM_NODISCARD bool empty() const
unsigned getNumOperands() const
Access to explicit operands of the instruction.
bool isPredicable() const
Return true if this instruction has a predicate operand that controls execution.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
void setIsEarlyClobber(bool Val=true)
void unbundleFromPred()
Break bundle above this instruction.
void RemoveOperand(unsigned i)
Erase an operand from an instruction, leaving it with one fewer operand than it started with...
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
static bool hasIdenticalMMOs(const MachineInstr &MI1, const MachineInstr &MI2)
Check to see if the MMOs pointed to by the two MemRefs arrays are identical.
void copyImplicitOps(MachineFunction &MF, const MachineInstr &MI)
Copy implicit register operands from specified instruction to this instruction.
Immediate >64bit operand.
virtual const TargetRegisterClass * getMatchingSuperRegClass(const TargetRegisterClass *A, const TargetRegisterClass *B, unsigned Idx) const
Return a subclass of the specified register class A so that each register in it has a sub-register of...
hash_code hash_value(const APFloat &Arg)
See friend declarations above.
const char * getRegClassName(const TargetRegisterClass *Class) const
Returns the name of the register class.
void addMemOperand(MachineFunction &MF, MachineMemOperand *MO)
Add a MachineMemOperand to the machine instruction.
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
Printable PrintReg(unsigned Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubRegIdx=0)
Prints virtual and physical registers with or without a TRI instance.
bool mayAlias(AliasAnalysis *AA, MachineInstr &Other, bool UseTBAA)
Returns true if this instruction's memory access aliases the memory access of Other.
void clearRegisterKills(unsigned Reg, const TargetRegisterInfo *RegInfo)
Clear all kill flags affecting Reg.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
unsigned short NumOperands
void ChangeToImmediate(int64_t ImmVal)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value...
Flag
These should be considered private to the implementation of the MCInstrDesc class.
const MachineBasicBlock * getParent() const
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
TargetInstrInfo - Interface to description of machine instruction set.
mmo_iterator memoperands_end() const
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal=false)
Checks whether the given location points to constant memory, or if OrLocal is true whether it points ...
bool isEarlyClobber() const
unsigned findTiedOperandIdx(unsigned OpIdx) const
Given the index of a tied register operand, find the operand it is tied to.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
Address of a global value.
initializer< Ty > init(const Ty &Val)
Intrinsic::ID getIntrinsicID() const
unsigned getTargetFlags() const
bool regsOverlap(unsigned regA, unsigned regB) const
Returns true if the two registers are equal or alias each other.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
unsigned const MachineRegisterInfo * MRI
The instances of the Type class are immutable: once they are created, they are never changed...
AAMDNodes getAAInfo() const
Return the AA tags for the memory reference.
bool isOptionalDef() const
Set if this operand is a optional def.
void clearRegisterDeads(unsigned Reg)
Clear all dead flags on operands defining register Reg.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
int findRegisterDefOperandIdx(unsigned Reg, bool isDead=false, bool Overlap=false, const TargetRegisterInfo *TRI=nullptr) const
Returns the operand index that is a def of the specified register or -1 if it is not found...
bool isIndirectDebugValue() const
A DBG_VALUE is indirect iff the first operand is a register and the second operand is an immediate...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const MachineOperand & getOperand(unsigned i) const
unsigned getSubReg(unsigned Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo...
ConstantFP - Floating Point Values [float, double].
static unsigned getNumOperandRegisters(unsigned Flag)
getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag...
AliasResult
The possible results of an alias query.
MCRegAliasIterator enumerates all registers aliasing Reg.
int findInlineAsmFlagIdx(unsigned OpIdx, unsigned *GroupNo=nullptr) const
Find the index of the flag word operand that corresponds to operand OpIdx on an inline asm instructio...
This file declares a class to represent arbitrary precision floating point values and provide a varie...
unsigned getNumExplicitOperands() const
Returns the number of non-implicit operands.
bool isIdenticalTo(const MachineInstr &Other, MICheckType Check=CheckDefs) const
Return true if this instruction is identical to Other.
bool any_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
static unsigned getMemoryConstraintID(unsigned Flag)
Address of a basic block.
void substPhysReg(unsigned Reg, const TargetRegisterInfo &)
substPhysReg - Substitute the current register with the physical register Reg, taking any existing Su...
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by mayLoad / mayStore...
static unsigned getKind(unsigned Flags)
int64_t getOffset() const
Return the offset from the symbol in this operand.
self_iterator getIterator()
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
void setOffset(int64_t Offset)
unsigned getSubReg() const
static unsigned getHashValue(const MachineInstr *const &MI)
static bool isMemKind(unsigned Flag)
iterator erase(const_iterator CI)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void emitError(StringRef Msg) const
Emit an error referring to the source location of this instruction.
void eraseFromBundle()
Unlink 'this' form its basic block and delete it.
void setIsKill(bool Val=true)
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
TargetIntrinsicInfo - Interface to description of machine instruction set.
bool isSafeToMove(AliasAnalysis *AA, bool &SawStore) const
Return true if it is safe to move this instruction.
Representation for a specific memory location.
int findRegisterUseOperandIdx(unsigned Reg, bool isKill=false, const TargetRegisterInfo *TRI=nullptr) const
Returns the operand index that is a use of the specific register or -1 if it is not found...
const MDOperand & getOperand(unsigned I) const
MachineInstr * removeFromBundle()
Unlink this instruction from its basic block and return it without deleting it.
bool memoperands_empty() const
Return true if we don't have any memory operands which described the the memory access done by this i...
ConstMIBundleOperands - Iterate over all operands in a const bundle of machine instructions.
This is the shared class of boolean and integer constants.
void substituteRegister(unsigned FromReg, unsigned ToReg, unsigned SubIdx, const TargetRegisterInfo &RegInfo)
Replace all occurrences of FromReg with ToReg:SubIdx, properly composing subreg indices where necessa...
const uint32_t * getRegMask() const
getRegMask - Returns a bit mask of registers preserved by this RegMask operand.
Generic predicate for ISel.
T get() const
Returns the value of the specified pointer type.
MachineOperand class - Representation of each machine instruction operand.
Module.h This file contains the declarations for the Module class.
void ChangeToFPImmediate(const ConstantFP *FPImm)
ChangeToFPImmediate - Replace this operand with a new FP immediate operand of the specified value...
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
unsigned getPredicate() const
This class implements the register bank concept.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
friend hash_code hash_value(const MachineOperand &MO)
MachineOperand hash_value overload.
MCSymbol reference (for debug/eh info)
void addRegisterDefined(unsigned Reg, const TargetRegisterInfo *RegInfo=nullptr)
We have determined MI defines a register.
static bool clobbersPhysReg(const uint32_t *RegMask, unsigned PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
const ConstantInt * getCImm() const
const Value * getValue() const
Return the base address of the memory access.
const TargetRegisterClass * getRegClassConstraint(unsigned OpIdx, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const
Compute the static register class constraint for operand OpIdx.
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Special value supplied for machine level alias analysis.
const char * getSubRegIndexName(unsigned SubIdx) const
Return the human-readable symbolic target-specific name for the specified SubRegIndex.
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
int findFirstPredOperandIdx() const
Find the index of the first operand in the operand list that is used to represent the predicate...
An opaque object representing a hash code.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
struct llvm::MachineOperand::@135::@136 Reg
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
static bool hasRegClassConstraint(unsigned Flag, unsigned &RC)
hasRegClassConstraint - Returns true if the flag contains a register class constraint.
static std::vector< std::string > Flags
bool isSuperRegister(unsigned RegA, unsigned RegB) const
Returns true if RegB is a super-register of RegA.
Representation of each machine instruction.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
static cl::opt< bool > UseTBAA("use-tbaa-in-sched-mi", cl::Hidden, cl::init(true), cl::desc("Enable use of TBAA during MI DAG construction"))
bool isUnordered() const
Returns true if this memory operation doesn't have any ordering constraints other than normal aliasin...
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static void moveOperands(MachineOperand *Dst, MachineOperand *Src, unsigned NumOps, MachineRegisterInfo *MRI)
Move NumOps MachineOperands from Src to Dst, with support for overlapping ranges. ...
virtual const TargetIntrinsicInfo * getIntrinsicInfo() const
If intrinsic information is available, return it. If not, return null.
std::pair< mmo_iterator, unsigned > mergeMemRefsWith(const MachineInstr &Other)
Return a set of memrefs (begin iterator, size) which conservatively describe the memory behavior of b...
This file provides utility analysis objects describing memory locations.
const RegClassOrRegBank & getRegClassOrRegBank(unsigned Reg) const
Return the register bank or register class of Reg.
void setReg(unsigned Reg)
Change the register this operand corresponds to.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
void setSubReg(unsigned subReg)
const TargetRegisterClass * getCommonSubClass(const TargetRegisterClass *A, const TargetRegisterClass *B, const MVT::SimpleValueType SVT=MVT::SimpleValueType::Any) const
Find the largest common subclass of A and B.
MCSymbol * getMCSymbol() const
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
MCInstrDesc const & getDesc(MCInstrInfo const &MCII, MCInst const &MCI)
INITIALIZE_PASS(HexagonGenMux,"hexagon-gen-mux","Hexagon generate mux instructions", false, false) void HexagonGenMux I isValid()
Abstract Stack Frame Index.
const TargetRegisterClass * getRegClassConstraintEffectForVReg(unsigned Reg, const TargetRegisterClass *CurRC, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI, bool ExploreBundle=false) const
Applies the constraints (def/use) implied by this MI on Reg to the given CurRC.
MachineInstr * removeFromParent()
Unlink 'this' from the containing basic block, and return it without deleting it. ...
Instructions::iterator instr_iterator
const DILocalVariable * getDebugVariable() const
Return the debug variable referenced by this DBG_VALUE instruction.
unsigned getReg() const
getReg - Returns the register number.
bool isValid() const
isValid - Returns true until all the operands have been visited.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void unbundleFromSucc()
Break bundle below this instruction.
unsigned isConstantValuePHI() const
If the specified instruction is a PHI that always merges together the same virtual register...
virtual const TargetRegisterClass * getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const
Returns the largest legal sub-class of RC that supports the sub-register index Idx.
virtual const TargetInstrInfo * getInstrInfo() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
Floating-point immediate operand.
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
const MCOperandInfo * OpInfo
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
void ChangeToFrameIndex(int Idx)
Replace this operand with a frame index.
static DIExpression * prepend(const DIExpression *DIExpr, bool Deref, int64_t Offset=0, bool StackValue=false)
Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value...
uint64_t getSize() const
Return the size in bytes of the memory reference.
This class implements an extremely fast bulk output stream that can only output to a stream...
bool addRegisterKilled(unsigned IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI kills a register.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
StringRef - Represent a constant reference to a string, i.e.
const BlockAddress * getBlockAddress() const
unsigned composeSubRegIndices(unsigned a, unsigned b) const
Return the subregister index you get from composing two subregister indices.
const TargetRegisterClass * getRegClass(const MCInstrDesc &TID, unsigned OpNum, const TargetRegisterInfo *TRI, const MachineFunction &MF) const
Given a machine instruction descriptor, returns the register class constraint for OpNum...
Address of indexed Constant in Constant Pool.
bool isStackAligningInlineAsm() const
bool isIdenticalTo(const MachineOperand &Other) const
Returns true if this operand is identical to the specified operand except for liveness related flags ...
This holds information about one operand of a machine instruction, indicating the register class for ...
int is() const
Test if the Union currently holds the type matching T.
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Instructions::const_iterator const_instr_iterator
MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num)
allocateMemRefsArray - Allocate an array to hold MachineMemOperand pointers.
virtual const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const
Returns a TargetRegisterClass used for pointer values.
InlineAsm::AsmDialect getInlineAsmDialect() const
union llvm::MachineOperand::@135::@137::@138 Val
bool isInternalRead() const
A discriminated union of two pointer types, with the discriminator in the low bit of the pointer...
Metadata reference (for debug info)
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
static cl::opt< bool > PrintWholeRegMask("print-whole-regmask", cl::desc("Print the full contents of regmask operands in IR dumps"), cl::init(true), cl::Hidden)
void tieOperands(unsigned DefIdx, unsigned UseIdx)
Add a tie between the register operands at DefIdx and UseIdx.
void addRegOperandToUseList(MachineOperand *MO)
Add MO to the linked list of operands for its register.