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
This commit is contained in:
Dan Gohman
2010-09-14 21:25:10 +00:00
parent fe3ac088ee
commit b2143b6247
13 changed files with 258 additions and 512 deletions

View File

@ -96,9 +96,8 @@ namespace {
private:
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
virtual AliasResult alias(const Value *V1, unsigned V1Size,
const Value *V2, unsigned V2Size);
virtual bool pointsToConstantMemory(const Value *P);
virtual AliasResult alias(const Location &LocA, const Location &LocB);
virtual bool pointsToConstantMemory(const Location &Loc);
};
} // End of anonymous namespace
@ -118,12 +117,12 @@ TypeBasedAliasAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
}
AliasAnalysis::AliasResult
TypeBasedAliasAnalysis::alias(const Value *A, unsigned ASize,
const Value *B, unsigned BSize) {
TypeBasedAliasAnalysis::alias(const Location &LocA,
const Location &LocB) {
// Currently, metadata can only be attached to Instructions.
const Instruction *AI = dyn_cast<Instruction>(A);
const Instruction *AI = dyn_cast<Instruction>(LocA.Ptr);
if (!AI) return MayAlias;
const Instruction *BI = dyn_cast<Instruction>(B);
const Instruction *BI = dyn_cast<Instruction>(LocB.Ptr);
if (!BI) return MayAlias;
// Get the attached MDNodes. If either value lacks a tbaa MDNode, we must
@ -175,9 +174,9 @@ TypeBasedAliasAnalysis::alias(const Value *A, unsigned ASize,
return MayAlias;
}
bool TypeBasedAliasAnalysis::pointsToConstantMemory(const Value *P) {
bool TypeBasedAliasAnalysis::pointsToConstantMemory(const Location &Loc) {
// Currently, metadata can only be attached to Instructions.
const Instruction *I = dyn_cast<Instruction>(P);
const Instruction *I = dyn_cast<Instruction>(Loc.Ptr);
if (!I) return false;
MDNode *M =