OpenASIP  2.0
BFUpdateMoveOnBypass.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2020 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 BFUpdateMoveOnBypass.cc
26  *
27  * Definition of scheduler operation which updates move to make a bypass.
28  *
29  * @author Heikki Kultala 2020 (hkultala-no.spam-tuni.fi)
30  * @note rating: red
31  */
32 
33 #include "BFUpdateMoveOnBypass.hh"
34 #include "ProgramOperation.hh"
35 #include "ProgramAnnotation.hh"
36 #include "Move.hh"
37 #include "Terminal.hh"
38 
40 
42 
43  auto& dm = dst_.move();
44  auto& sm = src_.move();
45 
46  // update the move
47  dm.setSource(sm.source().copy());
48 
49  if (!src_.isSourceOperation()) {
50  return true;
51  }
52 
54  srcOp->addOutputNode(dst_);
56 
57  // set fu annotations
58  for (int j = 0; j < sm.annotationCount(); j++) {
59  TTAProgram::ProgramAnnotation anno = sm.annotation(j);
60  if (anno.id() == ProgramAnnotation::ANN_ALLOWED_UNIT_SRC) {
61  dm.addAnnotation(
63  ProgramAnnotation::ANN_ALLOWED_UNIT_SRC,
64  anno.payload()));
65  }
66  if (anno.id() ==
67  ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC) {
68  dm.addAnnotation(
70  ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC,
71  anno.payload()));
72  }
73  if (anno.id() ==
74  ProgramAnnotation::ANN_REJECTED_UNIT_SRC) {
75  dm.addAnnotation(
77  ProgramAnnotation::ANN_REJECTED_UNIT_SRC,
78  anno.payload()));
79  }
80  }
81  return true;
82 }
83 
85  // unset programoperation from bypassed
86  if (dst_.isSourceOperation()) {
88  srcOp.removeOutputNode(dst_);
90 
91  // unset fu annotations
98  }
99  // do the actual unmerge by returning source to original register.
101 }
BFUpdateMoveOnBypass.hh
TTAProgram::ProgramAnnotation::ANN_REJECTED_UNIT_SRC
@ ANN_REJECTED_UNIT_SRC
Src. unit rejected.
Definition: ProgramAnnotation.hh:118
TTAProgram::Move::destination
Terminal & destination() const
Definition: Move.cc:323
ProgramOperation
Definition: ProgramOperation.hh:70
BFUpdateMoveOnBypass::operator()
bool operator()() override
Definition: BFUpdateMoveOnBypass.cc:41
Terminal.hh
BFUpdateMoveOnBypass::undoOnlyMe
void undoOnlyMe() override
Definition: BFUpdateMoveOnBypass.cc:84
ProgramOperationPtr
std::shared_ptr< ProgramOperation > ProgramOperationPtr
Definition: MoveNode.hh:52
MoveNode::setSourceOperationPtr
void setSourceOperationPtr(ProgramOperationPtr po)
Definition: MoveNode.cc:541
MoveNode::sourceOperation
ProgramOperation & sourceOperation() const
Definition: MoveNode.cc:453
TTAProgram::ProgramAnnotation::ANN_ALLOWED_UNIT_SRC
@ ANN_ALLOWED_UNIT_SRC
Candidate units can be passed for resource manager for choosing the source/destination unit of the mo...
Definition: ProgramAnnotation.hh:112
TTAProgram::ProgramAnnotation::id
ProgramAnnotation::Id id() const
Definition: ProgramAnnotation.cc:111
TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC
@ ANN_CONN_CANDIDATE_UNIT_SRC
Src. unit candidate.
Definition: ProgramAnnotation.hh:115
MoveNode::isSourceOperation
bool isSourceOperation() const
Definition: MoveNode.cc:168
MoveNode::unsetSourceOperation
void unsetSourceOperation()
Definition: MoveNode.cc:760
BFUpdateMoveOnBypass::src_
MoveNode & src_
Definition: BFUpdateMoveOnBypass.hh:54
ProgramOperation.hh
MoveNode::move
TTAProgram::Move & move()
BFUpdateMoveOnBypass::dst_
MoveNode & dst_
Definition: BFUpdateMoveOnBypass.hh:55
TTAProgram::Terminal::copy
virtual Terminal * copy() const =0
MoveNode::sourceOperationPtr
ProgramOperationPtr sourceOperationPtr() const
Definition: MoveNode.cc:458
TTAProgram::ProgramAnnotation
Definition: ProgramAnnotation.hh:49
TTAProgram::AnnotatedInstructionElement::removeAnnotations
void removeAnnotations(ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID)
Definition: AnnotatedInstructionElement.cc:146
Move.hh
ProgramAnnotation.hh
TTAProgram::ProgramAnnotation::payload
const std::vector< Byte > & payload() const
Definition: ProgramAnnotation.cc:121
TTAProgram::Move::setSource
void setSource(Terminal *src)
Definition: Move.cc:312
ProgramOperation::removeOutputNode
void removeOutputNode(MoveNode &node, int outputIndex)
Definition: ProgramOperation.cc:214