OpenASIP  2.0
BFShareOperandWithScheduled.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 BFShareOperandWithScheduled.cc
27  *
28  * Definition of BFShareOperandWithScheduled class
29  *
30  * Performs an operands sharing between two (or more) operations,
31  * between scheudling these operations.
32  *
33  * @author Heikki Kultala 2014-2020(heikki.kultala-no.spam-tuni.fi)
34  * @note rating: red
35  */
36 
37 
39 #include "MoveNode.hh"
40 #include "Move.hh"
41 #include "Terminal.hh"
42 #include "DataDependenceGraph.hh"
43 #include "BF2Scheduler.hh"
44 #include "Bus.hh"
45 #include "MoveNodeDuplicator.hh"
46 #include "SimpleResourceManager.hh"
47 
51 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
52  std::cerr << "\t\t\t\t\tDestination operand index mismatch"
53  << std::endl;
54 #endif
55  return false;
56  }
57 
60 
65  }
66 
67  MoveNode* removedPrologMN = ii() ?
69  NULL;
70  if (removedPrologMN != NULL) {
71  prologBus_ = &removedPrologMN->move().bus();
72 
73  if (removedPrologMN->move().source().isImmediateRegister()) {
75  prologRM()->immediateWriteCycle(*removedPrologMN);
76  }
77 
78 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
79  std::cerr << "\t\t\t\tShareOpWithSched Saving prolog bus: "
80  << prologBus_->name() << std::endl;
81  std::cerr << "\t\t\t\t\tProlog move: " << removedPrologMN->toString()
82  << std::endl;
83 #endif
84  }
85 
86  unassign(removed_, false);
87  if (BFShareOperand::operator()()) {
90 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
91  std::cerr << "\t\t\t\t\tShared operand ok!" << std::endl;
92 #endif
93  return true;
94  } else {
98 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
99  std::cerr << "\t\t\t\t\tShare operand failed!" << std::endl;
100 #endif
101  return false;
102  }
103 }
104 
106 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
107  std::cerr << "\t\t\t\t\tUndoing operandshare: " << shared_.toString()
108  << std::endl;
109 #endif
115  immRegIndex_);
116 }
BFShareOperand::removed_
MoveNode & removed_
Definition: BFShareOperand.hh:52
SimpleResourceManager::immediateWriteCycle
virtual int immediateWriteCycle(const MoveNode &) const
Definition: SimpleResourceManager.cc:520
BFOptimization::unassign
virtual void unassign(MoveNode &mn, bool disposePrologCopy=true)
Definition: BFOptimization.cc:196
BFOptimization::assign
virtual bool assign(int cycle, MoveNode &, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU_=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1, bool ignoreGuardWriteCycle=false)
Definition: BFOptimization.cc:103
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
BFOptimization::duplicator
MoveNodeDuplicator & duplicator() const
Definition: BFOptimization.cc:87
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
TTAProgram::Terminal::index
virtual int index() const
Definition: Terminal.cc:274
BFOptimization::ii
unsigned int ii() const
Definition: BFOptimization.cc:85
TTAProgram::Move::destination
Terminal & destination() const
Definition: Move.cc:323
BFShareOperandWithScheduled::operator()
virtual bool operator()()
Definition: BFShareOperandWithScheduled.cc:48
BFShareOperandWithScheduled::originalCycle_
int originalCycle_
Definition: BFShareOperandWithScheduled.hh:56
BFShareOperandWithScheduled::undoOnlyMe
virtual void undoOnlyMe()
Definition: BFShareOperandWithScheduled.cc:105
TTAProgram::Move::bus
const TTAMachine::Bus & bus() const
Definition: Move.cc:373
DataDependenceGraph.hh
MoveNode
Definition: MoveNode.hh:65
Terminal.hh
BFShareOperandWithScheduled::oldImmWriteCycle_
int oldImmWriteCycle_
Definition: BFShareOperandWithScheduled.hh:60
BoostGraph::dropNode
virtual void dropNode(Node &node)
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
BFShareOperandWithScheduled::prologImmWriteCycle_
int prologImmWriteCycle_
Definition: BFShareOperandWithScheduled.hh:61
BFShareOperandWithScheduled::prologBus_
const TTAMachine::Bus * prologBus_
Definition: BFShareOperandWithScheduled.hh:58
TTAProgram::Terminal::isImmediateRegister
virtual bool isImmediateRegister() const
Definition: Terminal.cc:97
BFShareOperandWithScheduled::immRegIndex_
int immRegIndex_
Definition: BFShareOperandWithScheduled.hh:63
TTAProgram::Terminal::operationIndex
virtual int operationIndex() const
Definition: Terminal.cc:364
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
BFOptimization::prologRM
SimpleResourceManager * prologRM() const
Definition: BFOptimization.cc:77
BF2Scheduler.hh
BF2Scheduler::nodeAndCopyKilled
void nodeAndCopyKilled(MoveNode &mn)
Definition: BF2Scheduler.cc:803
TTAProgram::Terminal::immediateUnit
virtual const TTAMachine::ImmediateUnit & immediateUnit() const
Definition: Terminal.cc:240
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
BFShareOperandWithScheduled::originalRemovedBus_
const TTAMachine::Bus * originalRemovedBus_
Definition: BFShareOperandWithScheduled.hh:57
BFShareOperandWithScheduled::immu_
const TTAMachine::ImmediateUnit * immu_
Definition: BFShareOperandWithScheduled.hh:62
Bus.hh
BFShareOperand::undoOnlyMe
virtual void undoOnlyMe()
Definition: BFShareOperand.cc:92
BFOptimization::rm
SimpleResourceManager & rm() const
Definition: BFOptimization.cc:76
MoveNodeDuplicator.hh
BFShareOperand::shared_
MoveNode & shared_
Definition: BFShareOperand.hh:53
MoveNodeDuplicator::getMoveNode
MoveNode * getMoveNode(MoveNode &mn)
Definition: MoveNodeDuplicator.cc:85
MoveNode::move
TTAProgram::Move & move()
BF2Scheduler::nodeResurrected
void nodeResurrected(MoveNode &mn)
Definition: BF2Scheduler.cc:811
BFShareOperandWithScheduled.hh
SimpleResourceManager.hh
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
Move.hh
MoveNode.hh
BoostGraph::restoreNodeFromParent
void restoreNodeFromParent(GraphNode &node)