//
// The LLVM Compiler Infrastructure
//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
#include "llvm/Support/Streams.h"
using namespace llvm;
-namespace {
- cl::opt<bool>
- PrintAll("count-aa-print-all-queries", cl::ReallyHidden);
- cl::opt<bool>
- PrintAllFailures("count-aa-print-all-failed-queries", cl::ReallyHidden);
+static cl::opt<bool>
+PrintAll("count-aa-print-all-queries", cl::ReallyHidden);
+static cl::opt<bool>
+PrintAllFailures("count-aa-print-all-failed-queries", cl::ReallyHidden);
+namespace {
class VISIBILITY_HIDDEN AliasAnalysisCounter
: public ModulePass, public AliasAnalysis {
unsigned No, May, Must;
const char *Name;
Module *M;
public:
- AliasAnalysisCounter() {
+ static char ID; // Class identification, replacement for typeinfo
+ AliasAnalysisCounter() : ModulePass(&ID) {
No = May = Must = 0;
NoMR = JustRef = JustMod = MR = 0;
}
bool pointsToConstantMemory(const Value *P) {
return getAnalysis<AliasAnalysis>().pointsToConstantMemory(P);
}
+ bool doesNotAccessMemory(CallSite CS) {
+ return getAnalysis<AliasAnalysis>().doesNotAccessMemory(CS);
+ }
bool doesNotAccessMemory(Function *F) {
return getAnalysis<AliasAnalysis>().doesNotAccessMemory(F);
}
+ bool onlyReadsMemory(CallSite CS) {
+ return getAnalysis<AliasAnalysis>().onlyReadsMemory(CS);
+ }
bool onlyReadsMemory(Function *F) {
return getAnalysis<AliasAnalysis>().onlyReadsMemory(F);
}
return AliasAnalysis::getModRefInfo(CS1,CS2);
}
};
-
- RegisterPass<AliasAnalysisCounter>
- X("count-aa", "Count Alias Analysis Query Responses");
- RegisterAnalysisGroup<AliasAnalysis> Y(X);
}
+char AliasAnalysisCounter::ID = 0;
+static RegisterPass<AliasAnalysisCounter>
+X("count-aa", "Count Alias Analysis Query Responses", false, true);
+static RegisterAnalysisGroup<AliasAnalysis> Y(X);
+
ModulePass *llvm::createAliasAnalysisCounterPass() {
return new AliasAnalysisCounter();
}
if (PrintAll || (PrintAllFailures && R == MayAlias)) {
cerr << AliasString << ":\t";
cerr << "[" << V1Size << "B] ";
- WriteAsOperand(*cerr.stream(), V1, true, M) << ", ";
+ WriteAsOperand(*cerr.stream(), V1, true, M);
+ cerr << ", ";
cerr << "[" << V2Size << "B] ";
- WriteAsOperand(*cerr.stream(), V2, true, M) << "\n";
+ WriteAsOperand(*cerr.stream(), V2, true, M);
+ cerr << "\n";
}
return R;