forked from OSchip/llvm-project
[PM/AA] Run clang-format over this code to establish a clean baseline
for subsequent changes. llvm-svn: 245005
This commit is contained in:
parent
7a9ba04809
commit
fafee839d9
|
@ -23,11 +23,12 @@
|
|||
|
||||
namespace llvm {
|
||||
|
||||
class AliasAnalysisCounter : public ModulePass, public AliasAnalysis {
|
||||
class AliasAnalysisCounter : public ModulePass, public AliasAnalysis {
|
||||
unsigned No, May, Partial, Must;
|
||||
unsigned NoMR, JustRef, JustMod, MR;
|
||||
Module *M;
|
||||
public:
|
||||
|
||||
public:
|
||||
static char ID; // Class identification, replacement for typeinfo
|
||||
AliasAnalysisCounter() : ModulePass(ID) {
|
||||
initializeAliasAnalysisCounterPass(*PassRegistry::getPassRegistry());
|
||||
|
@ -36,12 +37,12 @@ namespace llvm {
|
|||
}
|
||||
|
||||
void printLine(const char *Desc, unsigned Val, unsigned Sum) {
|
||||
errs() << " " << Val << " " << Desc << " responses ("
|
||||
<< Val*100/Sum << "%)\n";
|
||||
errs() << " " << Val << " " << Desc << " responses (" << Val * 100 / Sum
|
||||
<< "%)\n";
|
||||
}
|
||||
~AliasAnalysisCounter() override {
|
||||
unsigned AASum = No+May+Partial+Must;
|
||||
unsigned MRSum = NoMR+JustRef+JustMod+MR;
|
||||
unsigned AASum = No + May + Partial + Must;
|
||||
unsigned MRSum = NoMR + JustRef + JustMod + MR;
|
||||
if (AASum + MRSum) { // Print a report if any counted queries occurred...
|
||||
errs() << "\n===== Alias Analysis Counter Report =====\n"
|
||||
<< " Analysis counted:\n"
|
||||
|
@ -51,10 +52,9 @@ namespace llvm {
|
|||
printLine("may alias", May, AASum);
|
||||
printLine("partial alias", Partial, AASum);
|
||||
printLine("must alias", Must, AASum);
|
||||
errs() << " Alias Analysis Counter Summary: " << No*100/AASum << "%/"
|
||||
<< May*100/AASum << "%/"
|
||||
<< Partial*100/AASum << "%/"
|
||||
<< Must*100/AASum<<"%\n\n";
|
||||
errs() << " Alias Analysis Counter Summary: " << No * 100 / AASum
|
||||
<< "%/" << May * 100 / AASum << "%/" << Partial * 100 / AASum
|
||||
<< "%/" << Must * 100 / AASum << "%\n\n";
|
||||
}
|
||||
|
||||
errs() << " " << MRSum << " Total MRI_Mod/MRI_Ref Queries Performed\n";
|
||||
|
@ -65,8 +65,7 @@ namespace llvm {
|
|||
printLine("mod/ref", MR, MRSum);
|
||||
errs() << " MRI_Mod/MRI_Ref Analysis Counter Summary: "
|
||||
<< NoMR * 100 / MRSum << "%/" << JustRef * 100 / MRSum << "%/"
|
||||
<< JustMod * 100 / MRSum << "%/" << MR * 100 / MRSum
|
||||
<< "%\n\n";
|
||||
<< JustMod * 100 / MRSum << "%/" << MR * 100 / MRSum << "%\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +88,7 @@ namespace llvm {
|
|||
/// specified pass info.
|
||||
void *getAdjustedAnalysisPointer(AnalysisID PI) override {
|
||||
if (PI == &AliasAnalysis::ID)
|
||||
return (AliasAnalysis*)this;
|
||||
return (AliasAnalysis *)this;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -108,16 +107,16 @@ namespace llvm {
|
|||
const MemoryLocation &Loc) override;
|
||||
ModRefInfo getModRefInfo(ImmutableCallSite CS1,
|
||||
ImmutableCallSite CS2) override {
|
||||
return AliasAnalysis::getModRefInfo(CS1,CS2);
|
||||
return AliasAnalysis::getModRefInfo(CS1, CS2);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createAliasAnalysisCounterPass - This pass counts alias queries and how the
|
||||
// alias analysis implementation responds.
|
||||
//
|
||||
ModulePass *createAliasAnalysisCounterPass();
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createAliasAnalysisCounterPass - This pass counts alias queries and how the
|
||||
// alias analysis implementation responds.
|
||||
//
|
||||
ModulePass *createAliasAnalysisCounterPass();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
static cl::opt<bool>
|
||||
PrintAll("count-aa-print-all-queries", cl::ReallyHidden, cl::init(true));
|
||||
static cl::opt<bool>
|
||||
PrintAllFailures("count-aa-print-all-failed-queries", cl::ReallyHidden);
|
||||
static cl::opt<bool> PrintAll("count-aa-print-all-queries", cl::ReallyHidden,
|
||||
cl::init(true));
|
||||
static cl::opt<bool> PrintAllFailures("count-aa-print-all-failed-queries",
|
||||
cl::ReallyHidden);
|
||||
|
||||
char AliasAnalysisCounter::ID = 0;
|
||||
INITIALIZE_AG_PASS(AliasAnalysisCounter, AliasAnalysis, "count-aa",
|
||||
|
@ -41,10 +41,22 @@ AliasResult AliasAnalysisCounter::alias(const MemoryLocation &LocA,
|
|||
|
||||
const char *AliasString = nullptr;
|
||||
switch (R) {
|
||||
case NoAlias: No++; AliasString = "No alias"; break;
|
||||
case MayAlias: May++; AliasString = "May alias"; break;
|
||||
case PartialAlias: Partial++; AliasString = "Partial alias"; break;
|
||||
case MustAlias: Must++; AliasString = "Must alias"; break;
|
||||
case NoAlias:
|
||||
No++;
|
||||
AliasString = "No alias";
|
||||
break;
|
||||
case MayAlias:
|
||||
May++;
|
||||
AliasString = "May alias";
|
||||
break;
|
||||
case PartialAlias:
|
||||
Partial++;
|
||||
AliasString = "Partial alias";
|
||||
break;
|
||||
case MustAlias:
|
||||
Must++;
|
||||
AliasString = "Must alias";
|
||||
break;
|
||||
}
|
||||
|
||||
if (PrintAll || (PrintAllFailures && R == MayAlias)) {
|
||||
|
|
Loading…
Reference in New Issue