summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-21 07:51:27 +0000
committerChris Lattner <sabre@nondot.org>2010-11-21 07:51:27 +0000
commit663ba91cc61a92dca515d14dd593da2803514ebf (patch)
tree5e5e423df3edaa09568b150575e138d4cc565038 /llvm/lib/Analysis
parente48c31ce33d5d033aa9a79f092057d92173a676d (diff)
downloadbcm5719-llvm-663ba91cc61a92dca515d14dd593da2803514ebf.tar.gz
bcm5719-llvm-663ba91cc61a92dca515d14dd593da2803514ebf.zip
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. llvm-svn: 119928
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 94a6d41872c..f452c9e6766 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud