OpenASIP  2.0
LLVMTCEDataDependenceGraphBuilder.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file LLVMTCEDataDependenceGraphBuilder.cc
26  *
27  * @author Pekka Jääskeläinen 2010 (pjaaskel)
28  */
29 
31 #include "MoveNodeGroupBuilder.hh"
32 #include "MoveNodeGroup.hh"
33 #include "ProgramOperation.hh"
34 #include "Terminal.hh"
35 #include "Move.hh"
36 
39  ControlFlowGraph& cGraph, const UniversalMachine*) {
40 
42  for (int bbi = 0; bbi < cGraph.nodeCount(); ++bbi) {
43  BasicBlockNode& bbnode = cGraph.node(bbi);
44  buildLocalDDG(bbnode.basicBlock());
45  }
46  /* TODO:
47  buildGlobalEdges(cGraph);
48  */
49  currentDDG_->writeToDotFile("ddg.dot");
50  return currentDDG_;
51 }
52 
57  buildLocalDDG(bb);
58  return currentDDG_;
59 }
60 
61 void
65  mngb.build(bb);
66 
67  /*
68  For starters, ensure the original order by chaining the
69  MNs with UNKNOWN edges and add operation edges also.
70 
71  This should trigger the problems with RM so those can be
72  worked on simultaneously.
73  */
74  MoveNode* lastMN = NULL;
75  for (MoveNodeGroupBuilder::MoveNodeGroupList::const_iterator i =
76  mngs->begin(); i != mngs->end(); ++i) {
77  MoveNodeGroup& mng = **i;
78 // PRINT_VAR(mng.toString());
79  if (mng.isOperation()) {
81  }
82  MoveNode* newLastMN = &mng.node(0);
83  for (int mni = 0; mni < mng.nodeCount(); ++mni) {
84  MoveNode& mn = mng.node(mni);
85  currentDDG_->addNode(mn);
86  if (lastMN != NULL) {
87  DataDependenceEdge* edge =
91  currentDDG_->connectNodes(*lastMN, mn, *edge);
92  }
93  if (mn.move().source().isFUPort())
94  newLastMN = &mn;
95  }
96  lastMN = newLastMN;
97  }
98 
99  for (MoveNodeGroupBuilder::MoveNodeGroupList::const_iterator i =
100  mngs->begin(); i != mngs->end(); ++i) {
101  MoveNodeGroup& mng = **i;
102  if (mng.isOperation()) {
104  }
105  }
106 }
MoveNodeGroupBuilder.hh
TTAProgram::Terminal::isFUPort
virtual bool isFUPort() const
Definition: Terminal.cc:118
BoostGraph::connectNodes
virtual void connectNodes(const Node &nTail, const Node &nHead, Edge &e)
MoveNodeGroupBuilder
Definition: MoveNodeGroupBuilder.hh:52
MoveNodeGroup::node
MoveNode & node(int index) const
Definition: MoveNodeGroup.cc:152
BoostGraph::node
Node & node(const int index) const
MoveNodeGroup.hh
DataDependenceGraph::addProgramOperation
void addProgramOperation(ProgramOperationPtr po)
Definition: DataDependenceGraph.cc:298
MoveNode
Definition: MoveNode.hh:65
LLVMTCEDataDependenceGraphBuilder::buildFromBB
virtual DataDependenceGraph * buildFromBB(TTAProgram::BasicBlock &bb, const UniversalMachine *um=NULL)
Definition: LLVMTCEDataDependenceGraphBuilder.cc:54
LLVMTCEDataDependenceGraphBuilder::buildLocalDDG
void buildLocalDDG(TTAProgram::BasicBlock &bb)
Definition: LLVMTCEDataDependenceGraphBuilder.cc:62
Terminal.hh
DataDependenceEdge::EDGE_REGISTER
@ EDGE_REGISTER
Definition: DataDependenceEdge.hh:53
MoveNodeGroup::nodeCount
int nodeCount() const
Definition: MoveNodeGroup.cc:140
BasicBlockNode::basicBlock
TTAProgram::BasicBlock & basicBlock()
Definition: BasicBlockNode.cc:126
MoveNodeGroup::programOperationPtr
ProgramOperationPtr programOperationPtr() const
Definition: MoveNodeGroup.hh:75
MoveNodeGroupBuilder::build
MoveNodeGroupList * build(TTAProgram::BasicBlock &bb)
Definition: MoveNodeGroupBuilder.cc:57
DataDependenceEdge::DEP_UNKNOWN
@ DEP_UNKNOWN
Definition: DataDependenceEdge.hh:46
UniversalMachine
Definition: UniversalMachine.hh:56
MoveNodeGroup::isOperation
bool isOperation() const
Definition: MoveNodeGroup.hh:74
BasicBlockNode
Definition: BasicBlockNode.hh:64
LLVMTCEDataDependenceGraphBuilder::buildFromCFG
virtual DataDependenceGraph * buildFromCFG(ControlFlowGraph &cGraph, const UniversalMachine *um=NULL)
Definition: LLVMTCEDataDependenceGraphBuilder.cc:38
DataDependenceGraphBuilder::createOperationEdges
void createOperationEdges(ProgramOperationPtr po)
Definition: DataDependenceGraphBuilder.cc:1141
GraphBase::writeToDotFile
virtual void writeToDotFile(const TCEString &fileName) const
ProgramOperation.hh
DataDependenceGraph::addNode
void addNode(MoveNode &moveNode)
Definition: DataDependenceGraph.cc:144
TTAProgram::BasicBlock
Definition: BasicBlock.hh:85
MoveNode::move
TTAProgram::Move & move()
DataDependenceGraphBuilder::currentDDG_
DataDependenceGraph * currentDDG_
Definition: DataDependenceGraphBuilder.hh:314
DataDependenceGraphBuilder::allParamRegs_
std::set< TCEString > allParamRegs_
Definition: DataDependenceGraphBuilder.hh:100
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
DataDependenceEdge
Definition: DataDependenceEdge.hh:43
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
MoveNodeGroup
Definition: MoveNodeGroup.hh:48
Move.hh
BoostGraph::nodeCount
int nodeCount() const
LLVMTCEDataDependenceGraphBuilder.hh
MoveNodeGroupBuilder::MoveNodeGroupList
std::list< MoveNodeGroup * > MoveNodeGroupList
Definition: MoveNodeGroupBuilder.hh:54
ControlFlowGraph
Definition: ControlFlowGraph.hh:100