LLVM 20.0.0git
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
llvm::MemorySSAWalker Class Referenceabstract

This is the generic walker interface for walkers of MemorySSA. More...

#include "llvm/Analysis/MemorySSA.h"

Inheritance diagram for llvm::MemorySSAWalker:
Inheritance graph
[legend]

Public Types

using MemoryAccessSet = SmallVector< MemoryAccess *, 8 >
 

Public Member Functions

 MemorySSAWalker (MemorySSA *)
 
virtual ~MemorySSAWalker ()=default
 
MemoryAccessgetClobberingMemoryAccess (const Instruction *I, BatchAAResults &AA)
 Given a memory Mod/Ref/ModRef'ing instruction, calling this will give you the nearest dominating MemoryAccess that Mod's the location the instruction accesses (by skipping any def which AA can prove does not alias the location(s) accessed by the instruction given).
 
virtual MemoryAccessgetClobberingMemoryAccess (MemoryAccess *, BatchAAResults &AA)=0
 Does the same thing as getClobberingMemoryAccess(const Instruction *I), but takes a MemoryAccess instead of an Instruction.
 
virtual MemoryAccessgetClobberingMemoryAccess (MemoryAccess *, const MemoryLocation &, BatchAAResults &AA)=0
 Given a potentially clobbering memory access and a new location, calling this will give you the nearest dominating clobbering MemoryAccess (by skipping non-aliasing def links).
 
MemoryAccessgetClobberingMemoryAccess (const Instruction *I)
 
MemoryAccessgetClobberingMemoryAccess (MemoryAccess *MA)
 
MemoryAccessgetClobberingMemoryAccess (MemoryAccess *MA, const MemoryLocation &Loc)
 
virtual void invalidateInfo (MemoryAccess *)
 Given a memory access, invalidate anything this walker knows about that access.
 

Protected Attributes

MemorySSAMSSA
 

Friends

class MemorySSA
 

Detailed Description

This is the generic walker interface for walkers of MemorySSA.

Walkers are used to be able to further disambiguate the def-use chains MemorySSA gives you, or otherwise produce better info than MemorySSA gives you. In particular, while the def-use chains provide basic information, and are guaranteed to give, for example, the nearest may-aliasing MemoryDef for a MemoryUse as AliasAnalysis considers it, a user mant want better or other information. In particular, they may want to use SCEV info to further disambiguate memory accesses, or they may want the nearest dominating may-aliasing MemoryDef for a call or a store. This API enables a standardized interface to getting and using that info.

Definition at line 1016 of file MemorySSA.h.

Member Typedef Documentation

◆ MemoryAccessSet

Definition at line 1021 of file MemorySSA.h.

Constructor & Destructor Documentation

◆ MemorySSAWalker()

MemorySSAWalker::MemorySSAWalker ( MemorySSA M)

Definition at line 2445 of file MemorySSA.cpp.

◆ ~MemorySSAWalker()

virtual llvm::MemorySSAWalker::~MemorySSAWalker ( )
virtualdefault

Member Function Documentation

◆ getClobberingMemoryAccess() [1/6]

MemoryAccess * llvm::MemorySSAWalker::getClobberingMemoryAccess ( const Instruction I)
inline

Definition at line 1072 of file MemorySSA.h.

References llvm::MemorySSA::getAA(), getClobberingMemoryAccess(), I, and MSSA.

◆ getClobberingMemoryAccess() [2/6]

MemoryAccess * llvm::MemorySSAWalker::getClobberingMemoryAccess ( const Instruction I,
BatchAAResults AA 
)
inline

Given a memory Mod/Ref/ModRef'ing instruction, calling this will give you the nearest dominating MemoryAccess that Mod's the location the instruction accesses (by skipping any def which AA can prove does not alias the location(s) accessed by the instruction given).

Note that this will return a single access, and it must dominate the Instruction, so if an operand of a MemoryPhi node Mod's the instruction, this will return the MemoryPhi, not the operand. This means that given: if (a) { 1 = MemoryDef(liveOnEntry) store a } else { 2 = MemoryDef(liveOnEntry) store b } 3 = MemoryPhi(2, 1) MemoryUse(3) load a

calling this API on load(a) will return the MemoryPhi, not the MemoryDef in the if (a) branch.

Definition at line 1045 of file MemorySSA.h.

References assert(), getClobberingMemoryAccess(), llvm::MemorySSA::getMemoryAccess(), I, and MSSA.

Referenced by getClobberingMemoryAccess(), getClobberingMemoryAccess(), getMatchingValue(), llvm::AMDGPU::isClobberedInFunction(), and writtenBetween().

◆ getClobberingMemoryAccess() [3/6]

virtual MemoryAccess * llvm::MemorySSAWalker::getClobberingMemoryAccess ( MemoryAccess ,
BatchAAResults AA 
)
pure virtual

◆ getClobberingMemoryAccess() [4/6]

virtual MemoryAccess * llvm::MemorySSAWalker::getClobberingMemoryAccess ( MemoryAccess ,
const MemoryLocation ,
BatchAAResults AA 
)
pure virtual

Given a potentially clobbering memory access and a new location, calling this will give you the nearest dominating clobbering MemoryAccess (by skipping non-aliasing def links).

This version of the function is mainly used to disambiguate phi translated pointers, where the value of a pointer may have changed from the initial memory access. Note that this expects to be handed either a MemoryUse, or an already potentially clobbering access. Unlike the above API, if given a MemoryDef that clobbers the pointer as the starting access, it will return that MemoryDef, whereas the above would return the clobber starting from the use side of the memory def.

Implemented in llvm::DoNothingMemorySSAWalker, llvm::DoNothingMemorySSAWalker, llvm::MemorySSA::CachingWalker, llvm::MemorySSA::SkipSelfWalker, llvm::MemorySSA::CachingWalker, and llvm::MemorySSA::SkipSelfWalker.

◆ getClobberingMemoryAccess() [5/6]

MemoryAccess * llvm::MemorySSAWalker::getClobberingMemoryAccess ( MemoryAccess MA)
inline

Definition at line 1077 of file MemorySSA.h.

References llvm::MemorySSA::getAA(), getClobberingMemoryAccess(), and MSSA.

◆ getClobberingMemoryAccess() [6/6]

MemoryAccess * llvm::MemorySSAWalker::getClobberingMemoryAccess ( MemoryAccess MA,
const MemoryLocation Loc 
)
inline

Definition at line 1082 of file MemorySSA.h.

References llvm::MemorySSA::getAA(), getClobberingMemoryAccess(), and MSSA.

◆ invalidateInfo()

virtual void llvm::MemorySSAWalker::invalidateInfo ( MemoryAccess )
inlinevirtual

Given a memory access, invalidate anything this walker knows about that access.

This API is used by walkers that store information to perform basic cache invalidation. This will be called by MemorySSA at appropriate times for the walker it uses or returns.

Reimplemented in llvm::MemorySSA::CachingWalker, and llvm::MemorySSA::SkipSelfWalker.

Definition at line 1093 of file MemorySSA.h.

Referenced by llvm::MemorySSA::removeFromLookups().

Friends And Related Function Documentation

◆ MemorySSA

friend class MemorySSA
friend

Definition at line 1096 of file MemorySSA.h.

Member Data Documentation

◆ MSSA

MemorySSA* llvm::MemorySSAWalker::MSSA
protected

Definition at line 1098 of file MemorySSA.h.

Referenced by getClobberingMemoryAccess().


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