OpenASIP 2.2
Loading...
Searching...
No Matches
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
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
60
61void
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);
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}
TTAProgram::BasicBlock & basicBlock()
int nodeCount() const
Node & node(const int index) const
virtual void connectNodes(const Node &nTail, const Node &nHead, Edge &e)
void createOperationEdges(ProgramOperationPtr po)
void addNode(MoveNode &moveNode)
void addProgramOperation(ProgramOperationPtr po)
virtual void writeToDotFile(const TCEString &fileName) const
virtual DataDependenceGraph * buildFromBB(TTAProgram::BasicBlock &bb, const UniversalMachine *um=NULL)
virtual DataDependenceGraph * buildFromCFG(ControlFlowGraph &cGraph, const UniversalMachine *um=NULL)
std::list< MoveNodeGroup * > MoveNodeGroupList
MoveNodeGroupList * build(TTAProgram::BasicBlock &bb)
ProgramOperationPtr programOperationPtr() const
int nodeCount() const
MoveNode & node(int index) const
bool isOperation() const
TTAProgram::Move & move()
Terminal & source() const
Definition Move.cc:302
virtual bool isFUPort() const
Definition Terminal.cc:118