mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
Implement getModRefBehavior for TypeBasedAliasAnalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118416 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6cecceb2f6
commit
a8598bec28
@ -139,6 +139,8 @@ namespace {
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
||||
virtual AliasResult alias(const Location &LocA, const Location &LocB);
|
||||
virtual bool pointsToConstantMemory(const Location &Loc, bool OrLocal);
|
||||
virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS);
|
||||
virtual ModRefBehavior getModRefBehavior(const Function *F);
|
||||
virtual ModRefResult getModRefInfo(ImmutableCallSite CS,
|
||||
const Location &Loc);
|
||||
virtual ModRefResult getModRefInfo(ImmutableCallSite CS1,
|
||||
@ -241,6 +243,27 @@ bool TypeBasedAliasAnalysis::pointsToConstantMemory(const Location &Loc,
|
||||
return AliasAnalysis::pointsToConstantMemory(Loc, OrLocal);
|
||||
}
|
||||
|
||||
AliasAnalysis::ModRefBehavior
|
||||
TypeBasedAliasAnalysis::getModRefBehavior(ImmutableCallSite CS) {
|
||||
if (!EnableTBAA)
|
||||
return AliasAnalysis::getModRefBehavior(CS);
|
||||
|
||||
ModRefBehavior Min = UnknownModRefBehavior;
|
||||
|
||||
// If this is an "immutable" type, we can assume the call doesn't write
|
||||
// to memory.
|
||||
if (const MDNode *M = CS.getInstruction()->getMetadata(LLVMContext::MD_tbaa))
|
||||
if (TBAANode(M).TypeIsImmutable())
|
||||
Min = OnlyReadsMemory;
|
||||
|
||||
return std::min(AliasAnalysis::getModRefBehavior(CS), Min);
|
||||
}
|
||||
|
||||
AliasAnalysis::ModRefBehavior
|
||||
TypeBasedAliasAnalysis::getModRefBehavior(const Function *F) {
|
||||
return AliasAnalysis::getModRefBehavior(F);
|
||||
}
|
||||
|
||||
AliasAnalysis::ModRefResult
|
||||
TypeBasedAliasAnalysis::getModRefInfo(ImmutableCallSite CS,
|
||||
const Location &Loc) {
|
||||
|
Loading…
Reference in New Issue
Block a user