diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2015-07-22 23:15:57 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2015-07-22 23:15:57 +0000 |
| commit | 194f59ca5d2f48f1e0b7fa95971ae9f88e95ba95 (patch) | |
| tree | 67fa8610cb1dccceeb055c823d16d438fed256d5 /llvm/lib/Transforms/ObjCARC | |
| parent | 16fe4d178e9d81b07e8deb59a4b4292850364898 (diff) | |
| download | bcm5719-llvm-194f59ca5d2f48f1e0b7fa95971ae9f88e95ba95.tar.gz bcm5719-llvm-194f59ca5d2f48f1e0b7fa95971ae9f88e95ba95.zip | |
[PM/AA] Extract the ModRef enums from the AliasAnalysis class in
preparation for de-coupling the AA implementations.
In order to do this, they had to become fake-scoped using the
traditional LLVM pattern of a leading initialism. These can't be actual
scoped enumerations because they're bitfields and thus inherently we use
them as integers.
I've also renamed the behavior enums that are specific to reasoning
about the mod/ref behavior of functions when called. This makes it more
clear that they have a very narrow domain of applicability.
I think there is a significantly cleaner API for all of this, but
I don't want to try to do really substantive changes for now, I just
want to refactor the things away from analysis groups so I'm preserving
the exact original design and just cleaning up the names, style, and
lifting out of the class.
Differential Revision: http://reviews.llvm.org/D10564
llvm-svn: 242963
Diffstat (limited to 'llvm/lib/Transforms/ObjCARC')
4 files changed, 17 insertions, 19 deletions
diff --git a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp index 4edd02904b2..0c6b16d5d01 100644 --- a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp +++ b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp @@ -49,7 +49,7 @@ bool llvm::objcarc::CanAlterRefCount(const Instruction *Inst, const Value *Ptr, assert(CS && "Only calls can alter reference counts!"); // See if AliasAnalysis can help us with the call. - AliasAnalysis::ModRefBehavior MRB = PA.getAA()->getModRefBehavior(CS); + FunctionModRefBehavior MRB = PA.getAA()->getModRefBehavior(CS); if (AliasAnalysis::onlyReadsMemory(MRB)) return false; if (AliasAnalysis::onlyAccessesArgPointees(MRB)) { diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCAliasAnalysis.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCAliasAnalysis.cpp index 3893aab76b2..e7d05404e9c 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCAliasAnalysis.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCAliasAnalysis.cpp @@ -112,20 +112,20 @@ bool ObjCARCAliasAnalysis::pointsToConstantMemory(const MemoryLocation &Loc, return false; } -AliasAnalysis::ModRefBehavior +FunctionModRefBehavior ObjCARCAliasAnalysis::getModRefBehavior(ImmutableCallSite CS) { // We have nothing to do. Just chain to the next AliasAnalysis. return AliasAnalysis::getModRefBehavior(CS); } -AliasAnalysis::ModRefBehavior +FunctionModRefBehavior ObjCARCAliasAnalysis::getModRefBehavior(const Function *F) { if (!EnableARCOpts) return AliasAnalysis::getModRefBehavior(F); switch (GetFunctionClass(F)) { case ARCInstKind::NoopCast: - return DoesNotAccessMemory; + return FMRB_DoesNotAccessMemory; default: break; } @@ -133,9 +133,8 @@ ObjCARCAliasAnalysis::getModRefBehavior(const Function *F) { return AliasAnalysis::getModRefBehavior(F); } -AliasAnalysis::ModRefResult -ObjCARCAliasAnalysis::getModRefInfo(ImmutableCallSite CS, - const MemoryLocation &Loc) { +ModRefInfo ObjCARCAliasAnalysis::getModRefInfo(ImmutableCallSite CS, + const MemoryLocation &Loc) { if (!EnableARCOpts) return AliasAnalysis::getModRefInfo(CS, Loc); @@ -151,7 +150,7 @@ ObjCARCAliasAnalysis::getModRefInfo(ImmutableCallSite CS, // These functions don't access any memory visible to the compiler. // Note that this doesn't include objc_retainBlock, because it updates // pointers when it copies block data. - return NoModRef; + return MRI_NoModRef; default: break; } @@ -159,10 +158,9 @@ ObjCARCAliasAnalysis::getModRefInfo(ImmutableCallSite CS, return AliasAnalysis::getModRefInfo(CS, Loc); } -AliasAnalysis::ModRefResult -ObjCARCAliasAnalysis::getModRefInfo(ImmutableCallSite CS1, - ImmutableCallSite CS2) { +ModRefInfo ObjCARCAliasAnalysis::getModRefInfo(ImmutableCallSite CS1, + ImmutableCallSite CS2) { // TODO: Theoretically we could check for dependencies between objc_* calls - // and OnlyAccessesArgumentPointees calls or other well-behaved calls. + // and FMRB_OnlyAccessesArgumentPointees calls or other well-behaved calls. return AliasAnalysis::getModRefInfo(CS1, CS2); } diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCAliasAnalysis.h b/llvm/lib/Transforms/ObjCARC/ObjCARCAliasAnalysis.h index eecc82fe572..a002e2862f9 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCAliasAnalysis.h +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCAliasAnalysis.h @@ -60,12 +60,12 @@ namespace objcarc { const MemoryLocation &LocB) override; bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) override; - ModRefBehavior getModRefBehavior(ImmutableCallSite CS) override; - ModRefBehavior getModRefBehavior(const Function *F) override; - ModRefResult getModRefInfo(ImmutableCallSite CS, - const MemoryLocation &Loc) override; - ModRefResult getModRefInfo(ImmutableCallSite CS1, - ImmutableCallSite CS2) override; + FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override; + FunctionModRefBehavior getModRefBehavior(const Function *F) override; + ModRefInfo getModRefInfo(ImmutableCallSite CS, + const MemoryLocation &Loc) override; + ModRefInfo getModRefInfo(ImmutableCallSite CS1, + ImmutableCallSite CS2) override; }; } // namespace objcarc diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp index baca76ba3f2..ded930658ab 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp @@ -247,7 +247,7 @@ static StoreInst *findSafeStoreForStoreStrongContraction(LoadInst *Load, // Ok, now we know we have not seen a store yet. See if Inst can write to // our load location, if it can not, just ignore the instruction. - if (!(AA->getModRefInfo(Inst, Loc) & AliasAnalysis::Mod)) + if (!(AA->getModRefInfo(Inst, Loc) & MRI_Mod)) continue; Store = dyn_cast<StoreInst>(Inst); |

