diff options
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineOperand.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp index 0a7b12e9ccb9..788c134b6ee8 100644 --- a/llvm/lib/CodeGen/MachineOperand.cpp +++ b/llvm/lib/CodeGen/MachineOperand.cpp @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/MachineOperand.h" -#include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Analysis/Loads.h" #include "llvm/CodeGen/MIRFormatter.h" @@ -53,6 +52,11 @@ static MachineFunction *getMFIfAvailable(MachineOperand &MO) { getMFIfAvailable(const_cast<const MachineOperand &>(MO))); } +unsigned MachineOperand::getOperandNo() const { + assert(getParent() && "Operand does not belong to any instruction!"); + return getParent()->getOperandNo(this); +} + void MachineOperand::setReg(Register Reg) { if (getReg() == Reg) return; // No change. @@ -986,7 +990,7 @@ void MachineOperand::print(raw_ostream &OS, ModuleSlotTracker &MST, case MachineOperand::MO_Predicate: { auto Pred = static_cast<CmpInst::Predicate>(getPredicate()); OS << (CmpInst::isIntPredicate(Pred) ? "int" : "float") << "pred(" - << CmpInst::getPredicateName(Pred) << ')'; + << Pred << ')'; break; } case MachineOperand::MO_ShuffleMask: @@ -1022,10 +1026,10 @@ unsigned MachinePointerInfo::getAddrSpace() const { return AddrSpace; } /// Offset + Size byte. bool MachinePointerInfo::isDereferenceable(unsigned Size, LLVMContext &C, const DataLayout &DL) const { - if (!V.is<const Value *>()) + if (!isa<const Value *>(V)) return false; - const Value *BasePtr = V.get<const Value *>(); + const Value *BasePtr = cast<const Value *>(V); if (BasePtr == nullptr) return false; @@ -1070,8 +1074,8 @@ MachineMemOperand::MachineMemOperand(MachinePointerInfo ptrinfo, Flags f, AtomicOrdering FailureOrdering) : PtrInfo(ptrinfo), MemoryType(type), FlagVals(f), BaseAlign(a), AAInfo(AAInfo), Ranges(Ranges) { - assert((PtrInfo.V.isNull() || PtrInfo.V.is<const PseudoSourceValue *>() || - isa<PointerType>(PtrInfo.V.get<const Value *>()->getType())) && + assert((PtrInfo.V.isNull() || isa<const PseudoSourceValue *>(PtrInfo.V) || + isa<PointerType>(cast<const Value *>(PtrInfo.V)->getType())) && "invalid pointer value"); assert((isLoad() || isStore()) && "Not a load/store!"); @@ -1093,16 +1097,6 @@ MachineMemOperand::MachineMemOperand(MachinePointerInfo ptrinfo, Flags f, s == ~UINT64_C(0) ? LLT() : LLT::scalar(8 * s), a, AAInfo, Ranges, SSID, Ordering, FailureOrdering) {} -/// Profile - Gather unique data for the object. -/// -void MachineMemOperand::Profile(FoldingSetNodeID &ID) const { - ID.AddInteger(getOffset()); - ID.AddInteger(getMemoryType().getUniqueRAWLLTData()); - ID.AddPointer(getOpaqueValue()); - ID.AddInteger(getFlags()); - ID.AddInteger(getBaseAlign().value()); -} - void MachineMemOperand::refineAlignment(const MachineMemOperand *MMO) { // The Value and Offset may differ due to CSE. But the flags and size // should be the same. |