OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BFPushMoveUp2 Class Reference

#include <BFPushMoveUp2.hh>

Inheritance diagram for BFPushMoveUp2:
Inheritance graph
Collaboration diagram for BFPushMoveUp2:
Collaboration graph

Public Member Functions

 BFPushMoveUp2 (BF2Scheduler &sched, MoveNode &mn, int lc)
 
bool operator() ()
 
- Public Member Functions inherited from BFUnscheduleMove
 BFUnscheduleMove (BF2Scheduler &sched, MoveNode &mn)
 
void unscheduleOriginal ()
 
void undoOnlyMe ()
 
bool operator() ()
 
- Public Member Functions inherited from BFOptimization
 BFOptimization (BF2Scheduler &sched)
 
virtual bool isFinishFront ()
 
virtual void mightBeReady (MoveNode &mn)
 
- Public Member Functions inherited from Reversible
virtual void undo ()
 
virtual ~Reversible ()
 
void deleteChildren (std::stack< Reversible * > &children)
 
int id ()
 
 Reversible ()
 

Private Member Functions

bool isLoopBypass (MoveNode &mn)
 

Private Attributes

int lc_
 

Additional Inherited Members

- Static Public Member Functions inherited from BFOptimization
static void clearPrologMoves ()
 
static MoveNodegetSisterTrigger (const MoveNode &mn, const TTAMachine::Machine &mach)
 
- Protected Member Functions inherited from BFUnscheduleMove
void returnOriginal ()
 
- Protected Member Functions inherited from BFOptimization
DataDependenceGraphddg ()
 
DataDependenceGraphrootDDG ()
 
const DataDependenceGraphddg () const
 
DataDependenceGraphprologDDG ()
 
SimpleResourceManagerrm () const
 
SimpleResourceManagerprologRM () const
 
BUMoveNodeSelectorselector ()
 
const TTAMachine::MachinetargetMachine () const
 
unsigned int ii () const
 
MoveNodeDuplicatorduplicator () const
 
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)
 
virtual void unassign (MoveNode &mn, bool disposePrologCopy=true)
 
virtual int rmEC (int cycle, MoveNode &mn, 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)
 
virtual int rmLC (int cycle, MoveNode &mn, 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)
 
virtual bool canAssign (int cycle, MoveNode &mn, 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 ignoreGWN=false)
 
bool putAlsoToPrologEpilog (int cycle, MoveNode &mn)
 
void setPrologSrcFUAnno (MoveNode &prologMN, MoveNode &loopMN)
 
void setPrologDstFUAnno (MoveNode &prologMN, MoveNode &loopMN)
 
void setJumpGuard (MoveNode &mn)
 
void unsetJumpGuard (MoveNode &mn)
 
bool needJumpGuard (const MoveNode &mn, int cycle)
 
int jumpGuardAvailableCycle (const MoveNode &mn)
 
bool canBeSpeculated (const Operation &op)
 
bool canBeSpeculated (const MoveNode &mn)
 
bool usePrologMove (const MoveNode &mn)
 
bool canBeScheduled (const MoveNode &mn)
 
const TTAMachine::RegisterFileRFReadPortCountPreventsScheduling (const MoveNode &mn)
 
bool immCountPreventsScheduling (const MoveNode &mn)
 
- Protected Member Functions inherited from Reversible
bool runPreChild (Reversible *preChild)
 
bool runPostChild (Reversible *preChild)
 
bool runChild (std::stack< Reversible * > &children, Reversible *child)
 
bool runChild (Reversible *child, bool pre)
 
void undoAndRemovePreChildren ()
 
void undoAndRemovePostChildren ()
 
void undoAndRemoveChildren (std::stack< Reversible * > &children)
 
- Protected Attributes inherited from BFUnscheduleMove
MoveNodemn_
 
int oldCycle_
 
const TTAMachine::BusoldBus_
 
const TTAMachine::BusprologBus_
 
int oldImmWriteCycle_
 
int prologImmWriteCycle_
 
const TTAMachine::FunctionUnitdstFU_
 
const TTAMachine::FunctionUnitsrcFU_
 
const TTAMachine::ImmediateUnitimmu_
 
int immRegIndex_
 
- Protected Attributes inherited from BFOptimization
BF2Schedulersched_
 
- Protected Attributes inherited from Reversible
std::stack< Reversible * > preChildren_
 
std::stack< Reversible * > postChildren_
 
- Static Protected Attributes inherited from BFUnscheduleMove
static int recurseCounter_ = 0
 
- Static Protected Attributes inherited from BFOptimization
static std::map< MoveNode *, MoveNode *, MoveNode::ComparatorprologMoves_
 

Detailed Description

Definition at line 51 of file BFPushMoveUp2.hh.

Constructor & Destructor Documentation

◆ BFPushMoveUp2()

BFPushMoveUp2::BFPushMoveUp2 ( BF2Scheduler sched,
MoveNode mn,
int  lc 
)
inline

Definition at line 54 of file BFPushMoveUp2.hh.

Member Function Documentation

◆ isLoopBypass()

bool BFPushMoveUp2::isLoopBypass ( MoveNode mn)
private

Definition at line 181 of file BFPushMoveUp2.cc.

181 {
182 auto inEdges = ddg().operationInEdges(mn);
183 for (auto e: inEdges) {
184 if (e->isBackEdge()) {
185 return true;
186 }
187 }
188
189 return false;
190}
DataDependenceGraph & ddg()
EdgeSet operationInEdges(const MoveNode &node) const

References BFOptimization::ddg(), and DataDependenceGraph::operationInEdges().

Referenced by operator()().

Here is the call graph for this function:

◆ operator()()

bool BFPushMoveUp2::operator() ( )
virtual

This performs the operation. Returns true if success, false if fail.

Implements Reversible.

Definition at line 48 of file BFPushMoveUp2.cc.

48 {
49
50 if (lc_ == -1) {
51 std::cerr << "incoming lc -1 on pushmoveup!" << std::endl;
52 assert(false);
53 }
54 if (mn_.move().isControlFlowMove()) {
55#ifdef DEBUG_BUBBLEFISH_SCHEDULER
56 std::cerr << "\t\t|TCannot reschedule control flow move!" << std::endl;
57#endif
58 return false;
59 }
60
61 if (&mn_ == sched_.guardWriteNode()) {
62#ifdef DEBUG_BUBBLEFISH_SCHEDULER
63 std::cerr << "\t\t|TCannot reschedule guard write move!" << std::endl;
64#endif
65 return false;
66 }
67
68 if (!mn_.isSourceOperation()) {
69 return false;
70 }
71
72 // unschedule this (result) move
74 MoveNode* trigger = po.triggeringMove();
76
77 int ddgLC = ddg().latestCycle(mn_,ii());
78 int ddgEC = ddg().earliestCycle(mn_,ii());
79
80 if (ddgLC == -1) {
81#ifdef DEBUG_BUBBLEFISH_SCHEDULER
82 std::cerr << "ddg latest cycle -1 in pushmoveup2 of:"
83 << mn_.toString() << std::endl;
84#endif
86 return false;
87 }
88
89 int lc = std::min(lc_, ddgLC);
90
91 if (ddgEC > lc) {
92 DataDependenceGraph::NodeSet unschedOperands;
93 DataDependenceGraph::NodeSet unschedResults;
94 // undo the inputs
95 for (int i = 0; i < po.inputMoveCount(); i++) {
96 MoveNode& operand = po.inputMove(i);
97 if (operand.isScheduled()) {
98 if (!runPostChild(new BFUnscheduleMove(sched_, operand))) {
99 undo();
100 return false;
101 } else {
102 unschedOperands.insert(&operand);
103 }
104 }
105 }
106
107 for (int i = 0; i < po.outputMoveCount(); i++) {
108 MoveNode& res = po.outputMove(i);
109 if (res.isScheduled() &&
110 (res.cycle() > lc ||
111 (isLoopBypass(res) && res.cycle()+((signed)ii()) > lc))) {
112 if (!runPostChild(new BFUnscheduleMove(sched_, res))) {
113 undo();
114 return false;
115 } else {
116 unschedResults.insert(&res);
117 }
118#ifdef DEBUG_BUBBLEFISH_SCHEDULER
119 } else {
120 std::cerr << "res which is not scheduled:" << res.toString()
121 << std::endl;
122#endif
123 }
124 }
125
126 // now whole op is not scheduled?
127
128 // reschedule other results
129 for (int i = po.outputMoveCount()-1; i >= 0; i--) {
130 MoveNode& res = po.outputMove(i);
131 if (AssocTools::containsKey(unschedResults, &res)) {
132 int myLC = lc - isLoopBypass(res) * ii();
133 if (!runPostChild(
134 new BFScheduleBU(
135 sched_, res, myLC, false, false, false))) {
136 undo();
137 return false;
138 }
139 }
140 }
141
142 // reschedule me.
143 if (!runPostChild(
144 new BFScheduleBU(sched_, mn_, lc, false, false, false))) {
145 undo();
146 return false;
147 }
148
149 // reschdule trigger
150 if (AssocTools::containsKey(unschedOperands, trigger)) {
151 if (!runPostChild(
152 new BFScheduleBU(
153 sched_, *trigger, lc, false, false, false))) {
154 undo();
155 return false;
156 }
157 }
158
159 // reschedule other operands
160 for (int i = 0; i < po.inputMoveCount(); i++) {
161 MoveNode& operand = po.inputMove(i);
162 if (&operand != trigger) {
163 if (AssocTools::containsKey(unschedOperands, &operand)) {
164 if (!runPostChild(
165 new BFScheduleBU(
166 sched_, operand, lc, false, false, false))) {
167 undo();
168 return false;
169 }
170 }
171 }
172 }
173 } else {
174 undo();
175 return false;
176 }
178 return true;
179}
#define assert(condition)
static bool containsKey(const ContainerType &aContainer, const KeyType &aKey)
MoveNode * guardWriteNode()
unsigned int ii() const
BF2Scheduler & sched_
bool isLoopBypass(MoveNode &mn)
int latestCycle(const MoveNode &moveNode, unsigned int ii=UINT_MAX, bool ignoreRegAntideps=false, bool ignoreUnscheduledSuccessors=true, bool ignoreGuards=false, bool ignoreFUDeps=false, bool ignoreSameOperationEdges=false) const
int earliestCycle(const MoveNode &moveNode, unsigned int ii=UINT_MAX, bool ignoreRegWaRs=false, bool ignoreRegWaWs=false, bool ignoreGuards=false, bool ignoreFUDeps=false, bool ignoreSameOperationEdges=false, bool assumeBypassing=false) const
std::set< GraphNode *, typename GraphNode::Comparator > NodeSet
Definition Graph.hh:53
int cycle() const
Definition MoveNode.cc:421
ProgramOperation & sourceOperation() const
Definition MoveNode.cc:453
std::string toString() const
Definition MoveNode.cc:576
TTAProgram::Move & move()
bool isSourceOperation() const
Definition MoveNode.cc:168
bool isScheduled() const
Definition MoveNode.cc:409
int outputMoveCount() const
int inputMoveCount() const
MoveNode * triggeringMove() const
MoveNode & inputMove(int index) const
MoveNode & outputMove(int index) const
bool runPostChild(Reversible *preChild)
virtual void undo()
Definition Reversible.cc:69
bool isControlFlowMove() const
Definition Move.cc:233

References assert, AssocTools::containsKey(), MoveNode::cycle(), BFOptimization::ddg(), DataDependenceGraph::earliestCycle(), BF2Scheduler::guardWriteNode(), BFOptimization::ii(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), TTAProgram::Move::isControlFlowMove(), isLoopBypass(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), DataDependenceGraph::latestCycle(), lc_, BFUnscheduleMove::mn_, MoveNode::move(), ProgramOperation::outputMove(), ProgramOperation::outputMoveCount(), BFUnscheduleMove::returnOriginal(), Reversible::runPostChild(), BFOptimization::sched_, MoveNode::sourceOperation(), MoveNode::toString(), ProgramOperation::triggeringMove(), Reversible::undo(), and BFUnscheduleMove::unscheduleOriginal().

Here is the call graph for this function:

Member Data Documentation

◆ lc_

int BFPushMoveUp2::lc_
private

Definition at line 62 of file BFPushMoveUp2.hh.

Referenced by operator()().


The documentation for this class was generated from the following files: