diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-21 07:51:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-21 07:51:27 +0000 |
commit | e90c5cb747631b315350e7ee7424048c7778bdf9 (patch) | |
tree | a7b226291ad299d1853a60b01b15e993f7710cfe /lib/Analysis/AliasAnalysis.cpp | |
parent | f6f1f062cc8029aa75ca7d0e99fbc1e0b453d07e (diff) |
add "getLocation" method to AliasAnalysis for getting the source and
destination location of a memcpy/memmove. I'm not clear about whether
TBAA works on these, so I'm leaving it out for now. Dan, please revisit
this when convenient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119928 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AliasAnalysis.cpp')
-rw-r--r-- | lib/Analysis/AliasAnalysis.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index 94a6d41872..f452c9e676 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -212,6 +212,29 @@ AliasAnalysis::Location AliasAnalysis::getLocation(const VAArgInst *VI) { VI->getMetadata(LLVMContext::MD_tbaa)); } + +AliasAnalysis::Location +AliasAnalysis::getLocationForSource(const MemTransferInst *MTI) { + uint64_t Size = UnknownSize; + if (ConstantInt *C = dyn_cast<ConstantInt>(MTI->getLength())) + Size = C->getValue().getZExtValue(); + + // FIXME: Can memcpy/memmove have TBAA tags? + return Location(MTI->getRawSource(), Size, 0); +} + +AliasAnalysis::Location +AliasAnalysis::getLocationForDest(const MemTransferInst *MTI) { + uint64_t Size = UnknownSize; + if (ConstantInt *C = dyn_cast<ConstantInt>(MTI->getLength())) + Size = C->getValue().getZExtValue(); + + // FIXME: Can memcpy/memmove have TBAA tags? + return Location(MTI->getRawDest(), Size, 0); +} + + + AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo(const LoadInst *L, const Location &Loc) { // Be conservative in the face of volatile. |