summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LoopDependenceAnalysis.cpp
diff options
context:
space:
mode:
authorAndreas Bolka <a@bolka.at>2009-06-28 00:21:21 +0000
committerAndreas Bolka <a@bolka.at>2009-06-28 00:21:21 +0000
commit9fee7f86ad77ffc50c0653b84daa17ddd0328061 (patch)
tree2da6680b4733d648f57dd8e552d1399a03641a90 /llvm/lib/Analysis/LoopDependenceAnalysis.cpp
parent8976d3bc7e2d2facbb3e8b0ce0b70401baa89f40 (diff)
downloadbcm5719-llvm-9fee7f86ad77ffc50c0653b84daa17ddd0328061.tar.gz
bcm5719-llvm-9fee7f86ad77ffc50c0653b84daa17ddd0328061.zip
Minimal LDA interface, maximally conservative tester.
llvm-svn: 74401
Diffstat (limited to 'llvm/lib/Analysis/LoopDependenceAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopDependenceAnalysis.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopDependenceAnalysis.cpp b/llvm/lib/Analysis/LoopDependenceAnalysis.cpp
index 8f3e6baf5c5..b23459e81ac 100644
--- a/llvm/lib/Analysis/LoopDependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopDependenceAnalysis.cpp
@@ -21,6 +21,7 @@
#include "llvm/Analysis/LoopDependenceAnalysis.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolution.h"
+#include "llvm/Instructions.h"
using namespace llvm;
LoopPass *llvm::createLoopDependenceAnalysisPass() {
@@ -32,6 +33,29 @@ R("lda", "Loop Dependence Analysis", false, true);
char LoopDependenceAnalysis::ID = 0;
//===----------------------------------------------------------------------===//
+// Utility Functions
+//===----------------------------------------------------------------------===//
+
+static inline bool isMemRefInstr(const Value *I) {
+ return isa<LoadInst>(I) || isa<StoreInst>(I);
+}
+
+//===----------------------------------------------------------------------===//
+// Dependence Testing
+//===----------------------------------------------------------------------===//
+
+bool LoopDependenceAnalysis::isDependencePair(const Value *x,
+ const Value *y) const {
+ return isMemRefInstr(x) && isMemRefInstr(y)
+ && (isa<StoreInst>(x) || isa<StoreInst>(y));
+}
+
+bool LoopDependenceAnalysis::depends(Value *src, Value *dst) {
+ assert(isDependencePair(src, dst) && "Values form no dependence pair!");
+ return true;
+}
+
+//===----------------------------------------------------------------------===//
// LoopDependenceAnalysis Implementation
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud