OpenASIP  2.0
BFRemoveGuard.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2014 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 /**
26  * @file BFRemoveGuard.cc
27  *
28  * Definition of BFRemoveGuard class
29  *
30  * Tries to remove a guard from a move.
31  *
32  * @author Heikki Kultala 2014-2020(heikki.kultala-no.spam-tuni.fi)
33  * @note rating: red
34  */
35 
36 #include "BFRemoveGuard.hh"
37 #include "Move.hh"
38 #include "MoveGuard.hh"
39 #include "BFRemoveEdge.hh"
40 #include "DataDependenceGraph.hh"
41 
44 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
45  std::cerr << "\t\t\tRemoving guard from move: "
46  << mn_.toString() << std::endl;
47 #endif
48 
49  // remove the guard edges from the ddg
50  auto inEdges = ddg().inEdges(mn_);
51  for (auto e: inEdges) {
52  if (e->guardUse() && !e->isFalseDep()) {
53  runPreChild(new BFRemoveEdge(sched_, ddg().tailNode(*e), mn_,*e));
54  }
55  }
56  auto outEdges = ddg().outEdges(mn_);
57  for (auto e: outEdges) {
58  if (e->guardUse() &&
59  e->dependenceType() == DataDependenceEdge::DEP_WAR) {
60  runPreChild(new BFRemoveEdge(sched_, mn_,ddg().headNode(*e), *e));
61  }
62  }
63 
64  guard_ = mn_.move().guard().copy();
65  mn_.move().setGuard(NULL);
66  return true;
67 }
68 
71 }
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
BFRemoveGuard::operator()
bool operator()() override
Definition: BFRemoveGuard.cc:42
TTAProgram::Move::isUnconditional
bool isUnconditional() const
Definition: Move.cc:154
DataDependenceGraph.hh
TTAProgram::Move::setGuard
void setGuard(MoveGuard *guard)
Definition: Move.cc:360
BFRemoveGuard::mn_
MoveNode & mn_
Definition: BFRemoveGuard.hh:59
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
assert
#define assert(condition)
Definition: Application.hh:86
BFRemoveEdge.hh
BFRemoveEdge
Definition: BFRemoveEdge.hh:40
TTAProgram::Move::guard
MoveGuard & guard() const
Definition: Move.cc:345
BFRemoveGuard.hh
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
BoostGraph::inEdges
virtual EdgeSet inEdges(const Node &node) const
BoostGraph::outEdges
virtual EdgeSet outEdges(const Node &node) const
MoveNode::move
TTAProgram::Move & move()
Reversible::runPreChild
bool runPreChild(Reversible *preChild)
Definition: Reversible.cc:127
BFRemoveGuard::guard_
TTAProgram::MoveGuard * guard_
Definition: BFRemoveGuard.hh:60
TTAProgram::MoveGuard::copy
MoveGuard * copy() const
Definition: MoveGuard.cc:96
Move.hh
DataDependenceEdge::DEP_WAR
@ DEP_WAR
Definition: DataDependenceEdge.hh:48
BFRemoveGuard::undoOnlyMe
void undoOnlyMe() override
Definition: BFRemoveGuard.cc:69
MoveGuard.hh