summaryrefslogtreecommitdiff
path: root/lib/Analysis/IPA/GlobalsModRef.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-09-14 21:25:10 +0000
committerDan Gohman <gohman@apple.com>2010-09-14 21:25:10 +0000
commitb2143b6247901ae4eca2192ee134564c4f5f7853 (patch)
tree7991b48f4a6ee8090de80fbb9cb17c6ed75d6227 /lib/Analysis/IPA/GlobalsModRef.cpp
parentfe3ac088ee0a536f60b3c30ad97703d5d6cd2167 (diff)
Remove the experimental AliasAnalysis::getDependency interface, which
isn't a good level of abstraction for memdep. Instead, generalize AliasAnalysis::alias and related interfaces with a new Location class for describing a memory location. For now, this is the same Pointer and Size as before, plus an additional field for a TBAA tag. Also, introduce a fixed MD_tbaa metadata tag kind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/IPA/GlobalsModRef.cpp')
-rw-r--r--lib/Analysis/IPA/GlobalsModRef.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp
index 6759b0afdce..8622c1137ca 100644
--- a/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -106,10 +106,9 @@ namespace {
//------------------------------------------------
// Implement the AliasAnalysis API
//
- AliasResult alias(const Value *V1, unsigned V1Size,
- const Value *V2, unsigned V2Size);
+ AliasResult alias(const Location &LocA, const Location &LocB);
ModRefResult getModRefInfo(ImmutableCallSite CS,
- const Value *P, unsigned Size);
+ const Location &Loc);
ModRefResult getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2) {
return AliasAnalysis::getModRefInfo(CS1, CS2);
@@ -476,11 +475,11 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
/// other is some random pointer, we know there cannot be an alias, because the
/// address of the global isn't taken.
AliasAnalysis::AliasResult
-GlobalsModRef::alias(const Value *V1, unsigned V1Size,
- const Value *V2, unsigned V2Size) {
+GlobalsModRef::alias(const Location &LocA,
+ const Location &LocB) {
// Get the base object these pointers point to.
- const Value *UV1 = V1->getUnderlyingObject();
- const Value *UV2 = V2->getUnderlyingObject();
+ const Value *UV1 = LocA.Ptr->getUnderlyingObject();
+ const Value *UV2 = LocB.Ptr->getUnderlyingObject();
// If either of the underlying values is a global, they may be non-addr-taken
// globals, which we can answer queries about.
@@ -528,17 +527,18 @@ GlobalsModRef::alias(const Value *V1, unsigned V1Size,
if ((GV1 || GV2) && GV1 != GV2)
return NoAlias;
- return AliasAnalysis::alias(V1, V1Size, V2, V2Size);
+ return AliasAnalysis::alias(LocA, LocB);
}
AliasAnalysis::ModRefResult
GlobalsModRef::getModRefInfo(ImmutableCallSite CS,
- const Value *P, unsigned Size) {
+ const Location &Loc) {
unsigned Known = ModRef;
// If we are asking for mod/ref info of a direct call with a pointer to a
// global we are tracking, return information if we have it.
- if (const GlobalValue *GV = dyn_cast<GlobalValue>(P->getUnderlyingObject()))
+ if (const GlobalValue *GV =
+ dyn_cast<GlobalValue>(Loc.Ptr->getUnderlyingObject()))
if (GV->hasLocalLinkage())
if (const Function *F = CS.getCalledFunction())
if (NonAddressTakenGlobals.count(GV))
@@ -547,7 +547,7 @@ GlobalsModRef::getModRefInfo(ImmutableCallSite CS,
if (Known == NoModRef)
return NoModRef; // No need to query other mod/ref analyses
- return ModRefResult(Known & AliasAnalysis::getModRefInfo(CS, P, Size));
+ return ModRefResult(Known & AliasAnalysis::getModRefInfo(CS, Loc));
}