LLVM
8.0.1
|
A description of a memory reference used in the backend. More...
#include "llvm/CodeGen/MachineMemOperand.h"
Public Types | |
enum | Flags : uint16_t { MONone = 0, MOLoad = 1u << 0, MOStore = 1u << 1, MOVolatile = 1u << 2, MONonTemporal = 1u << 3, MODereferenceable = 1u << 4, MOInvariant = 1u << 5, MOTargetFlag1 = 1u << 6, MOTargetFlag2 = 1u << 7, MOTargetFlag3 = 1u << 8 } |
Flags values. These may be or'd together. More... | |
Public Member Functions | |
MachineMemOperand (MachinePointerInfo PtrInfo, Flags flags, uint64_t s, uint64_t a, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic) | |
Construct a MachineMemOperand object with the specified PtrInfo, flags, size, and base alignment. More... | |
const MachinePointerInfo & | getPointerInfo () const |
const Value * | getValue () const |
Return the base address of the memory access. More... | |
const PseudoSourceValue * | getPseudoValue () const |
const void * | getOpaqueValue () const |
Flags | getFlags () const |
Return the raw flags of the source value,. More... | |
void | setFlags (Flags f) |
Bitwise OR the current flags with the given flags. More... | |
int64_t | getOffset () const |
For normal values, this is a byte offset added to the base address. More... | |
unsigned | getAddrSpace () const |
uint64_t | getSize () const |
Return the size in bytes of the memory reference. More... | |
uint64_t | getAlignment () const |
Return the minimum known alignment in bytes of the actual memory reference. More... | |
uint64_t | getBaseAlignment () const |
Return the minimum known alignment in bytes of the base address, without the offset. More... | |
AAMDNodes | getAAInfo () const |
Return the AA tags for the memory reference. More... | |
const MDNode * | getRanges () const |
Return the range tag for the memory reference. More... | |
SyncScope::ID | getSyncScopeID () const |
Returns the synchronization scope ID for this memory operation. More... | |
AtomicOrdering | getOrdering () const |
Return the atomic ordering requirements for this memory operation. More... | |
AtomicOrdering | getFailureOrdering () const |
For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur. More... | |
bool | isLoad () const |
bool | isStore () const |
bool | isVolatile () const |
bool | isNonTemporal () const |
bool | isDereferenceable () const |
bool | isInvariant () const |
bool | isAtomic () const |
Returns true if this operation has an atomic ordering requirement of unordered or higher, false otherwise. More... | |
bool | isUnordered () const |
Returns true if this memory operation doesn't have any ordering constraints other than normal aliasing. More... | |
void | refineAlignment (const MachineMemOperand *MMO) |
Update this MachineMemOperand to reflect the alignment of MMO, if it has a greater alignment. More... | |
void | setValue (const Value *NewSV) |
Change the SourceValue for this MachineMemOperand. More... | |
void | setValue (const PseudoSourceValue *NewSV) |
void | setOffset (int64_t NewOffset) |
void | Profile (FoldingSetNodeID &ID) const |
Profile - Gather unique data for the object. More... | |
void | print (raw_ostream &OS) const |
Support for operator<<. More... | |
void | print (raw_ostream &OS, ModuleSlotTracker &MST) const |
void | print (raw_ostream &OS, ModuleSlotTracker &MST, SmallVectorImpl< StringRef > &SSNs, const LLVMContext &Context, const MachineFrameInfo *MFI, const TargetInstrInfo *TII) const |
Friends | |
bool | operator== (const MachineMemOperand &LHS, const MachineMemOperand &RHS) |
bool | operator!= (const MachineMemOperand &LHS, const MachineMemOperand &RHS) |
A description of a memory reference used in the backend.
Instead of holding a StoreInst or LoadInst, this class holds the address Value of the reference along with a byte size and offset. This allows it to describe lowered loads and stores. Also, the special PseudoSourceValue objects can be used to represent loads and stores to memory locations that aren't explicit in the regular LLVM IR.
Definition at line 129 of file MachineMemOperand.h.
enum llvm::MachineMemOperand::Flags : uint16_t |
Flags values. These may be or'd together.
Definition at line 132 of file MachineMemOperand.h.
MachineMemOperand::MachineMemOperand | ( | MachinePointerInfo | PtrInfo, |
Flags | flags, | ||
uint64_t | s, | ||
uint64_t | a, | ||
const AAMDNodes & | AAInfo = AAMDNodes() , |
||
const MDNode * | Ranges = nullptr , |
||
SyncScope::ID | SSID = SyncScope::System , |
||
AtomicOrdering | Ordering = AtomicOrdering::NotAtomic , |
||
AtomicOrdering | FailureOrdering = AtomicOrdering::NotAtomic |
||
) |
Construct a MachineMemOperand object with the specified PtrInfo, flags, size, and base alignment.
For atomic operations the synchronization scope and atomic ordering requirements must also be specified. For cmpxchg atomic operations the atomic ordering requirements when store does not occur must also be specified.
Definition at line 986 of file MachineOperand.cpp.
References assert(), llvm::PointerUnion< PT1, PT2 >::get(), getBaseAlignment(), getFailureOrdering(), getOrdering(), getSyncScopeID(), llvm::Value::getType(), llvm::PointerUnion< PT1, PT2 >::is(), isLoad(), llvm::PointerUnion< PT1, PT2 >::isNull(), isStore(), and llvm::MachinePointerInfo::V.
|
inline |
Return the AA tags for the memory reference.
Definition at line 235 of file MachineMemOperand.h.
Referenced by llvm::SIInstrInfo::areMemAccessesTriviallyDisjoint(), llvm::MemSDNode::getAAInfo(), getStoreTarget(), getUnderlyingObjects(), llvm::MachineInstr::mayAlias(), llvm::VLIWPacketizerList::PacketizeMIs(), print(), and updateKillStatus().
|
inline |
Definition at line 221 of file MachineMemOperand.h.
References llvm::MachinePointerInfo::getAddrSpace().
Referenced by isInstrUniform(), llvm::AMDGPUTargetLowering::isSDNodeAlwaysUniform(), llvm::AMDGPUInstrInfo::isUniformMMO(), and print().
uint64_t MachineMemOperand::getAlignment | ( | ) | const |
Return the minimum known alignment in bytes of the actual memory reference.
getAlignment - Return the minimum known alignment in bytes of the actual memory reference.
Definition at line 1035 of file MachineOperand.cpp.
References getBaseAlignment(), getOffset(), and llvm::MinAlign().
Referenced by llvm::PPCTargetLowering::expandVSXLoadForLE(), llvm::PPCTargetLowering::expandVSXStoreForLE(), llvm::LegalizerHelper::fewerElementsVector(), llvm::MemSDNode::getAlignment(), isMemoryOp(), llvm::X86InstrInfo::loadRegFromAddr(), and llvm::X86InstrInfo::storeRegToAddr().
|
inline |
Return the minimum known alignment in bytes of the base address, without the offset.
Definition at line 232 of file MachineMemOperand.h.
Referenced by getAlignment(), llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getOriginalAlignment(), MachineMemOperand(), print(), Profile(), and refineAlignment().
|
inline |
For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur.
Definition at line 254 of file MachineMemOperand.h.
Referenced by llvm::MachineFunction::getMachineMemOperand(), MachineMemOperand(), and print().
|
inline |
Return the raw flags of the source value,.
Definition at line 212 of file MachineMemOperand.h.
Referenced by buildMUBUFOffsetLoadStore(), combineLoad(), combineStore(), ConstantAddressBlock(), EltsFromConsecutiveLoads(), llvm::MipsSETargetLowering::EmitInstrWithCustomInserter(), llvm::TargetLowering::expandUnalignedLoad(), llvm::TargetLowering::expandUnalignedStore(), ExtendUsesToFormExtLoad(), llvm::LegalizerHelper::fewerElementsVector(), foldBitcastedFPLogic(), getExpandedMinMaxOps(), llvm::SelectionDAG::getIndexedLoad(), getLoadExtOrTrunc(), llvm::MachineFunction::getMachineMemOperand(), GetPromotionOpcode(), getVectorCompareInfo(), isTruncateOf(), isWordAligned(), lowerFP_TO_SINT_STORE(), LowerSTORE(), LowerStore(), numVectorEltsOrZero(), llvm::PPCTargetLowering::PerformDAGCombine(), performIntToFpCombine(), PerformSTORECombine(), PerformVMOVRRDCombine(), print(), Profile(), reduceMaskedLoadToScalarLoad(), reduceMaskedStoreToScalarStore(), refineAlignment(), llvm::R600TargetLowering::ReplaceNodeResults(), llvm::SparcTargetLowering::ReplaceNodeResults(), replaceShuffleOfInsert(), llvm::TargetLowering::scalarizeVectorLoad(), llvm::TargetLowering::scalarizeVectorStore(), ShrinkLoadReplaceStoreWithStore(), SkipLoadExtensionForVMULL(), splitStores(), splitStoreSplat(), llvm::AMDGPUTargetLowering::SplitVectorLoad(), and llvm::AMDGPUTargetLowering::SplitVectorStore().
|
inline |
For normal values, this is a byte offset added to the base address.
For PseudoSourceValue::FPRel values, this is the FrameIndex number.
Definition at line 219 of file MachineMemOperand.h.
References llvm::MachinePointerInfo::Offset.
Referenced by llvm::SystemZInstrInfo::areMemAccessesTriviallyDisjoint(), llvm::PPCHazardRecognizer970::EmitInstruction(), getAlignment(), llvm::PPCHazardRecognizer970::getHazardType(), llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getSrcValueOffset(), getUnderlyingObjects(), llvm::MachineInstr::mayAlias(), llvm::VLIWPacketizerList::PacketizeMIs(), print(), Profile(), and updateKillStatus().
|
inline |
Definition at line 209 of file MachineMemOperand.h.
References llvm::PointerUnion< PT1, PT2 >::getOpaqueValue(), and llvm::MachinePointerInfo::V.
Referenced by Profile().
|
inline |
Return the atomic ordering requirements for this memory operation.
For cmpxchg atomic operations, return the atomic ordering requirements when store occurs.
Definition at line 248 of file MachineMemOperand.h.
Referenced by llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getOrdering(), MachineMemOperand(), print(), and ReplaceCMP_SWAP_128Results().
|
inline |
Definition at line 194 of file MachineMemOperand.h.
Referenced by buildMUBUFOffsetLoadStore(), llvm::LegalizerHelper::fewerElementsVector(), llvm::SelectionDAG::getAtomic(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getMaskedGather(), llvm::SelectionDAG::getMaskedLoad(), llvm::SelectionDAG::getMaskedScatter(), llvm::SelectionDAG::getMaskedStore(), llvm::SelectionDAG::getMemIntrinsicNode(), llvm::MemSDNode::getPointerInfo(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getTargetMemSDNode(), llvm::SelectionDAG::getTruncStore(), llvm::AMDGPUTargetLowering::SplitVectorLoad(), and llvm::AMDGPUTargetLowering::SplitVectorStore().
|
inline |
Definition at line 205 of file MachineMemOperand.h.
References llvm::PointerUnion< PT1, PT2 >::dyn_cast(), and llvm::MachinePointerInfo::V.
Referenced by llvm::SystemZInstrInfo::areMemAccessesTriviallyDisjoint(), llvm::MachineFunction::getMachineMemOperand(), INITIALIZE_PASS(), llvm::LanaiInstrInfo::isLoadFromStackSlotPostFE(), llvm::ARMBaseInstrInfo::isLoadFromStackSlotPostFE(), llvm::X86InstrInfo::isLoadFromStackSlotPostFE(), llvm::ARMBaseInstrInfo::isStoreToStackSlotPostFE(), llvm::X86InstrInfo::isStoreToStackSlotPostFE(), llvm::MachineInstr::mayAlias(), false::IntervalSorter::operator()(), and print().
Return the range tag for the memory reference.
Definition at line 238 of file MachineMemOperand.h.
Referenced by llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getRanges(), and print().
|
inline |
Return the size in bytes of the memory reference.
Definition at line 224 of file MachineMemOperand.h.
References getAlignment(), and Size.
Referenced by llvm::SIInstrInfo::areMemAccessesTriviallyDisjoint(), llvm::SystemZInstrInfo::areMemAccessesTriviallyDisjoint(), emitComments(), llvm::PPCHazardRecognizer970::EmitInstruction(), llvm::InstructionSelector::executeMatchTable(), llvm::PPCTargetLowering::expandVSXLoadForLE(), llvm::PPCTargetLowering::expandVSXStoreForLE(), extractLoadMMOs(), extractStoreMMOs(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), llvm::PPCHazardRecognizer970::getHazardType(), llvm::MachineFunction::getMachineMemOperand(), getStoreTarget(), llvm::MachineInstr::mayAlias(), llvm::MemSDNode::MemSDNode(), llvm::VLIWPacketizerList::PacketizeMIs(), PrepareCall(), print(), refineAlignment(), and updateKillStatus().
|
inline |
Returns the synchronization scope ID for this memory operation.
Definition at line 241 of file MachineMemOperand.h.
Referenced by llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getSyncScopeID(), MachineMemOperand(), and print().
Return the base address of the memory access.
This may either be a normal LLVM IR Value, or one of the special values used in CodeGen. Special values are those obtained via PseudoSourceValue::getFixedStack(int), PseudoSourceValue::getStack, and other PseudoSourceValue member functions which return objects which stand for frame/stack pointer relative references and other special references which are not representable in the high-level IR.
Definition at line 203 of file MachineMemOperand.h.
References llvm::PointerUnion< PT1, PT2 >::dyn_cast(), and llvm::MachinePointerInfo::V.
Referenced by llvm::SIInstrInfo::areMemAccessesTriviallyDisjoint(), llvm::SystemZInstrInfo::areMemAccessesTriviallyDisjoint(), canLowerToLDG(), ConstantAddressBlock(), llvm::PPCHazardRecognizer970::EmitInstruction(), getCodeAddrSpace(), llvm::PPCHazardRecognizer970::getHazardType(), llvm::MachineFunction::getMachineMemOperand(), getStoreTarget(), getUnderlyingObjects(), isInstrUniform(), llvm::SITargetLowering::isMemOpHasNoClobberedMemOperand(), llvm::AVR::isProgramMemoryAccess(), llvm::AMDGPUInstrInfo::isUniformMMO(), llvm::MachineInstr::mayAlias(), llvm::VLIWPacketizerList::PacketizeMIs(), print(), replaceShuffleOfInsert(), and updateKillStatus().
|
inline |
Returns true if this operation has an atomic ordering requirement of unordered or higher, false otherwise.
Definition at line 267 of file MachineMemOperand.h.
References llvm::NotAtomic.
|
inline |
Definition at line 262 of file MachineMemOperand.h.
Referenced by llvm::MemSDNode::MemSDNode(), and print().
|
inline |
Definition at line 263 of file MachineMemOperand.h.
Referenced by llvm::MemSDNode::MemSDNode(), and print().
|
inline |
Definition at line 258 of file MachineMemOperand.h.
Referenced by MachineMemOperand(), print(), and llvm::MemSDNode::readMem().
|
inline |
Definition at line 261 of file MachineMemOperand.h.
Referenced by llvm::MemSDNode::MemSDNode(), and print().
|
inline |
Definition at line 259 of file MachineMemOperand.h.
Referenced by MachineMemOperand(), print(), and llvm::MemSDNode::writeMem().
|
inline |
Returns true if this memory operation doesn't have any ordering constraints other than normal aliasing.
Volatile and atomic memory operations can't be reordered.
Currently, we don't model the difference between volatile and atomic operations. They should retain their ordering relative to all memory operations.
Definition at line 276 of file MachineMemOperand.h.
References isVolatile().
Referenced by llvm::MachineInstr::hasOrderedMemoryRef().
|
inline |
Definition at line 260 of file MachineMemOperand.h.
Referenced by llvm::SystemZInstrInfo::foldMemoryOperandImpl(), INITIALIZE_PASS(), isMemoryOp(), llvm::MemSDNode::MemSDNode(), and print().
void MachineMemOperand::print | ( | raw_ostream & | OS | ) | const |
Support for operator<<.
Definition at line 1039 of file MachineOperand.cpp.
Referenced by llvm::operator<<(), print(), and printMemOperand().
void MachineMemOperand::print | ( | raw_ostream & | OS, |
ModuleSlotTracker & | MST | ||
) | const |
Definition at line 1044 of file MachineOperand.cpp.
References print().
void MachineMemOperand::print | ( | raw_ostream & | OS, |
ModuleSlotTracker & | MST, | ||
SmallVectorImpl< StringRef > & | SSNs, | ||
const LLVMContext & | Context, | ||
const MachineFrameInfo * | MFI, | ||
const TargetInstrInfo * | TII | ||
) | const |
Definition at line 1050 of file MachineOperand.cpp.
References assert(), llvm::PseudoSourceValue::ConstantPool, llvm::PseudoSourceValue::ExternalSymbolCallEntry, llvm::PseudoSourceValue::FixedStack, llvm::ISD::FrameIndex, getAAInfo(), getAddrSpace(), getBaseAlignment(), getFailureOrdering(), getFlags(), getOffset(), getOrdering(), getPseudoValue(), getRanges(), getSize(), llvm::object::getSymbol(), getSyncScopeID(), getTargetMMOFlagName(), getValue(), llvm::PseudoSourceValue::GlobalValueCallEntry, llvm::PseudoSourceValue::GOT, isDereferenceable(), isInvariant(), isLoad(), isNonTemporal(), isStore(), isVolatile(), llvm::PseudoSourceValue::JumpTable, MOTargetFlag1, MOTargetFlag2, MOTargetFlag3, llvm::AAMDNodes::NoAlias, llvm::NotAtomic, llvm::Metadata::printAsOperand(), llvm::Value::printAsOperand(), printFrameIndex(), printIRValueReference(), llvm::printLLVMNameWithoutPrefix(), llvm::MachineOperand::printOperandOffset(), printSyncScope(), llvm::AAMDNodes::Scope, llvm::PseudoSourceValue::Stack, llvm::PseudoSourceValue::TargetCustom, llvm::AAMDNodes::TBAA, llvm::toIRString(), and llvm::MemoryLocation::UnknownSize.
void MachineMemOperand::Profile | ( | FoldingSetNodeID & | ID | ) | const |
Profile - Gather unique data for the object.
Definition at line 1010 of file MachineOperand.cpp.
References llvm::FoldingSetNodeID::AddInteger(), llvm::FoldingSetNodeID::AddPointer(), getBaseAlignment(), getFlags(), getOffset(), and getOpaqueValue().
void MachineMemOperand::refineAlignment | ( | const MachineMemOperand * | MMO | ) |
Update this MachineMemOperand to reflect the alignment of MMO, if it has a greater alignment.
This must only be used when the new alignment applies to all users of this MachineMemOperand.
Definition at line 1018 of file MachineOperand.cpp.
References assert(), getBaseAlignment(), getFlags(), getSize(), and llvm::Log2_32().
Referenced by llvm::MemSDNode::refineAlignment().
|
inline |
Bitwise OR the current flags with the given flags.
Definition at line 215 of file MachineMemOperand.h.
|
inline |
Definition at line 288 of file MachineMemOperand.h.
References Context, llvm::MachinePointerInfo::Offset, print(), and TII.
Change the SourceValue for this MachineMemOperand.
This should only be used when an object is being relocated and all references to it are being updated.
Definition at line 286 of file MachineMemOperand.h.
References llvm::MachinePointerInfo::V.
|
inline |
Definition at line 287 of file MachineMemOperand.h.
References llvm::MachinePointerInfo::V.
|
friend |
Definition at line 316 of file MachineMemOperand.h.
|
friend |
Definition at line 303 of file MachineMemOperand.h.