LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Friends | List of all members
llvm::MachineMemOperand Class Reference

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, LocationSize TS, Align 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.
 
 MachineMemOperand (MachinePointerInfo PtrInfo, Flags flags, LLT type, Align a, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
 
const MachinePointerInfogetPointerInfo () const
 
const ValuegetValue () const
 Return the base address of the memory access.
 
const PseudoSourceValuegetPseudoValue () const
 
const void * getOpaqueValue () const
 
Flags getFlags () const
 Return the raw flags of the source value,.
 
void setFlags (Flags f)
 Bitwise OR the current flags with the given flags.
 
int64_t getOffset () const
 For normal values, this is a byte offset added to the base address.
 
unsigned getAddrSpace () const
 
LLT getMemoryType () const
 Return the memory type of the memory reference.
 
LocationSize getSize () const
 Return the size in bytes of the memory reference.
 
LocationSize getSizeInBits () const
 Return the size in bits of the memory reference.
 
LLT getType () const
 
Align getAlign () const
 Return the minimum known alignment in bytes of the actual memory reference.
 
Align getBaseAlign () const
 Return the minimum known alignment in bytes of the base address, without the offset.
 
AAMDNodes getAAInfo () const
 Return the AA tags for the memory reference.
 
const MDNodegetRanges () const
 Return the range tag for the memory reference.
 
SyncScope::ID getSyncScopeID () const
 Returns the synchronization scope ID for this memory operation.
 
AtomicOrdering getSuccessOrdering () const
 Return the atomic ordering requirements for this memory operation.
 
AtomicOrdering getFailureOrdering () const
 For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur.
 
AtomicOrdering getMergedOrdering () const
 Return a single atomic ordering that is at least as strong as both the success and failure orderings for an atomic operation.
 
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.
 
bool isUnordered () const
 Returns true if this memory operation doesn't have any ordering constraints other than normal aliasing.
 
void refineAlignment (const MachineMemOperand *MMO)
 Update this MachineMemOperand to reflect the alignment of MMO, if it has a greater alignment.
 
void setValue (const Value *NewSV)
 Change the SourceValue for this MachineMemOperand.
 
void setValue (const PseudoSourceValue *NewSV)
 
void setOffset (int64_t NewOffset)
 
void setType (LLT NewTy)
 Reset the tracked memory type.
 
void clearRanges ()
 Unset the tracked range metadata.
 
void print (raw_ostream &OS, ModuleSlotTracker &MST, SmallVectorImpl< StringRef > &SSNs, const LLVMContext &Context, const MachineFrameInfo *MFI, const TargetInstrInfo *TII) const
 Support for operator<<.
 

Friends

bool operator== (const MachineMemOperand &LHS, const MachineMemOperand &RHS)
 
bool operator!= (const MachineMemOperand &LHS, const MachineMemOperand &RHS)
 

Detailed Description

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.

Member Enumeration Documentation

◆ Flags

Flags values. These may be or'd together.

Enumerator
MONone 
MOLoad 

The memory access reads data.

MOStore 

The memory access writes data.

MOVolatile 

The memory access is volatile.

MONonTemporal 

The memory access is non-temporal.

MODereferenceable 

The memory access is dereferenceable (i.e., doesn't trap).

MOInvariant 

The memory access always returns the same value (or traps).

MOTargetFlag1 
MOTargetFlag2 
MOTargetFlag3 

Definition at line 132 of file MachineMemOperand.h.

Constructor & Destructor Documentation

◆ MachineMemOperand() [1/2]

MachineMemOperand::MachineMemOperand ( MachinePointerInfo  PtrInfo,
Flags  flags,
LocationSize  TS,
Align  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 1104 of file MachineOperand.cpp.

◆ MachineMemOperand() [2/2]

MachineMemOperand::MachineMemOperand ( MachinePointerInfo  PtrInfo,
Flags  flags,
LLT  type,
Align  a,
const AAMDNodes AAInfo = AAMDNodes(),
const MDNode Ranges = nullptr,
SyncScope::ID  SSID = SyncScope::System,
AtomicOrdering  Ordering = AtomicOrdering::NotAtomic,
AtomicOrdering  FailureOrdering = AtomicOrdering::NotAtomic 
)

Member Function Documentation

◆ clearRanges()

void llvm::MachineMemOperand::clearRanges ( )
inline

Unset the tracked range metadata.

Definition at line 335 of file MachineMemOperand.h.

Referenced by llvm::LegalizerHelper::bitcast().

◆ getAAInfo()

AAMDNodes llvm::MachineMemOperand::getAAInfo ( ) const
inline

Return the AA tags for the memory reference.

Definition at line 265 of file MachineMemOperand.h.

Referenced by llvm::MemSDNode::getAAInfo(), llvm::MachineFunction::getMachineMemOperand(), MemOperandsHaveAlias(), and print().

◆ getAddrSpace()

unsigned llvm::MachineMemOperand::getAddrSpace ( ) const
inline

◆ getAlign()

Align MachineMemOperand::getAlign ( ) const

◆ getBaseAlign()

Align llvm::MachineMemOperand::getBaseAlign ( ) const
inline

Return the minimum known alignment in bytes of the base address, without the offset.

Definition at line 262 of file MachineMemOperand.h.

Referenced by getAlign(), llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getOriginalAlign(), print(), and refineAlignment().

◆ getFailureOrdering()

AtomicOrdering llvm::MachineMemOperand::getFailureOrdering ( ) const
inline

For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur.

Definition at line 284 of file MachineMemOperand.h.

Referenced by llvm::AtomicSDNode::getFailureOrdering(), llvm::MachineFunction::getMachineMemOperand(), getMergedOrdering(), MachineMemOperand(), and print().

◆ getFlags()

Flags llvm::MachineMemOperand::getFlags ( ) const
inline

Return the raw flags of the source value,.

See also
Flags.

Definition at line 223 of file MachineMemOperand.h.

Referenced by AddNodeIDCustom(), llvm::X86TargetLowering::allowsMemoryAccess(), llvm::TargetLoweringBase::allowsMemoryAccess(), llvm::TargetLoweringBase::allowsMemoryAccessForAlignment(), llvm::SIRegisterInfo::buildSpillLoadStore(), combineMOVDQ2Q(), combineStore(), combineTargetShuffle(), EltsFromConsecutiveLoads(), llvm::SelectionDAG::getAtomic(), llvm::SelectionDAG::getGatherVP(), llvm::SelectionDAG::getGetFPEnv(), llvm::SelectionDAG::getLoad(), llvm::SelectionDAG::getLoadVP(), llvm::MachineFunction::getMachineMemOperand(), llvm::SelectionDAG::getMaskedGather(), llvm::SelectionDAG::getMaskedHistogram(), llvm::SelectionDAG::getMaskedLoad(), llvm::SelectionDAG::getMaskedScatter(), llvm::SelectionDAG::getMaskedStore(), llvm::SelectionDAG::getMemIntrinsicNode(), llvm::SelectionDAG::getScatterVP(), llvm::SelectionDAG::getSetFPEnv(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getStoreVP(), llvm::SelectionDAG::getTruncStore(), llvm::SelectionDAG::getTruncStoreVP(), llvm::SITargetLowering::isMemOpHasNoClobberedMemOperand(), llvm::AMDGPURegisterBankInfo::isScalarLoadLegal(), lowerFP_TO_SINT_STORE(), LowerLoad(), llvm::HexagonTargetLowering::LowerLoad(), LowerStore(), LowerSTORE(), narrowLoadToVZLoad(), PerformExtractFpToIntStores(), performIntToFpCombine(), llvm::AMDGPUTargetLowering::performLoadCombine(), PerformSplittingMVETruncToNarrowingStores(), PerformSplittingToNarrowingStores(), llvm::AMDGPUTargetLowering::performStoreCombine(), PerformSTORECombine(), PerformTruncatingStoreCombine(), print(), reduceMaskedStoreToScalarStore(), refineAlignment(), llvm::SparcTargetLowering::ReplaceNodeResults(), splitStores(), and splitStoreSplat().

◆ getMemoryType()

LLT llvm::MachineMemOperand::getMemoryType ( ) const
inline

Return the memory type of the memory reference.

This should only be relied on for GlobalISel G_* operation legalization.

Definition at line 236 of file MachineMemOperand.h.

Referenced by llvm::LegalizerHelper::bitcast(), llvm::GISelKnownBits::computeKnownBitsImpl(), llvm::AMDGPULegalizerInfo::legalizeBufferLoad(), llvm::AMDGPULegalizerInfo::legalizeLoad(), llvm::LegalizerHelper::lowerLoad(), llvm::LegalizerHelper::lowerStore(), and print().

◆ getMergedOrdering()

AtomicOrdering llvm::MachineMemOperand::getMergedOrdering ( ) const
inline

Return a single atomic ordering that is at least as strong as both the success and failure orderings for an atomic operation.

(For operations other than cmpxchg, this is equivalent to getSuccessOrdering().)

Definition at line 291 of file MachineMemOperand.h.

References getFailureOrdering(), llvm::getMergedAtomicOrdering(), and getSuccessOrdering().

Referenced by llvm::MemSDNode::getMergedOrdering().

◆ getOffset()

int64_t llvm::MachineMemOperand::getOffset ( ) const
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 230 of file MachineMemOperand.h.

Referenced by llvm::SystemZInstrInfo::areMemAccessesTriviallyDisjoint(), llvm::PPCHazardRecognizer970::EmitInstruction(), getAlign(), llvm::PPCHazardRecognizer970::getHazardType(), llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getSrcValueOffset(), MemOperandsHaveAlias(), and print().

◆ getOpaqueValue()

const void * llvm::MachineMemOperand::getOpaqueValue ( ) const
inline

Definition at line 220 of file MachineMemOperand.h.

Referenced by print().

◆ getPointerInfo()

const MachinePointerInfo & llvm::MachineMemOperand::getPointerInfo ( ) const
inline

◆ getPseudoValue()

const PseudoSourceValue * llvm::MachineMemOperand::getPseudoValue ( ) const
inline

◆ getRanges()

const MDNode * llvm::MachineMemOperand::getRanges ( ) const
inline

◆ getSize()

LocationSize llvm::MachineMemOperand::getSize ( ) const
inline

◆ getSizeInBits()

LocationSize llvm::MachineMemOperand::getSizeInBits ( ) const
inline

◆ getSuccessOrdering()

AtomicOrdering llvm::MachineMemOperand::getSuccessOrdering ( ) const
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 278 of file MachineMemOperand.h.

Referenced by llvm::MachineFunction::getMachineMemOperand(), getMergedOrdering(), llvm::MemSDNode::getSuccessOrdering(), isAtomic(), isUnordered(), MachineMemOperand(), and print().

◆ getSyncScopeID()

SyncScope::ID llvm::MachineMemOperand::getSyncScopeID ( ) const
inline

Returns the synchronization scope ID for this memory operation.

Definition at line 271 of file MachineMemOperand.h.

Referenced by llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getSyncScopeID(), MachineMemOperand(), and print().

◆ getType()

LLT llvm::MachineMemOperand::getType ( ) const
inline

Definition at line 252 of file MachineMemOperand.h.

Referenced by llvm::MemSDNode::MemSDNode().

◆ getValue()

const Value * llvm::MachineMemOperand::getValue ( ) const
inline

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 212 of file MachineMemOperand.h.

Referenced by llvm::SystemZInstrInfo::areMemAccessesTriviallyDisjoint(), combineAndLoadToBZHI(), llvm::PPCHazardRecognizer970::EmitInstruction(), llvm::PPCHazardRecognizer970::getHazardType(), llvm::MachineFunction::getMachineMemOperand(), getMMOFrameID(), getUnderlyingObjects(), llvm::AMDGPUInstrInfo::isUniformMMO(), MemOperandsHaveAlias(), and print().

◆ isAtomic()

bool llvm::MachineMemOperand::isAtomic ( ) const
inline

◆ isDereferenceable()

bool llvm::MachineMemOperand::isDereferenceable ( ) const
inline

Definition at line 299 of file MachineMemOperand.h.

References MODereferenceable.

Referenced by llvm::MemSDNode::MemSDNode(), and print().

◆ isInvariant()

bool llvm::MachineMemOperand::isInvariant ( ) const
inline

◆ isLoad()

bool llvm::MachineMemOperand::isLoad ( ) const
inline

Definition at line 295 of file MachineMemOperand.h.

References MOLoad.

Referenced by MachineMemOperand(), print(), and llvm::MemSDNode::readMem().

◆ isNonTemporal()

bool llvm::MachineMemOperand::isNonTemporal ( ) const
inline

◆ isStore()

bool llvm::MachineMemOperand::isStore ( ) const
inline

Definition at line 296 of file MachineMemOperand.h.

References MOStore.

Referenced by MachineMemOperand(), print(), and llvm::MemSDNode::writeMem().

◆ isUnordered()

bool llvm::MachineMemOperand::isUnordered ( ) const
inline

Returns true if this memory operation doesn't have any ordering constraints other than normal aliasing.

Volatile and (ordered) atomic memory operations can't be reordered.

Definition at line 311 of file MachineMemOperand.h.

References getSuccessOrdering(), isVolatile(), llvm::NotAtomic, and llvm::Unordered.

Referenced by llvm::MachineInstr::hasOrderedMemoryRef(), llvm::GMemOperation::isUnordered(), and llvm::MemSDNode::isUnordered().

◆ isVolatile()

bool llvm::MachineMemOperand::isVolatile ( ) const
inline

◆ print()

void MachineMemOperand::print ( raw_ostream OS,
ModuleSlotTracker MST,
SmallVectorImpl< StringRef > &  SSNs,
const LLVMContext Context,
const MachineFrameInfo MFI,
const TargetInstrInfo TII 
) const

◆ refineAlignment()

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 1118 of file MachineOperand.cpp.

References assert(), getBaseAlign(), getFlags(), getSize(), and llvm::LocationSize::hasValue().

Referenced by llvm::MemSDNode::refineAlignment().

◆ setFlags()

void llvm::MachineMemOperand::setFlags ( Flags  f)
inline

Bitwise OR the current flags with the given flags.

Definition at line 226 of file MachineMemOperand.h.

Referenced by llvm::RISCVDAGToDAGISel::Select().

◆ setOffset()

void llvm::MachineMemOperand::setOffset ( int64_t  NewOffset)
inline

Definition at line 327 of file MachineMemOperand.h.

◆ setType()

void llvm::MachineMemOperand::setType ( LLT  NewTy)
inline

Reset the tracked memory type.

Definition at line 330 of file MachineMemOperand.h.

Referenced by llvm::LegalizerHelper::bitcast().

◆ setValue() [1/2]

void llvm::MachineMemOperand::setValue ( const PseudoSourceValue NewSV)
inline

Definition at line 326 of file MachineMemOperand.h.

◆ setValue() [2/2]

void llvm::MachineMemOperand::setValue ( const Value NewSV)
inline

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 325 of file MachineMemOperand.h.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const MachineMemOperand LHS,
const MachineMemOperand RHS 
)
friend

Definition at line 357 of file MachineMemOperand.h.

◆ operator==

bool operator== ( const MachineMemOperand LHS,
const MachineMemOperand RHS 
)
friend

Definition at line 344 of file MachineMemOperand.h.


The documentation for this class was generated from the following files: