mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
[REFACTOR] Push logic from MemDepPrinter into getNonLocalPointerDependency
Previously, MemDepPrinter handled volatile and unordered accesses without involving MemoryDependencyAnalysis. By making a slight tweak to the documented interface - which is respected by both callers - we can move this responsibility to MDA for the benefit of any future callers. This is basically just cleanup. In the future, we may decide to extend MDA's non local dependency analysis to return useful results for ordered or volatile loads. I believe (but have not really checked in detail) that local dependency analyis does get useful results for ordered, but not volatile, loads. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225483 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -881,18 +881,23 @@ getNonLocalPointerDependency(Instruction *QueryInst,
|
||||
bool isLoad = isa<LoadInst>(QueryInst);
|
||||
BasicBlock *FromBB = QueryInst->getParent();
|
||||
assert(FromBB);
|
||||
|
||||
assert(Loc.Ptr->getType()->isPointerTy() &&
|
||||
"Can't get pointer deps of a non-pointer!");
|
||||
Result.clear();
|
||||
|
||||
// This routine does not expect to deal with volatile instructions. Doing so
|
||||
// would require piping through the QueryInst all the way through.
|
||||
// This routine does not expect to deal with volatile instructions.
|
||||
// Doing so would require piping through the QueryInst all the way through.
|
||||
// TODO: volatiles can't be elided, but they can be reordered with other
|
||||
// non-volatile accesses.
|
||||
if (LoadInst *LI = dyn_cast<LoadInst>(QueryInst)) {
|
||||
assert(!LI->isVolatile());
|
||||
} else if (StoreInst *SI = dyn_cast<StoreInst>(QueryInst)) {
|
||||
assert(!SI->isVolatile());
|
||||
}
|
||||
|
||||
|
||||
// non-volatile accesses.
|
||||
auto isVolatile = [](Instruction *Inst) {
|
||||
if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) {
|
||||
return LI->isVolatile();
|
||||
} else if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
|
||||
return SI->isVolatile();
|
||||
}
|
||||
return false;
|
||||
};
|
||||
// We currently give up on any instruction which is ordered, but we do handle
|
||||
// atomic instructions which are unordered.
|
||||
// TODO: Handle ordered instructions
|
||||
@ -904,11 +909,13 @@ getNonLocalPointerDependency(Instruction *QueryInst,
|
||||
}
|
||||
return false;
|
||||
};
|
||||
assert(!isOrdered(QueryInst) && "ordered instructions not expected");
|
||||
if (isVolatile(QueryInst) || isOrdered(QueryInst)) {
|
||||
Result.push_back(NonLocalDepResult(FromBB,
|
||||
MemDepResult::getUnknown(),
|
||||
const_cast<Value *>(Loc.Ptr)));
|
||||
return;
|
||||
}
|
||||
|
||||
assert(Loc.Ptr->getType()->isPointerTy() &&
|
||||
"Can't get pointer deps of a non-pointer!");
|
||||
Result.clear();
|
||||
|
||||
PHITransAddr Address(const_cast<Value *>(Loc.Ptr), DL, AC);
|
||||
|
||||
|
Reference in New Issue
Block a user