diff options
author | Tanya Lattner <tonic@nondot.org> | 2005-03-29 20:33:42 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2005-03-29 20:33:42 +0000 |
commit | 5ec3a63f6d3626a7ed278f72ac42119736c1af4e (patch) | |
tree | 1b0574203cc30f4487012b1078f24e3557404dbd /lib/Target/SparcV9/ModuloScheduling/DependenceAnalyzer.h | |
parent | 77b505670c855bea3e15cabda4b7c4df222f4c48 (diff) |
Dependence analyzer that just determines dependences within a loop for loads and stores using alias analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20930 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/ModuloScheduling/DependenceAnalyzer.h')
-rw-r--r-- | lib/Target/SparcV9/ModuloScheduling/DependenceAnalyzer.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/Target/SparcV9/ModuloScheduling/DependenceAnalyzer.h b/lib/Target/SparcV9/ModuloScheduling/DependenceAnalyzer.h new file mode 100644 index 0000000000..18f64203f4 --- /dev/null +++ b/lib/Target/SparcV9/ModuloScheduling/DependenceAnalyzer.h @@ -0,0 +1,73 @@ +//===-- DependenceAnalyzer.h - Dependence Analyzer--------------*- C++ -*-===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEPENDENCEANALYZER_H +#define LLVM_DEPENDENCEANALYZER_H + +#include "llvm/Instructions.h" +#include "llvm/Function.h" +#include "llvm/Pass.h" +#include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Target/TargetData.h" +#include <vector> + +namespace llvm { + + //class to represent a dependence + struct Dependence { + + enum DataDepType { + TrueDep, AntiDep, OutputDep, NonDateDep, + }; + + Dependence(int diff, DataDepType dep) : iteDiff(diff), depType(dep) {} + unsigned getIteDiff() { return iteDiff; } + unsigned getDepType() { return depType; } + + private: + + unsigned iteDiff; + unsigned depType; + }; + + + struct DependenceResult { + std::vector<Dependence> dependences; + DependenceResult(const std::vector<Dependence> &d) : dependences(d) {} + }; + + + class DependenceAnalyzer : public FunctionPass { + AliasAnalysis *AA; + TargetData *TD; + + public: + DependenceAnalyzer() { AA = 0; TD = 0; } + virtual bool runOnFunction(Function &F); + virtual const char* getPassName() const { return "DependenceAnalyzer"; } + + // getAnalysisUsage + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired<AliasAnalysis>(); + AU.addRequired<TargetData>(); + } + + //get dependence info + DependenceResult getDependenceInfo(Instruction *inst1, Instruction *inst2); + + }; + +} + + + +#endif |