LLVM  5.0.0
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, uint64_t s, unsigned base_alignment, 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
 

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

Member Enumeration Documentation

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

Constructor & Destructor Documentation

MachineMemOperand::MachineMemOperand ( MachinePointerInfo  PtrInfo,
Flags  flags,
uint64_t  s,
unsigned  base_alignment,
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 611 of file MachineInstr.cpp.

Member Function Documentation

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

Definition at line 189 of file MachineMemOperand.h.

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 661 of file MachineInstr.cpp.

Referenced by llvm::PPCTargetLowering::expandVSXLoadForLE(), llvm::PPCTargetLowering::expandVSXStoreForLE(), llvm::MemSDNode::getAlignment(), isMemoryOp(), llvm::X86InstrInfo::loadRegFromAddr(), and llvm::X86InstrInfo::storeRegToAddr().

uint64_t llvm::MachineMemOperand::getBaseAlignment ( ) const
inline

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

Definition at line 200 of file MachineMemOperand.h.

Referenced by llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getOriginalAlignment(), and llvm::MIPrinter::print().

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

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

Definition at line 222 of file MachineMemOperand.h.

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

Flags llvm::MachineMemOperand::getFlags ( ) const
inline
int64_t llvm::MachineMemOperand::getOffset ( ) const
inline
const void* llvm::MachineMemOperand::getOpaqueValue ( ) const
inline

Definition at line 177 of file MachineMemOperand.h.

AtomicOrdering llvm::MachineMemOperand::getOrdering ( ) 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 216 of file MachineMemOperand.h.

Referenced by llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getOrdering(), isAtomic(), and llvm::MIPrinter::print().

const MachinePointerInfo& llvm::MachineMemOperand::getPointerInfo ( ) const
inline
const PseudoSourceValue* llvm::MachineMemOperand::getPseudoValue ( ) const
inline
const MDNode* llvm::MachineMemOperand::getRanges ( ) const
inline

Return the range tag for the memory reference.

Definition at line 206 of file MachineMemOperand.h.

Referenced by llvm::MachineFunction::getMachineMemOperand(), llvm::MemSDNode::getRanges(), and llvm::MIPrinter::print().

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

Returns the synchronization scope ID for this memory operation.

Definition at line 209 of file MachineMemOperand.h.

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

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

Referenced by llvm::SIInstrInfo::areMemAccessesTriviallyDisjoint(), llvm::SystemZInstrInfo::areMemAccessesTriviallyDisjoint(), canLowerToLDG(), llvm::PPCHazardRecognizer970::EmitInstruction(), getCodeAddrSpace(), llvm::PPCHazardRecognizer970::getHazardType(), llvm::MachineFunction::getMachineMemOperand(), getUnderlyingObjects(), isInstrUniform(), llvm::SITargetLowering::isMemOpHasNoClobberedMemOperand(), llvm::AVR::isProgramMemoryAccess(), llvm::AMDGPU::isUniformMMO(), llvm::MachineInstr::mayAlias(), and llvm::MIPrinter::print().

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

Returns true if this operation has an atomic ordering requirement of unordered or higher, false otherwise.

Definition at line 235 of file MachineMemOperand.h.

References getOrdering(), and llvm::NotAtomic.

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

Definition at line 230 of file MachineMemOperand.h.

References MODereferenceable.

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

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

Definition at line 231 of file MachineMemOperand.h.

References MOInvariant.

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

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

Definition at line 226 of file MachineMemOperand.h.

References MOLoad.

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

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

Definition at line 229 of file MachineMemOperand.h.

References MONonTemporal.

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

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

Definition at line 227 of file MachineMemOperand.h.

References MOStore.

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

bool llvm::MachineMemOperand::isUnordered ( ) const
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 244 of file MachineMemOperand.h.

References isVolatile().

Referenced by llvm::MachineInstr::hasOrderedMemoryRef().

bool llvm::MachineMemOperand::isVolatile ( ) const
inline
void MachineMemOperand::print ( raw_ostream &  OS) const

Support for operator<<.

Definition at line 665 of file MachineInstr.cpp.

Referenced by llvm::operator<<().

void MachineMemOperand::print ( raw_ostream &  OS,
ModuleSlotTracker &  MST 
) const

Definition at line 669 of file MachineInstr.cpp.

void MachineMemOperand::Profile ( FoldingSetNodeID &  ID) const

Profile - Gather unique data for the object.

Definition at line 636 of file MachineInstr.cpp.

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 644 of file MachineInstr.cpp.

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

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

Bitwise OR the current flags with the given flags.

Definition at line 183 of file MachineMemOperand.h.

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

Definition at line 256 of file MachineMemOperand.h.

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

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

Definition at line 255 of file MachineMemOperand.h.

Friends And Related Function Documentation

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

Definition at line 281 of file MachineMemOperand.h.

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

Definition at line 268 of file MachineMemOperand.h.


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