|
LLVM
4.0.0
|
Encapsulates MemorySSA, including all data associated with memory accesses. More...
#include <MemorySSA.h>
Classes | |
| class | CachingWalker |
| A MemorySSAWalker that does AA walks and caching of lookups to disambiguate accesses. More... | |
| class | OptimizeUses |
| This class is a batch walker of all MemoryUse's in the program, and points their defining access at the thing that actually clobbers them. More... | |
Public Types | |
| enum | InsertionPlace { Beginning, End } |
| using | AccessList = iplist< MemoryAccess > |
Protected Member Functions | |
| void | verifyDefUses (Function &F) const |
| Verify the immediate use information, by walking all the memory accesses and verifying that, for each use, it appears in the appropriate def's use list. More... | |
| void | verifyDomination (Function &F) const |
| Verify the domination properties of MemorySSA by checking that each definition dominates all of its uses. More... | |
| void | verifyOrdering (Function &F) const |
| Verify that the order and existence of MemoryAccesses matches the order and existence of memory affecting instructions. More... | |
| AccessList * | getWritableBlockAccesses (const BasicBlock *BB) const |
Friends | |
| class | MemorySSAAnnotatedWriter |
| class | MemorySSAPrinterLegacyPass |
Encapsulates MemorySSA, including all data associated with memory accesses.
Definition at line 500 of file MemorySSA.h.
Definition at line 532 of file MemorySSA.h.
| Enumerator | |
|---|---|
| Beginning | |
| End | |
Definition at line 546 of file MemorySSA.h.
| llvm::MemorySSA::MemorySSA | ( | Function & | Func, |
| AliasAnalysis * | AA, | ||
| DominatorTree * | DT | ||
| ) |
Definition at line 1230 of file MemorySSA.cpp.
| llvm::MemorySSA::~MemorySSA | ( | ) |
Definition at line 1236 of file MemorySSA.cpp.
References llvm::User::dropAllReferences().
| MemoryUseOrDef * llvm::MemorySSA::createMemoryAccessAfter | ( | Instruction * | I, |
| MemoryAccess * | Definition, | ||
| MemoryAccess * | InsertPt | ||
| ) |
Definition at line 1614 of file MemorySSA.cpp.
References assert(), llvm::MemoryAccess::getBlock(), llvm::Instruction::getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::insertAfter().
| MemoryUseOrDef * llvm::MemorySSA::createMemoryAccessBefore | ( | Instruction * | I, |
| MemoryAccess * | Definition, | ||
| MemoryUseOrDef * | InsertPt | ||
| ) |
Create a MemoryAccess in MemorySSA before or after an existing MemoryAccess.
Returns the new MemoryAccess. This should be called when a memory instruction is created that is being used to replace an existing memory instruction. It will not create PHI nodes, or verify the clobbering definition. The clobbering definition must be non-null. Note: If a MemoryAccess already exists for I, this function will make it inaccessible and it must have removeMemoryAccess called on it.
Definition at line 1602 of file MemorySSA.cpp.
References assert(), llvm::MemoryAccess::getBlock(), llvm::Instruction::getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::insert().
| MemoryAccess * llvm::MemorySSA::createMemoryAccessInBB | ( | Instruction * | I, |
| MemoryAccess * | Definition, | ||
| const BasicBlock * | BB, | ||
| InsertionPlace | Point | ||
| ) |
Create a MemoryAccess in MemorySSA at a specified point in a block, with a specified clobbering definition.
Returns the new MemoryAccess. This should be called when a memory instruction is created that is being used to replace an existing memory instruction. It will not create PHI nodes, or verify the clobbering definition. The insertion place is used solely to determine where in the memoryssa access lists the instruction will be placed. The caller is expected to keep ordering the same as instructions. It will return the new MemoryAccess. Note: If a MemoryAccess already exists for I, this function will make it inaccessible and it must have removeMemoryAccess called on it.
Definition at line 1583 of file MemorySSA.cpp.
References Beginning, and llvm::find_if().
| MemoryPhi * llvm::MemorySSA::createMemoryPhi | ( | BasicBlock * | BB | ) |
Create an empty MemoryPhi in MemorySSA for a given basic block.
Only one MemoryPhi for a block exists at a time, so this function will assert if you try to create one where it already exists.
Definition at line 1561 of file MemorySSA.cpp.
References assert(), llvm::BasicBlock::getContext(), getMemoryAccess(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::push_front().
| bool llvm::MemorySSA::dominates | ( | const MemoryAccess * | A, |
| const MemoryAccess * | B | ||
| ) | const |
Given two memory accesses in potentially different blocks, determine whether MemoryAccess A dominates MemoryAccess B.
Definition at line 1990 of file MemorySSA.cpp.
References llvm::DominatorTree::dominates(), llvm::MemoryAccess::getBlock(), isLiveOnEntryDef(), and locallyDominates().
Referenced by dominates(), spliceMemoryAccessAbove(), and verifyDomination().
| bool llvm::MemorySSA::dominates | ( | const MemoryAccess * | A, |
| const Use & | B | ||
| ) | const |
Given a MemoryAccess and a Use, determine whether MemoryAccess A dominates Use B.
Definition at line 2003 of file MemorySSA.cpp.
References llvm::DominatorTree::dominates(), dominates(), llvm::MemoryAccess::getBlock(), llvm::Use::getUser(), and locallyDominates().
| void llvm::MemorySSA::dump | ( | void | ) | const |
Definition at line 1822 of file MemorySSA.cpp.
References llvm::dbgs().
|
inline |
Return the list of MemoryAccess's for a given basic block.
This list is not modifiable by the user.
Definition at line 537 of file MemorySSA.h.
Referenced by verifyOrdering().
|
inline |
Definition at line 528 of file MemorySSA.h.
Referenced by llvm::MemorySSA::CachingWalker::getClobberingMemoryAccess(), llvm::MemorySSA::OptimizeUses::optimizeUses(), and spliceMemoryAccessAbove().
| MemoryUseOrDef * llvm::MemorySSA::getMemoryAccess | ( | const Instruction * | I | ) | const |
Given a memory Mod/Ref'ing instruction, get the MemorySSA access associated with it.
If passed a basic block gets the memory phi node that exists for that block, if there is one. Otherwise, this will get a MemoryUseOrDef.
Definition at line 1931 of file MemorySSA.cpp.
Referenced by createMemoryPhi(), llvm::MemorySSAAnnotatedWriter::emitBasicBlockStartAnnot(), llvm::MemorySSAAnnotatedWriter::emitInstructionAnnot(), llvm::MemorySSAWalker::getClobberingMemoryAccess(), verifyDefUses(), verifyDomination(), and verifyOrdering().
| MemoryPhi * llvm::MemorySSA::getMemoryAccess | ( | const BasicBlock * | BB | ) | const |
Definition at line 1935 of file MemorySSA.cpp.
| MemorySSAWalker * llvm::MemorySSA::getWalker | ( | ) |
Definition at line 1551 of file MemorySSA.cpp.
Referenced by llvm::MemorySSA::OptimizeUses::OptimizeUses().
|
inlineprotected |
Definition at line 623 of file MemorySSA.h.
Referenced by spliceMemoryAccessAbove().
|
inline |
Return true if MA represents the live on entry value.
Loads and stores from pointer arguments and other global values may be defined by memory operations that do not occur in the current function, so they may be live on entry to the function. MemorySSA represents such memory state by the live on entry definition, which is guaranteed to occur before any other memory access in the function.
Definition at line 524 of file MemorySSA.h.
Referenced by dominates(), llvm::MemorySSA::CachingWalker::getClobberingMemoryAccess(), locallyDominates(), and removeMemoryAccess().
| bool llvm::MemorySSA::locallyDominates | ( | const MemoryAccess * | Dominator, |
| const MemoryAccess * | Dominatee | ||
| ) | const |
Given two memory accesses in the same basic block, determine whether MemoryAccess A dominates MemoryAccess B.
Determine, for two memory accesses in the same block, whether Dominator dominates Dominatee.
Dominator dominates Dominatee. Definition at line 1958 of file MemorySSA.cpp.
References assert(), llvm::MemoryAccess::getBlock(), and isLiveOnEntryDef().
Referenced by dominates().
| void llvm::MemorySSA::print | ( | raw_ostream & | OS | ) | const |
Definition at line 1817 of file MemorySSA.cpp.
Referenced by llvm::MemoryAccess::dump(), llvm::MemorySSAWrapperPass::print(), and llvm::MemorySSAPrinterLegacyPass::runOnFunction().
| void llvm::MemorySSA::removeMemoryAccess | ( | MemoryAccess * | MA | ) |
Remove a MemoryAccess from MemorySSA, including updating all definitions and uses.
This should be called when a memory instruction that has a MemoryAccess associated with it is erased from the program. For example, if a store or load is simply erased (not replaced), removeMemoryAccess should be called on the MemoryAccess for that store/load.
Definition at line 1771 of file MemorySSA.cpp.
References assert(), llvm::Use::getUser(), llvm::Value::hasValueHandle(), isLiveOnEntryDef(), llvm::onlySingleValue(), llvm::Use::set(), llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::ValueHandleBase::ValueIsRAUWd().
| void llvm::MemorySSA::spliceMemoryAccessAbove | ( | MemoryDef * | Where, |
| MemoryUseOrDef * | What | ||
| ) |
Definition at line 1626 of file MemorySSA.cpp.
References assert(), dominates(), llvm::MemoryAccess::getBlock(), llvm::MemoryUseOrDef::getDefiningAccess(), getLiveOnEntryDef(), getWritableBlockAccesses(), llvm::Value::replaceAllUsesWith(), llvm::MemoryUseOrDef::setDefiningAccess(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::splice().
|
protected |
Verify the immediate use information, by walking all the memory accesses and verifying that, for each use, it appears in the appropriate def's use list.
Definition at line 1912 of file MemorySSA.cpp.
References assert(), E, llvm::MemoryPhi::getIncomingValue(), getMemoryAccess(), llvm::MemoryPhi::getNumIncomingValues(), llvm::User::getNumOperands(), I, llvm::pred_begin(), and llvm::pred_end().
Referenced by verifyMemorySSA().
|
protected |
Verify the domination properties of MemorySSA by checking that each definition dominates all of its uses.
Definition at line 1874 of file MemorySSA.cpp.
References assert(), dominates(), getMemoryAccess(), and llvm::Value::uses().
Referenced by verifyMemorySSA().
| void llvm::MemorySSA::verifyMemorySSA | ( | ) | const |
Verify that MemorySSA is self consistent (IE definitions dominate all uses, uses appear in the right places).
This is used by unit tests.
Definition at line 1827 of file MemorySSA.cpp.
References verifyDefUses(), verifyDomination(), and verifyOrdering().
Referenced by llvm::MemorySSAPrinterLegacyPass::runOnFunction(), and llvm::MemorySSAWrapperPass::verifyAnalysis().
|
protected |
Verify that the order and existence of MemoryAccesses matches the order and existence of memory affecting instructions.
Definition at line 1836 of file MemorySSA.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorTemplateCommon< T >::end(), getBlockAccesses(), getMemoryAccess(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by verifyMemorySSA().
|
friend |
Definition at line 616 of file MemorySSA.h.
|
friend |
Definition at line 617 of file MemorySSA.h.
1.8.6