OpenASIP 2.2
Loading...
Searching...
No Matches
BFEarlyBypass.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 BFEarlyBypass.cc
27 *
28 * Definition of BFEarlyBypass class
29 *
30 * Performs a bypass before scheduling an (operand) move
31 *
32 * @author Heikki Kultala 2014-2020(heikki.kultala-no.spam-tuni.fi)
33 * @note rating: red
34 */
35
36#include "BFEarlyBypass.hh"
37#include "BFDREEarly.hh"
40#include "BF2Scheduler.hh"
41#include "BF2ScheduleFront.hh"
42#include "Machine.hh"
43#include "BFMergeAndKeepUser.hh"
44
45//#define DEBUG_BUBBLEFISH_SCHEDULER
46//#define DEBUG_LOOP_SCHEDULER
47#ifdef DEBUG_BUBBLEFISH_SCHEDULER
48#define DEBUG_LOOP_SCHEDULER
49#endif
50
51bool
53
54#ifdef DEBUG_LOOP_SCHEDULER
55 if (ii() != 0) {
56 std::cerr << "\t\t\tEarly bypass for: " << src_.toString()
57 << " to " << dst_.toString() << std::endl;
58 }
59#endif
60 // Take the predecssors so that they can be notified because their
61 // antideps may change
63
66 return false;
67 }
68
69 // if alwayswriteresults, then must have exactly one result write.
70 if (targetMachine().alwaysWriteResults()) {
71 // if destination is variable, we have two variable writes. MUST DRE.
73 BFDREEarly* dre = new BFDREEarly(sched_,src_);
74 if (!runPostChild(dre)) {
75 undo();
76 return false;
77 }
78 }
79 // if destination is not variable, must NOT DRE.
80 } else {
81 BFDREEarly* dre = new BFDREEarly(sched_,src_);
82 runPostChild(dre);
83 }
85#ifdef DEBUG_BUBBLEFISH_SCHEDULER
86 std::cerr << "\t\tEarly bypass ok for: " << dst_.toString() << std::endl;
87#endif
88
89 // now notify antideps sources
90 for (auto i : pred) {
91 mightBeReady(*i);
92 }
93
94 return true;
95}
96
97void
#define assert(condition)
void bypassed(MoveNode &src, MoveNode &dst)
void undidBypass(MoveNode &, MoveNode &dst)
BF2ScheduleFront * currentFront()
MoveNode & dst_
bool operator()() override
void undoOnlyMe() override
MoveNode & src_
virtual void mightBeReady(MoveNode &mn)
unsigned int ii() const
BF2Scheduler & sched_
DataDependenceGraph & ddg()
const TTAMachine::Machine & targetMachine() const
virtual NodeSet predecessors(const Node &node, bool ignoreBackEdges=false, bool ignoreForwardEdges=false) const
std::set< GraphNode *, typename GraphNode::Comparator > NodeSet
Definition Graph.hh:53
std::string toString() const
Definition MoveNode.cc:576
bool isScheduled() const
Definition MoveNode.cc:409
bool isDestinationVariable() const
Definition MoveNode.cc:264
bool runPostChild(Reversible *preChild)
virtual void undo()
Definition Reversible.cc:69
bool runPreChild(Reversible *preChild)