OpenASIP  2.0
LoopAnalyzer.hh
Go to the documentation of this file.
1 #ifndef LOOP_ANALYZER_HH
2 #define LOOP_ANALYZER_HH
3 
4 #include "DataDependenceGraph.hh"
5 
6 class LoopAnalyzer {
7 public:
8 
9  // MoveNode contains the node that reads the limit from a register,
10  // if limit not constant.
11  // Not just a string with register name to make ddg updates easier when
12  // creating the loop buffer init.
14  LoopAnalysisResult(long iCount = INT_MIN, MoveNode* n = NULL, int cMul = 1) :
16  MoveNode* counterValueNode; // NULL if static
17  long iterationCount; // may be offset to counter value node
18  int counterMultiplier; // if the val is a multiply of iter count.
19  };
20  typedef std::pair<int, MoveNode*> EndCondition;
21 
22  struct InitAndUpdate {
24  int initVal;
25  int update;
26  int loopEdge;
27  InitAndUpdate(int i, int u, bool l) : initNode(NULL), initVal(i), update(u), loopEdge(l) {}
28  InitAndUpdate(MoveNode& mn, int u, bool l) : initNode(&mn), initVal(0), update(u), loopEdge(l) {}
29  InitAndUpdate(MoveNode& mn, int i, int u, bool l) : initNode(&mn), initVal(i), update(u), loopEdge(l) {}
30  };
31  static LoopAnalysisResult*
33 
34 private:
35  static InitAndUpdate* findInitAndUpdate(DataDependenceGraph& ddg, MoveNode& cmpVal);
36 
37  static EndCondition* findEndCond(DataDependenceGraph& ddg, MoveNode& cmpVal, bool allowVariable);
38 
40  DataDependenceGraph& ddg, MoveNode& init, MoveNode& endCond);
41 };
42 
43 #endif
LoopAnalyzer::InitAndUpdate::initNode
MoveNode * initNode
Definition: LoopAnalyzer.hh:23
LoopAnalyzer::InitAndUpdate
Definition: LoopAnalyzer.hh:22
DataDependenceGraph.hh
MoveNode
Definition: MoveNode.hh:65
LoopAnalyzer::InitAndUpdate::initVal
int initVal
Definition: LoopAnalyzer.hh:24
LoopAnalyzer::findInitAndUpdate
static InitAndUpdate * findInitAndUpdate(DataDependenceGraph &ddg, MoveNode &cmpVal)
Definition: LoopAnalyzer.cc:471
LoopAnalyzer::analyze
static LoopAnalysisResult * analyze(BasicBlockNode &bbn, DataDependenceGraph &ddg)
Definition: LoopAnalyzer.cc:14
LoopAnalyzer::tryTrackCommonAncestor
static EndCondition * tryTrackCommonAncestor(DataDependenceGraph &ddg, MoveNode &init, MoveNode &endCond)
Definition: LoopAnalyzer.cc:649
LoopAnalyzer::LoopAnalysisResult::LoopAnalysisResult
LoopAnalysisResult(long iCount=INT_MIN, MoveNode *n=NULL, int cMul=1)
Definition: LoopAnalyzer.hh:14
LoopAnalyzer::LoopAnalysisResult::counterValueNode
MoveNode * counterValueNode
Definition: LoopAnalyzer.hh:16
LoopAnalyzer::InitAndUpdate::InitAndUpdate
InitAndUpdate(MoveNode &mn, int i, int u, bool l)
Definition: LoopAnalyzer.hh:29
BasicBlockNode
Definition: BasicBlockNode.hh:64
LoopAnalyzer::LoopAnalysisResult::iterationCount
long iterationCount
Definition: LoopAnalyzer.hh:17
LoopAnalyzer::LoopAnalysisResult
Definition: LoopAnalyzer.hh:13
LoopAnalyzer::EndCondition
std::pair< int, MoveNode * > EndCondition
Definition: LoopAnalyzer.hh:20
LoopAnalyzer::InitAndUpdate::loopEdge
int loopEdge
Definition: LoopAnalyzer.hh:26
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
LoopAnalyzer
Definition: LoopAnalyzer.hh:6
LoopAnalyzer::LoopAnalysisResult::counterMultiplier
int counterMultiplier
Definition: LoopAnalyzer.hh:18
LoopAnalyzer::findEndCond
static EndCondition * findEndCond(DataDependenceGraph &ddg, MoveNode &cmpVal, bool allowVariable)
Definition: LoopAnalyzer.cc:357
LoopAnalyzer::InitAndUpdate::update
int update
Definition: LoopAnalyzer.hh:25
LoopAnalyzer::InitAndUpdate::InitAndUpdate
InitAndUpdate(MoveNode &mn, int u, bool l)
Definition: LoopAnalyzer.hh:28
LoopAnalyzer::InitAndUpdate::InitAndUpdate
InitAndUpdate(int i, int u, bool l)
Definition: LoopAnalyzer.hh:27