[llvm-commits] [llvm] r74401 - in /llvm/trunk: include/llvm/Analysis/LoopDependenceAnalysis.h lib/Analysis/LoopDependenceAnalysis.cpp
Andreas Bolka
a at bolka.at
Sat Jun 27 17:21:22 PDT 2009
Author: abolka
Date: Sat Jun 27 19:21:21 2009
New Revision: 74401
URL: http://llvm.org/viewvc/llvm-project?rev=74401&view=rev
Log:
Minimal LDA interface, maximally conservative tester.
Modified:
llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h
llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp
Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h?rev=74401&r1=74400&r2=74401&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Sat Jun 27 19:21:21 2009
@@ -28,6 +28,7 @@
class AnalysisUsage;
class ScalarEvolution;
+ class Value;
class LoopDependenceAnalysis : public LoopPass {
Loop *L;
@@ -37,6 +38,10 @@
static char ID; // Class identification, replacement for typeinfo
LoopDependenceAnalysis() : LoopPass(&ID) {}
+ /// TODO: docs
+ bool isDependencePair(const Value*, const Value*) const;
+ bool depends(Value*, Value*);
+
bool runOnLoop(Loop*, LPPassManager&);
virtual void getAnalysisUsage(AnalysisUsage&) const;
Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=74401&r1=74400&r2=74401&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Sat Jun 27 19:21:21 2009
@@ -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 @@
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
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list