summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LibCallAliasAnalysis.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-07-22 23:15:57 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-07-22 23:15:57 +0000
commit194f59ca5d2f48f1e0b7fa95971ae9f88e95ba95 (patch)
tree67fa8610cb1dccceeb055c823d16d438fed256d5 /llvm/lib/Analysis/LibCallAliasAnalysis.cpp
parent16fe4d178e9d81b07e8deb59a4b4292850364898 (diff)
downloadbcm5719-llvm-194f59ca5d2f48f1e0b7fa95971ae9f88e95ba95.tar.gz
bcm5719-llvm-194f59ca5d2f48f1e0b7fa95971ae9f88e95ba95.zip
[PM/AA] Extract the ModRef enums from the AliasAnalysis class in
preparation for de-coupling the AA implementations. In order to do this, they had to become fake-scoped using the traditional LLVM pattern of a leading initialism. These can't be actual scoped enumerations because they're bitfields and thus inherently we use them as integers. I've also renamed the behavior enums that are specific to reasoning about the mod/ref behavior of functions when called. This makes it more clear that they have a very narrow domain of applicability. I think there is a significantly cleaner API for all of this, but I don't want to try to do really substantive changes for now, I just want to refactor the things away from analysis groups so I'm preserving the exact original design and just cleaning up the names, style, and lifting out of the class. Differential Revision: http://reviews.llvm.org/D10564 llvm-svn: 242963
Diffstat (limited to 'llvm/lib/Analysis/LibCallAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LibCallAliasAnalysis.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/llvm/lib/Analysis/LibCallAliasAnalysis.cpp b/llvm/lib/Analysis/LibCallAliasAnalysis.cpp
index 991a0e3e275..c9e2585bd66 100644
--- a/llvm/lib/Analysis/LibCallAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/LibCallAliasAnalysis.cpp
@@ -45,15 +45,16 @@ bool LibCallAliasAnalysis::runOnFunction(Function &F) {
/// AnalyzeLibCallDetails - Given a call to a function with the specified
/// LibCallFunctionInfo, see if we can improve the mod/ref footprint of the call
/// vs the specified pointer/size.
-AliasAnalysis::ModRefResult
+ModRefInfo
LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
ImmutableCallSite CS,
const MemoryLocation &Loc) {
// If we have a function, check to see what kind of mod/ref effects it
// has. Start by including any info globally known about the function.
- AliasAnalysis::ModRefResult MRInfo = FI->UniversalBehavior;
- if (MRInfo == NoModRef) return MRInfo;
-
+ ModRefInfo MRInfo = FI->UniversalBehavior;
+ if (MRInfo == MRI_NoModRef)
+ return MRInfo;
+
// If that didn't tell us that the function is 'readnone', check to see
// if we have detailed info and if 'P' is any of the locations we know
// about.
@@ -75,7 +76,7 @@ LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
// If we find a match against a location that we 'do not' interact with,
// learn this info into MRInfo.
- return ModRefResult(MRInfo & ~Details[i].MRInfo);
+ return ModRefInfo(MRInfo & ~Details[i].MRInfo);
}
return MRInfo;
}
@@ -83,7 +84,7 @@ LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
// If the details are of the 'DoesOnly' sort, we know something if the pointer
// is a match for one of the locations in 'Details'. Also, if we can prove
// that the pointers is *not* one of the locations in 'Details', we know that
- // the call is NoModRef.
+ // the call is MRI_NoModRef.
assert(FI->DetailsType == LibCallFunctionInfo::DoesOnly);
// Find out if the pointer refers to a known location.
@@ -103,16 +104,16 @@ LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
// If we know that this pointer definitely is pointing into the location,
// merge in this information.
- return ModRefResult(MRInfo & Details[i].MRInfo);
+ return ModRefInfo(MRInfo & Details[i].MRInfo);
}
// If we found that the pointer is guaranteed to not match any of the
// locations in our 'DoesOnly' rule, then we know that the pointer must point
// to some other location. Since the libcall doesn't mod/ref any other
- // locations, return NoModRef.
+ // locations, return MRI_NoModRef.
if (NoneMatch)
- return NoModRef;
-
+ return MRI_NoModRef;
+
// Otherwise, return any other info gained so far.
return MRInfo;
}
@@ -120,22 +121,22 @@ LibCallAliasAnalysis::AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
// getModRefInfo - Check to see if the specified callsite can clobber the
// specified memory object.
//
-AliasAnalysis::ModRefResult
-LibCallAliasAnalysis::getModRefInfo(ImmutableCallSite CS,
- const MemoryLocation &Loc) {
- ModRefResult MRInfo = ModRef;
-
+ModRefInfo LibCallAliasAnalysis::getModRefInfo(ImmutableCallSite CS,
+ const MemoryLocation &Loc) {
+ ModRefInfo MRInfo = MRI_ModRef;
+
// If this is a direct call to a function that LCI knows about, get the
// information about the runtime function.
if (LCI) {
if (const Function *F = CS.getCalledFunction()) {
if (const LibCallFunctionInfo *FI = LCI->getFunctionInfo(F)) {
- MRInfo = ModRefResult(MRInfo & AnalyzeLibCallDetails(FI, CS, Loc));
- if (MRInfo == NoModRef) return NoModRef;
+ MRInfo = ModRefInfo(MRInfo & AnalyzeLibCallDetails(FI, CS, Loc));
+ if (MRInfo == MRI_NoModRef)
+ return MRI_NoModRef;
}
}
}
// The AliasAnalysis base class has some smarts, lets use them.
- return (ModRefResult)(MRInfo | AliasAnalysis::getModRefInfo(CS, Loc));
+ return (ModRefInfo)(MRInfo | AliasAnalysis::getModRefInfo(CS, Loc));
}
OpenPOWER on IntegriCloud