mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242963 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -62,15 +62,16 @@ namespace {
|
||||
<< Must*100/AASum<<"%\n\n";
|
||||
}
|
||||
|
||||
errs() << " " << MRSum << " Total Mod/Ref Queries Performed\n";
|
||||
errs() << " " << MRSum << " Total MRI_Mod/MRI_Ref Queries Performed\n";
|
||||
if (MRSum) {
|
||||
printLine("no mod/ref", NoMR, MRSum);
|
||||
printLine("ref", JustRef, MRSum);
|
||||
printLine("mod", JustMod, MRSum);
|
||||
printLine("mod/ref", MR, MRSum);
|
||||
errs() << " Mod/Ref Analysis Counter Summary: " <<NoMR*100/MRSum
|
||||
<< "%/" << JustRef*100/MRSum << "%/" << JustMod*100/MRSum
|
||||
<< "%/" << MR*100/MRSum <<"%\n\n";
|
||||
errs() << " MRI_Mod/MRI_Ref Analysis Counter Summary: "
|
||||
<< NoMR * 100 / MRSum << "%/" << JustRef * 100 / MRSum << "%/"
|
||||
<< JustMod * 100 / MRSum << "%/" << MR * 100 / MRSum
|
||||
<< "%\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,10 +109,10 @@ namespace {
|
||||
AliasResult alias(const MemoryLocation &LocA,
|
||||
const MemoryLocation &LocB) override;
|
||||
|
||||
ModRefResult getModRefInfo(ImmutableCallSite CS,
|
||||
const MemoryLocation &Loc) override;
|
||||
ModRefResult getModRefInfo(ImmutableCallSite CS1,
|
||||
ImmutableCallSite CS2) override {
|
||||
ModRefInfo getModRefInfo(ImmutableCallSite CS,
|
||||
const MemoryLocation &Loc) override;
|
||||
ModRefInfo getModRefInfo(ImmutableCallSite CS1,
|
||||
ImmutableCallSite CS2) override {
|
||||
return AliasAnalysis::getModRefInfo(CS1,CS2);
|
||||
}
|
||||
};
|
||||
@@ -150,20 +151,31 @@ AliasResult AliasAnalysisCounter::alias(const MemoryLocation &LocA,
|
||||
return R;
|
||||
}
|
||||
|
||||
AliasAnalysis::ModRefResult
|
||||
AliasAnalysisCounter::getModRefInfo(ImmutableCallSite CS,
|
||||
const MemoryLocation &Loc) {
|
||||
ModRefResult R = getAnalysis<AliasAnalysis>().getModRefInfo(CS, Loc);
|
||||
ModRefInfo AliasAnalysisCounter::getModRefInfo(ImmutableCallSite CS,
|
||||
const MemoryLocation &Loc) {
|
||||
ModRefInfo R = getAnalysis<AliasAnalysis>().getModRefInfo(CS, Loc);
|
||||
|
||||
const char *MRString = nullptr;
|
||||
switch (R) {
|
||||
case NoModRef: NoMR++; MRString = "NoModRef"; break;
|
||||
case Ref: JustRef++; MRString = "JustRef"; break;
|
||||
case Mod: JustMod++; MRString = "JustMod"; break;
|
||||
case ModRef: MR++; MRString = "ModRef"; break;
|
||||
case MRI_NoModRef:
|
||||
NoMR++;
|
||||
MRString = "MRI_NoModRef";
|
||||
break;
|
||||
case MRI_Ref:
|
||||
JustRef++;
|
||||
MRString = "JustRef";
|
||||
break;
|
||||
case MRI_Mod:
|
||||
JustMod++;
|
||||
MRString = "JustMod";
|
||||
break;
|
||||
case MRI_ModRef:
|
||||
MR++;
|
||||
MRString = "MRI_ModRef";
|
||||
break;
|
||||
}
|
||||
|
||||
if (PrintAll || (PrintAllFailures && R == ModRef)) {
|
||||
if (PrintAll || (PrintAllFailures && R == MRI_ModRef)) {
|
||||
errs() << MRString << ": Ptr: ";
|
||||
errs() << "[" << Loc.Size << "B] ";
|
||||
Loc.Ptr->printAsOperand(errs(), true, M);
|
||||
|
||||
Reference in New Issue
Block a user