14#ifndef LLVM_SUPPORT_MODREF_H
15#define LLVM_SUPPORT_MODREF_H
78 static constexpr uint32_t BitsPerLoc = 2;
79 static constexpr uint32_t LocMask = (1 << BitsPerLoc) - 1;
85 MemoryEffects(
uint32_t Data) : Data(Data) {}
88 Data &= ~(LocMask << getLocationPos(Loc));
89 Data |=
static_cast<uint32_t>(MR) << getLocationPos(Loc);
146 FRMB.setModRef(
ArgMem, MR);
171 ME.setModRef(Loc, MR);
254raw_ostream &
operator<<(raw_ostream &
OS, MemoryEffects RMRB);
unsigned const MachineRegisterInfo * MRI
Provides some synthesis utilities to produce sequences of values.
Summary of how a function affects memory in the program.
bool onlyAccessesArgPointees() const
Whether this function only (at most) accesses argument memory.
static MemoryEffects writeOnly()
Create MemoryEffects that can write any memory.
bool doesAccessArgPointees() const
Whether this function may access argument memory.
MemoryEffects getWithModRef(Location Loc, ModRefInfo MR) const
Get new MemoryEffects with modified ModRefInfo for Loc.
static MemoryEffects readOnly()
Create MemoryEffects that can read any memory.
MemoryEffects & operator&=(MemoryEffects Other)
Intersect (in-place) with other MemoryEffects.
static MemoryEffects inaccessibleMemOnly(ModRefInfo MR=ModRefInfo::ModRef)
Create MemoryEffects that can only access inaccessible memory.
bool onlyReadsMemory() const
Whether this function only (at most) reads memory.
MemoryEffects(Location Loc, ModRefInfo MR)
Create MemoryEffects that can access only the given location with the given ModRefInfo.
bool onlyWritesMemory() const
Whether this function only (at most) writes memory.
static MemoryEffects inaccessibleOrArgMemOnly(ModRefInfo MR=ModRefInfo::ModRef)
Create MemoryEffects that can only access inaccessible or argument memory.
bool onlyAccessesInaccessibleMem() const
Whether this function only (at most) accesses inaccessible memory.
bool doesNotAccessMemory() const
Whether this function accesses no memory.
MemoryEffects(ModRefInfo MR)
Create MemoryEffects that can access any location with the given ModRefInfo.
MemoryEffects & operator|=(MemoryEffects Other)
Union (in-place) with other MemoryEffects.
friend raw_ostream & operator<<(raw_ostream &OS, MemoryEffects RMRB)
Debug print MemoryEffects.
static MemoryEffects createFromIntValue(uint32_t Data)
Create MemoryEffects from an encoded integer value (used by memory attribute).
MemoryEffects operator&(MemoryEffects Other) const
Intersect with other MemoryEffects.
Location
The locations at which a function might access memory.
@ ArgMem
Access to memory via argument pointers.
@ InaccessibleMem
Memory that is inaccessible via LLVM IR.
MemoryEffects getWithoutLoc(Location Loc) const
Get new MemoryEffects with NoModRef on the given Loc.
ModRefInfo getModRef(Location Loc) const
Get ModRefInfo for the given Location.
ModRefInfo getModRef() const
Get ModRefInfo for any location.
bool onlyAccessesInaccessibleOrArgMem() const
Whether this function only (at most) accesses argument and inaccessible memory.
uint32_t toIntValue() const
Convert MemoryEffects into an encoded integer value (used by memory attribute).
static MemoryEffects none()
Create MemoryEffects that cannot read or write any memory.
MemoryEffects operator|(MemoryEffects Other) const
Union with other MemoryEffects.
static MemoryEffects argMemOnly(ModRefInfo MR=ModRefInfo::ModRef)
Create MemoryEffects that can only access argument memory.
bool operator==(MemoryEffects Other) const
Check whether this is the same as other MemoryEffects.
static auto locations()
Returns iterator over all supported location kinds.
static MemoryEffects unknown()
Create MemoryEffects that can read and write any memory.
bool operator!=(MemoryEffects Other) const
Check whether this is different from other MemoryEffects.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
auto enum_seq_inclusive(EnumT Begin, EnumT End)
Iterate over an enum type from Begin to End inclusive.
constexpr force_iteration_on_noniterable_enum_t force_iteration_on_noniterable_enum
bool isModSet(const ModRefInfo MRI)
bool isModOrRefSet(const ModRefInfo MRI)
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
@ Ref
The access may reference the value stored in memory.
@ ModRef
The access may reference and may modify the value stored in memory.
@ Mod
The access may modify the value stored in memory.
@ LLVM_MARK_AS_BITMASK_ENUM
@ NoModRef
The access neither references nor modifies the value stored in memory.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
bool isModAndRefSet(const ModRefInfo MRI)
bool isNoModRef(const ModRefInfo MRI)
bool isRefSet(const ModRefInfo MRI)