mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 03:24:09 +00:00
[PM/AA] Remove the Location typedef from the AliasAnalysis class now
that it is its own entity in the form of MemoryLocation, and update all the callers. This is an entirely mechanical change. References to "Location" within AA subclases become "MemoryLocation", and elsewhere "AliasAnalysis::Location" becomes "MemoryLocation". Hope that helps out-of-tree folks update. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239885 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -118,10 +118,8 @@ static void RemoveFromReverseMap(DenseMap<Instruction*,
|
||||
/// location, fill in Loc with the details, otherwise set Loc.Ptr to null.
|
||||
/// Return a ModRefInfo value describing the general behavior of the
|
||||
/// instruction.
|
||||
static
|
||||
AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst,
|
||||
AliasAnalysis::Location &Loc,
|
||||
AliasAnalysis *AA) {
|
||||
static AliasAnalysis::ModRefResult
|
||||
GetLocation(const Instruction *Inst, MemoryLocation &Loc, AliasAnalysis *AA) {
|
||||
if (const LoadInst *LI = dyn_cast<LoadInst>(Inst)) {
|
||||
if (LI->isUnordered()) {
|
||||
Loc = MemoryLocation::get(LI);
|
||||
@ -131,7 +129,7 @@ AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst,
|
||||
Loc = MemoryLocation::get(LI);
|
||||
return AliasAnalysis::ModRef;
|
||||
}
|
||||
Loc = AliasAnalysis::Location();
|
||||
Loc = MemoryLocation();
|
||||
return AliasAnalysis::ModRef;
|
||||
}
|
||||
|
||||
@ -144,7 +142,7 @@ AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst,
|
||||
Loc = MemoryLocation::get(SI);
|
||||
return AliasAnalysis::ModRef;
|
||||
}
|
||||
Loc = AliasAnalysis::Location();
|
||||
Loc = MemoryLocation();
|
||||
return AliasAnalysis::ModRef;
|
||||
}
|
||||
|
||||
@ -155,7 +153,7 @@ AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst,
|
||||
|
||||
if (const CallInst *CI = isFreeCall(Inst, AA->getTargetLibraryInfo())) {
|
||||
// calls to free() deallocate the entire structure
|
||||
Loc = AliasAnalysis::Location(CI->getArgOperand(0));
|
||||
Loc = MemoryLocation(CI->getArgOperand(0));
|
||||
return AliasAnalysis::Mod;
|
||||
}
|
||||
|
||||
@ -167,17 +165,17 @@ AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst,
|
||||
case Intrinsic::lifetime_end:
|
||||
case Intrinsic::invariant_start:
|
||||
II->getAAMetadata(AAInfo);
|
||||
Loc = AliasAnalysis::Location(II->getArgOperand(1),
|
||||
cast<ConstantInt>(II->getArgOperand(0))
|
||||
->getZExtValue(), AAInfo);
|
||||
Loc = MemoryLocation(
|
||||
II->getArgOperand(1),
|
||||
cast<ConstantInt>(II->getArgOperand(0))->getZExtValue(), AAInfo);
|
||||
// These intrinsics don't really modify the memory, but returning Mod
|
||||
// will allow them to be handled conservatively.
|
||||
return AliasAnalysis::Mod;
|
||||
case Intrinsic::invariant_end:
|
||||
II->getAAMetadata(AAInfo);
|
||||
Loc = AliasAnalysis::Location(II->getArgOperand(2),
|
||||
cast<ConstantInt>(II->getArgOperand(1))
|
||||
->getZExtValue(), AAInfo);
|
||||
Loc = MemoryLocation(
|
||||
II->getArgOperand(2),
|
||||
cast<ConstantInt>(II->getArgOperand(1))->getZExtValue(), AAInfo);
|
||||
// These intrinsics don't really modify the memory, but returning Mod
|
||||
// will allow them to be handled conservatively.
|
||||
return AliasAnalysis::Mod;
|
||||
@ -212,7 +210,7 @@ getCallSiteDependencyFrom(CallSite CS, bool isReadOnlyCall,
|
||||
Instruction *Inst = --ScanIt;
|
||||
|
||||
// If this inst is a memory op, get the pointer it accessed
|
||||
AliasAnalysis::Location Loc;
|
||||
MemoryLocation Loc;
|
||||
AliasAnalysis::ModRefResult MR = GetLocation(Inst, Loc, AA);
|
||||
if (Loc.Ptr) {
|
||||
// A simple instruction.
|
||||
@ -259,9 +257,10 @@ getCallSiteDependencyFrom(CallSite CS, bool isReadOnlyCall,
|
||||
///
|
||||
/// MemLocBase, MemLocOffset are lazily computed here the first time the
|
||||
/// base/offs of memloc is needed.
|
||||
static bool isLoadLoadClobberIfExtendedToFullWidth(
|
||||
const AliasAnalysis::Location &MemLoc, const Value *&MemLocBase,
|
||||
int64_t &MemLocOffs, const LoadInst *LI) {
|
||||
static bool isLoadLoadClobberIfExtendedToFullWidth(const MemoryLocation &MemLoc,
|
||||
const Value *&MemLocBase,
|
||||
int64_t &MemLocOffs,
|
||||
const LoadInst *LI) {
|
||||
const DataLayout &DL = LI->getModule()->getDataLayout();
|
||||
|
||||
// If we haven't already computed the base/offset of MemLoc, do so now.
|
||||
@ -368,10 +367,9 @@ static bool isVolatile(Instruction *Inst) {
|
||||
/// with reads from read-only locations. If possible, pass the query
|
||||
/// instruction as well; this function may take advantage of the metadata
|
||||
/// annotated to the query instruction to refine the result.
|
||||
MemDepResult MemoryDependenceAnalysis::
|
||||
getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
|
||||
BasicBlock::iterator ScanIt, BasicBlock *BB,
|
||||
Instruction *QueryInst) {
|
||||
MemDepResult MemoryDependenceAnalysis::getPointerDependencyFrom(
|
||||
const MemoryLocation &MemLoc, bool isLoad, BasicBlock::iterator ScanIt,
|
||||
BasicBlock *BB, Instruction *QueryInst) {
|
||||
|
||||
const Value *MemLocBase = nullptr;
|
||||
int64_t MemLocOffset = 0;
|
||||
@ -440,8 +438,7 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
|
||||
// pointer, not on query pointers that are indexed off of them. It'd
|
||||
// be nice to handle that at some point (the right approach is to use
|
||||
// GetPointerBaseWithConstantOffset).
|
||||
if (AA->isMustAlias(AliasAnalysis::Location(II->getArgOperand(1)),
|
||||
MemLoc))
|
||||
if (AA->isMustAlias(MemoryLocation(II->getArgOperand(1)), MemLoc))
|
||||
return MemDepResult::getDef(II);
|
||||
continue;
|
||||
}
|
||||
@ -486,7 +483,7 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
|
||||
}
|
||||
}
|
||||
|
||||
AliasAnalysis::Location LoadLoc = MemoryLocation::get(LI);
|
||||
MemoryLocation LoadLoc = MemoryLocation::get(LI);
|
||||
|
||||
// If we found a pointer, check if it could be the same as our pointer.
|
||||
AliasAnalysis::AliasResult R = AA->alias(LoadLoc, MemLoc);
|
||||
@ -575,7 +572,7 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
|
||||
|
||||
// Ok, this store might clobber the query pointer. Check to see if it is
|
||||
// a must alias: in this case, we want to return this as a def.
|
||||
AliasAnalysis::Location StoreLoc = MemoryLocation::get(SI);
|
||||
MemoryLocation StoreLoc = MemoryLocation::get(SI);
|
||||
|
||||
// If we found a pointer, check if it could be the same as our pointer.
|
||||
AliasAnalysis::AliasResult R = AA->alias(StoreLoc, MemLoc);
|
||||
@ -679,7 +676,7 @@ MemDepResult MemoryDependenceAnalysis::getDependency(Instruction *QueryInst) {
|
||||
else
|
||||
LocalCache = MemDepResult::getNonFuncLocal();
|
||||
} else {
|
||||
AliasAnalysis::Location MemLoc;
|
||||
MemoryLocation MemLoc;
|
||||
AliasAnalysis::ModRefResult MR = GetLocation(QueryInst, MemLoc, AA);
|
||||
if (MemLoc.Ptr) {
|
||||
// If we can do a pointer scan, make it happen.
|
||||
@ -872,7 +869,7 @@ MemoryDependenceAnalysis::getNonLocalCallDependency(CallSite QueryCS) {
|
||||
void MemoryDependenceAnalysis::
|
||||
getNonLocalPointerDependency(Instruction *QueryInst,
|
||||
SmallVectorImpl<NonLocalDepResult> &Result) {
|
||||
const AliasAnalysis::Location Loc = MemoryLocation::get(QueryInst);
|
||||
const MemoryLocation Loc = MemoryLocation::get(QueryInst);
|
||||
bool isLoad = isa<LoadInst>(QueryInst);
|
||||
BasicBlock *FromBB = QueryInst->getParent();
|
||||
assert(FromBB);
|
||||
@ -924,11 +921,9 @@ getNonLocalPointerDependency(Instruction *QueryInst,
|
||||
/// Pointer/PointeeSize using either cached information in Cache or by doing a
|
||||
/// lookup (which may use dirty cache info if available). If we do a lookup,
|
||||
/// add the result to the cache.
|
||||
MemDepResult MemoryDependenceAnalysis::
|
||||
GetNonLocalInfoForBlock(Instruction *QueryInst,
|
||||
const AliasAnalysis::Location &Loc,
|
||||
bool isLoad, BasicBlock *BB,
|
||||
NonLocalDepInfo *Cache, unsigned NumSortedEntries) {
|
||||
MemDepResult MemoryDependenceAnalysis::GetNonLocalInfoForBlock(
|
||||
Instruction *QueryInst, const MemoryLocation &Loc, bool isLoad,
|
||||
BasicBlock *BB, NonLocalDepInfo *Cache, unsigned NumSortedEntries) {
|
||||
|
||||
// Do a binary search to see if we already have an entry for this block in
|
||||
// the cache set. If so, find it.
|
||||
@ -1040,14 +1035,11 @@ SortNonLocalDepInfoCache(MemoryDependenceAnalysis::NonLocalDepInfo &Cache,
|
||||
/// This function returns false on success, or true to indicate that it could
|
||||
/// not compute dependence information for some reason. This should be treated
|
||||
/// as a clobber dependence on the first instruction in the predecessor block.
|
||||
bool MemoryDependenceAnalysis::
|
||||
getNonLocalPointerDepFromBB(Instruction *QueryInst,
|
||||
const PHITransAddr &Pointer,
|
||||
const AliasAnalysis::Location &Loc,
|
||||
bool isLoad, BasicBlock *StartBB,
|
||||
SmallVectorImpl<NonLocalDepResult> &Result,
|
||||
DenseMap<BasicBlock*, Value*> &Visited,
|
||||
bool SkipFirstBlock) {
|
||||
bool MemoryDependenceAnalysis::getNonLocalPointerDepFromBB(
|
||||
Instruction *QueryInst, const PHITransAddr &Pointer,
|
||||
const MemoryLocation &Loc, bool isLoad, BasicBlock *StartBB,
|
||||
SmallVectorImpl<NonLocalDepResult> &Result,
|
||||
DenseMap<BasicBlock *, Value *> &Visited, bool SkipFirstBlock) {
|
||||
// Look up the cached info for Pointer.
|
||||
ValueIsLoadPair CacheKey(Pointer.getAddr(), isLoad);
|
||||
|
||||
|
Reference in New Issue
Block a user