OpenASIP  2.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BFRenameLiveRange Class Reference

#include <BFRenameLiveRange.hh>

Inheritance diagram for BFRenameLiveRange:
Inheritance graph
Collaboration diagram for BFRenameLiveRange:
Collaboration graph

Public Member Functions

 BFRenameLiveRange (BF2Scheduler &sched, std::shared_ptr< LiveRange > liveRange, int targetCycle)
 
virtual bool operator() ()
 
virtual ~BFRenameLiveRange ()
 
- 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 ()
 

Protected Member Functions

void undoSetTerminal ()
 
void setTerminals ()
 
void setGuard (TTAProgram::Move &move, const TTAMachine::RegisterFile &rf, int regIndex)
 
void setRegDefsAndLastUses ()
 
void undoSetRegDefsAndLastUses ()
 
void setFirstDefsAndUses ()
 
void undoSetFirstDefsAndUses ()
 
void setOutgoingDeps ()
 
void setIncomingDeps ()
 
void unsetIncomingDeps ()
 
void unsetOutgoingDeps ()
 
void undoNewAntiDeps ()
 
void notifySelector ()
 
bool renameLiveRange (class LiveRange &liveRange, const class TCEString &reg, bool usedAfter)
 
virtual void undoOnlyMe () override
 
- 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

DataDependenceGraph::UndoData undoWriteUpdateData_
 
std::map< const MoveNode *, DataDependenceGraph::UndoData, MoveNode::ComparatorundoReadUpdateData_
 
class TTAProgram::TerminaloldReg_
 
std::shared_ptr< LiveRangeliveRange_
 
TTAProgram::BasicBlockbb_
 
TCEString newReg_
 
MoveNodeUse oldLastKill_
 
MoveNodeUse oldKill_
 
int targetCycle_
 
LiveRangeData::MoveNodeUseSet oldRegDefines_
 
LiveRangeData::MoveNodeUseSet oldRegFirstDefines_
 
LiveRangeData::MoveNodeUseSet oldRegFirstUses_
 
DataDependenceGraph::EdgeSet createdAntidepEdges_
 
- Protected Attributes inherited from BFOptimization
BF2Schedulersched_
 
- Protected Attributes inherited from Reversible
std::stack< Reversible * > preChildren_
 
std::stack< Reversible * > postChildren_
 

Additional Inherited Members

- Static Public Member Functions inherited from BFOptimization
static void clearPrologMoves ()
 
static MoveNodegetSisterTrigger (const MoveNode &mn, const TTAMachine::Machine &mach)
 
- Static Protected Attributes inherited from BFOptimization
static std::map< MoveNode *, MoveNode *, MoveNode::ComparatorprologMoves_
 

Detailed Description

Definition at line 45 of file BFRenameLiveRange.hh.

Constructor & Destructor Documentation

◆ BFRenameLiveRange()

BFRenameLiveRange::BFRenameLiveRange ( BF2Scheduler sched,
std::shared_ptr< LiveRange liveRange,
int  targetCycle 
)

Definition at line 52 of file BFRenameLiveRange.cc.

55  :
56  BFOptimization(sched), oldReg_(nullptr), liveRange_(liveRange),
57  targetCycle_(targetCycle) {}

◆ ~BFRenameLiveRange()

BFRenameLiveRange::~BFRenameLiveRange ( )
virtual

Definition at line 478 of file BFRenameLiveRange.cc.

478  {
479  delete oldReg_;
480 }

References oldReg_.

Member Function Documentation

◆ notifySelector()

void BFRenameLiveRange::notifySelector ( )
protected

Definition at line 419 of file BFRenameLiveRange.cc.

419  {
420  // then update ddg and notify selector.
421 
422  // for writes.
423  for (auto i: liveRange_->writes) {
424  DataDependenceGraph::NodeSet writeSuccessors =
425  ddg().successors(*i);
426  DataDependenceGraph::NodeSet writePredecessors =
427  ddg().predecessors(*i);
428 
429  // notify successors of write to prevent orphan nodes.
430  for (auto j: writeSuccessors) {
432  }
433 
434  // notify successors of write to prevent orphan nodes.
435  for (auto j: writePredecessors) {
437  }
438 
439  }
440 
441  // for reads
442  for (auto i: liveRange_->reads) {
443  DataDependenceGraph::NodeSet successors =
444  ddg().successors(*i);
445  DataDependenceGraph::NodeSet predecessors =
446  ddg().predecessors(*i);
447 
448  // notify successors to prevent orphan nodes.
449  for (auto j: successors) {
451  }
452 
453  // notify successors to prevent orphan nodes.
454  for (auto j: predecessors) {
456  }
457  }
458 
459  // for guards
460  for (auto i: liveRange_->guards) {
461  DataDependenceGraph::NodeSet successors =
462  ddg().successors(*i);
463  DataDependenceGraph::NodeSet predecessors =
464  ddg().predecessors(*i);
465 
466  // notify successors to prevent orphan nodes.
467  for (auto j: successors) {
469  }
470 
471  // notify successors to prevent orphan nodes.
472  for (auto j: predecessors) {
474  }
475  }
476 }

References BF2Scheduler::currentFront(), BFOptimization::ddg(), liveRange_, BF2ScheduleFront::mightBeReady(), BoostGraph< GraphNode, GraphEdge >::predecessors(), BFOptimization::sched_, and BoostGraph< GraphNode, GraphEdge >::successors().

Referenced by renameLiveRange().

Here is the call graph for this function:

◆ operator()()

bool BFRenameLiveRange::operator() ( )
virtual

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

Implements Reversible.

Definition at line 60 of file BFRenameLiveRange.cc.

60  {
61 
62  bb_ = &sched_.renamer()->bb();
63 
64  assert(!liveRange_->reads.empty());
65 
66  auto rfs = sched_.renamer()->findConnectedRFs(*liveRange_, false);
67 
68  bool usedAfter = true;
69  std::set<TCEString> regs;
70 
71  if (!ii()) {
72 
74  rfs, targetCycle_);
75  }
76 
77  if (regs.empty()) {
78  usedAfter = false;
79  regs = sched_.renamer()->findFreeRegistersInRF(rfs);
80  }
81 
82  if (regs.empty()) {
83  return false;
84  }
85 
86  return renameLiveRange(*liveRange_, *regs.begin(), usedAfter);
87 }

References assert, RegisterRenamer::bb(), bb_, RegisterRenamer::findConnectedRFs(), RegisterRenamer::findFreeRegistersInRF(), RegisterRenamer::findPartiallyUsedRegistersInRFAfterCycle(), BFOptimization::ii(), liveRange_, renameLiveRange(), BF2Scheduler::renamer(), BFOptimization::sched_, and targetCycle_.

Here is the call graph for this function:

◆ renameLiveRange()

bool BFRenameLiveRange::renameLiveRange ( class LiveRange liveRange,
const class TCEString reg,
bool  usedAfter 
)
protected

Definition at line 319 of file BFRenameLiveRange.cc.

320  {
321 
322  bool usedBefore = false;
323 
324  newReg_ = newReg;
325  oldReg_ = (*liveRange.writes.begin())->move().destination().copy();
326 
327  assert(newReg.length() > 2);
328 
329  if (usedAfter) {
330  TCEString rfName = newReg_.substr(0, newReg_.find('.'));
333  int newRegIndex = atoi(newReg_.substr(newReg_.find('.')+1).c_str());
334  DataDependenceGraph::NodeSet firstWrites =
335  ddg().firstScheduledRegisterWrites(*rf, newRegIndex);
336 
337  // make sure no circular antidep path
338  for (auto j: firstWrites) {
339  for (auto i: liveRange.reads) {
340  if (ddg().hasPath(*j, *i)) {
341  return false;
342  }
343  }
344 
345  for (auto i: liveRange.writes) {
346  if (ddg().hasPath(*j, *i)) {
347  return false;
348  }
349  }
350  }
351 
352  // antideps
353  for (auto j: firstWrites) {
354  for (auto i: liveRange.writes) {
355  DataDependenceEdge* newWAW =
356  new DataDependenceEdge(
359  ddg().connectNodes(*i,*j, *newWAW);
360  createdAntidepEdges_.insert(newWAW);
361  }
362 
363  for (auto i: liveRange.reads) {
364  DataDependenceEdge* newWAR =
365  new DataDependenceEdge(
368  ddg().connectNodes(*i,*j, *newWAR);
369  createdAntidepEdges_.insert(newWAR);
370  }
371  }
372  } else {
373  setOutgoingDeps();
375 
376 
377 // TODO
378 #if 0
379  // need to create backedges to first if we are loop scheduling.
380  if (loopScheduling) {
381  updateAntiEdgesFromLRTo(liveRange, newReg, bb_, 1);
382  }
383 #endif
384  }
385 
386  if (usedBefore) {
387  return false;
388  } else {
389  setIncomingDeps();
391  }
392 
393  setTerminals();
394  notifySelector();
395 
396  // for writes.
397  assert (liveRange_->writes.size() == 1);
398  for (auto i: liveRange_->writes) {
400  }
401 
402  // for reads
403  for (auto i: liveRange_->reads) {
405  }
406 
407  assert(liveRange_->guards.size() == 0);
408  // for guards
409  for (auto i: liveRange_->guards) {
411  }
412 
413  sched_.renamer()->renamedToRegister(newReg);
414  notifySelector();
415  return true;
416 }

References assert, bb_, BoostGraph< GraphNode, GraphEdge >::connectNodes(), TTAProgram::Terminal::copy(), createdAntidepEdges_, BFOptimization::ddg(), DataDependenceEdge::DEP_WAR, DataDependenceEdge::DEP_WAW, DataDependenceGraph::destRenamed(), DataDependenceEdge::EDGE_REGISTER, DataDependenceGraph::firstScheduledRegisterWrites(), DataDependenceGraph::guardRenamed(), TTAMachine::Machine::Navigator< ComponentType >::item(), liveRange_, newReg_, notifySelector(), oldReg_, LiveRange::reads, TTAMachine::Machine::registerFileNavigator(), RegisterRenamer::renamedToRegister(), BF2Scheduler::renamer(), BFOptimization::sched_, setFirstDefsAndUses(), setIncomingDeps(), setOutgoingDeps(), setRegDefsAndLastUses(), setTerminals(), DataDependenceGraph::sourceRenamed(), BFOptimization::targetMachine(), undoReadUpdateData_, undoWriteUpdateData_, and LiveRange::writes.

Referenced by operator()().

Here is the call graph for this function:

◆ setFirstDefsAndUses()

void BFRenameLiveRange::setFirstDefsAndUses ( )
protected

Definition at line 263 of file BFRenameLiveRange.cc.

263  {
264 
265  // for writing.
266  for (auto i: liveRange_->writes) {
267  MoveNodeUse mnd(*i);
269  // TODO: only if intra-bb-antideps enabled?
270 // static_cast<DataDependenceGraph*>(ddg().rootGraph())->
271 // updateRegWrite(mnd, newReg, *bb_);
272  }
273 
274  // for reading.
275  for (auto i: liveRange_->reads) {
276  MoveNodeUse mnd(*i);
277  bb_->liveRangeData_->regFirstUses_[newReg_].insert(mnd);
278  // no need to create raw deps here
279  }
280 
281  // for guards.
282  for (auto i: liveRange_->guards) {
283  MoveNodeUse mnd(*i, true);
284  bb_->liveRangeData_->regFirstUses_[newReg_].insert(mnd);
285  // no need to create raw deps here
286  }
287 }

References bb_, liveRange_, TTAProgram::BasicBlock::liveRangeData_, newReg_, LiveRangeData::regFirstDefines_, and LiveRangeData::regFirstUses_.

Referenced by renameLiveRange().

◆ setGuard()

void BFRenameLiveRange::setGuard ( TTAProgram::Move move,
const TTAMachine::RegisterFile rf,
int  regIndex 
)
protected

Definition at line 117 of file BFRenameLiveRange.cc.

118  {
119 
120  const TTAMachine::Guard& guard = move.guard().guard();
121  TTAMachine::Bus* guardBus = guard.parentBus();
122  for (int j = 0 ; j < guardBus->guardCount(); j++) {
123  TTAMachine::Guard *g = guardBus->guard(j);
125  dynamic_cast<TTAMachine::RegisterGuard*>(g);
126  if (rg) {
127  if (rg->registerFile() == &rf &&
128  rg->registerIndex() == regIndex &&
129  rg->isInverted() == guard.isInverted()) {
130  move.setGuard(new TTAProgram::MoveGuard(*g));
131  }
132  }
133  }
134 }

References TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), TTAMachine::Guard::isInverted(), TTAMachine::Guard::parentBus(), TTAMachine::RegisterGuard::registerFile(), TTAMachine::RegisterGuard::registerIndex(), and TTAProgram::Move::setGuard().

Referenced by setTerminals(), and undoSetTerminal().

Here is the call graph for this function:

◆ setIncomingDeps()

void BFRenameLiveRange::setIncomingDeps ( )
protected

Definition at line 186 of file BFRenameLiveRange.cc.

186  {
187  if (liveRange_->writes.size() != 1 ||
188  !(*liveRange_->writes.begin())->move().isUnconditional()) {
189  return;
190  }
191 
195 }

References bb_, liveRange_, TTAProgram::BasicBlock::liveRangeData_, newReg_, oldKill_, oldRegFirstDefines_, oldRegFirstUses_, LiveRangeData::regFirstDefines_, LiveRangeData::regFirstUses_, and LiveRangeData::regKills_.

Referenced by renameLiveRange().

◆ setOutgoingDeps()

void BFRenameLiveRange::setOutgoingDeps ( )
protected

Definition at line 207 of file BFRenameLiveRange.cc.

207  {
208  if (liveRange_->writes.size() != 1 ||
209  !(*liveRange_->writes.begin())->move().isUnconditional()) {
210  return;
211  }
212 
215 
217  MoveNodeUse(**liveRange_->writes.begin());
219 }

References bb_, liveRange_, TTAProgram::BasicBlock::liveRangeData_, newReg_, oldLastKill_, oldRegDefines_, LiveRangeData::regDefines_, and LiveRangeData::regLastKills_.

Referenced by renameLiveRange().

◆ setRegDefsAndLastUses()

void BFRenameLiveRange::setRegDefsAndLastUses ( )
protected

Definition at line 222 of file BFRenameLiveRange.cc.

222  {
223  // for writing.
224  for (auto i: liveRange_->writes) {
225  MoveNodeUse mnd(*i);
226  bb_->liveRangeData_->regDefines_[newReg_].insert(mnd);
227  }
228 
229  // for reading.
230  for (auto i: liveRange_->reads) {
231  MoveNodeUse mnd(*i);
232  bb_->liveRangeData_->regLastUses_[newReg_].insert(mnd);
233  }
234 
235  // for reading.
236  for (auto i: liveRange_->guards) {
237  MoveNodeUse mnd(*i, true);
238  bb_->liveRangeData_->regLastUses_[newReg_].insert(mnd);
239  }
240 
241 }

References bb_, liveRange_, TTAProgram::BasicBlock::liveRangeData_, newReg_, LiveRangeData::regDefines_, and LiveRangeData::regLastUses_.

Referenced by renameLiveRange().

◆ setTerminals()

void BFRenameLiveRange::setTerminals ( )
protected

Definition at line 89 of file BFRenameLiveRange.cc.

89  {
90 
91  TCEString rfName = newReg_.substr(0, newReg_.find('.'));
94  int newRegIndex = atoi(newReg_.substr(newReg_.find('.')+1).c_str());
95 
96  // for writes.
97  for (auto i: liveRange_->writes) {
98  TTAProgram::Move& move = i->move();
100  *rf->firstWritePort(), newRegIndex));
101  }
102 
103  // for reads.
104  for (auto i: liveRange_->reads) {
105  TTAProgram::Move& move = i->move();
107  *rf->firstReadPort(), newRegIndex));
108  }
109 
110  // for guards.
111  for (auto i: liveRange_->guards) {
112  TTAProgram::Move& move = i->move();
113  setGuard(move, *rf, newRegIndex);
114  }
115 }

References TTAMachine::RegisterFile::firstReadPort(), TTAMachine::RegisterFile::firstWritePort(), TTAMachine::Machine::Navigator< ComponentType >::item(), liveRange_, newReg_, TTAMachine::Machine::registerFileNavigator(), TTAProgram::Move::setDestination(), setGuard(), TTAProgram::Move::setSource(), and BFOptimization::targetMachine().

Referenced by renameLiveRange().

Here is the call graph for this function:

◆ undoNewAntiDeps()

void BFRenameLiveRange::undoNewAntiDeps ( )
protected

Definition at line 179 of file BFRenameLiveRange.cc.

179  {
180  for (auto e: createdAntidepEdges_) {
181  ddg().removeEdge(*e);
182  }
183  createdAntidepEdges_.clear();
184 }

References createdAntidepEdges_, BFOptimization::ddg(), and BoostGraph< GraphNode, GraphEdge >::removeEdge().

Referenced by undoOnlyMe().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFRenameLiveRange::undoOnlyMe ( )
overrideprotectedvirtual

Undoes the operations done by this class but not children. This method should be overloaded by most derived classes.

Reimplemented from Reversible.

Definition at line 158 of file BFRenameLiveRange.cc.

158  {
159  // restore the DDG stage before the rename
160  for (auto i: undoReadUpdateData_) {
161  ddg().undo(i.second);
162  }
164 
165  undoSetTerminal();
166 
169 
172 
174 
175  undoNewAntiDeps();
176 
177 }

References BFOptimization::ddg(), newReg_, BF2Scheduler::renamer(), RegisterRenamer::revertedRenameToRegister(), BFOptimization::sched_, DataDependenceGraph::undo(), undoNewAntiDeps(), undoReadUpdateData_, undoSetFirstDefsAndUses(), undoSetRegDefsAndLastUses(), undoSetTerminal(), undoWriteUpdateData_, unsetIncomingDeps(), and unsetOutgoingDeps().

Here is the call graph for this function:

◆ undoSetFirstDefsAndUses()

void BFRenameLiveRange::undoSetFirstDefsAndUses ( )
protected

Definition at line 289 of file BFRenameLiveRange.cc.

289  {
290 
291  // for writing.
292  for (auto i: liveRange_->writes) {
293  MoveNodeUse mnd(*i);
295 
296 
297  // TODO: only if intra-bb-antideps enabled?
298 // static_cast<DataDependenceGraph*>(ddg().rootGraph())->
299 // updateRegWrite(mnd, newReg, *bb_);
300  }
301 
302  // for reading.
303  for (auto i: liveRange_->reads) {
304  MoveNodeUse mnd(*i);
305  bb_->liveRangeData_->regFirstUses_[newReg_].erase(mnd);
306  }
307 
308  // for guards.
309  for (auto i: liveRange_->guards) {
310  MoveNodeUse mnd(*i, true);
311  bb_->liveRangeData_->regFirstUses_[newReg_].erase(mnd);
312  }
313 }

References bb_, liveRange_, TTAProgram::BasicBlock::liveRangeData_, newReg_, LiveRangeData::regFirstDefines_, and LiveRangeData::regFirstUses_.

Referenced by undoOnlyMe().

◆ undoSetRegDefsAndLastUses()

void BFRenameLiveRange::undoSetRegDefsAndLastUses ( )
protected

Definition at line 243 of file BFRenameLiveRange.cc.

243  {
244  // for writing.
245  for (auto i: liveRange_->writes) {
246  MoveNodeUse mnd(*i);
247  bb_->liveRangeData_->regDefines_[newReg_].erase(mnd);
248  }
249 
250  // for reading.
251  for (auto i: liveRange_->reads) {
252  MoveNodeUse mnd(*i);
253  bb_->liveRangeData_->regLastUses_[newReg_].erase(mnd);
254  }
255 
256  // for reading.
257  for (auto i: liveRange_->guards) {
258  MoveNodeUse mnd(*i, true);
259  bb_->liveRangeData_->regLastUses_[newReg_].erase(mnd);
260  }
261 }

References bb_, liveRange_, TTAProgram::BasicBlock::liveRangeData_, newReg_, LiveRangeData::regDefines_, and LiveRangeData::regLastUses_.

Referenced by undoOnlyMe().

◆ undoSetTerminal()

void BFRenameLiveRange::undoSetTerminal ( )
protected

Definition at line 136 of file BFRenameLiveRange.cc.

136  {
137 
138  // for writes.
139  for (auto i: liveRange_->writes) {
140  TTAProgram::Move& move = i->move();
141  move.setDestination(oldReg_->copy());
142  }
143 
144  // for reads.
145  for (auto i: liveRange_->reads) {
146  TTAProgram::Move& move = i->move();
147  move.setSource(oldReg_->copy());
148  }
149 
150  // for guards
151  for (auto i: liveRange_->guards) {
152  TTAProgram::Move& move = i->move();
153  setGuard(move, oldReg_->registerFile(), oldReg_->index());
154  }
155 
156 }

References TTAProgram::Terminal::copy(), TTAProgram::Terminal::index(), liveRange_, oldReg_, TTAProgram::Terminal::registerFile(), TTAProgram::Move::setDestination(), setGuard(), and TTAProgram::Move::setSource().

Referenced by undoOnlyMe().

Here is the call graph for this function:

◆ unsetIncomingDeps()

void BFRenameLiveRange::unsetIncomingDeps ( )
protected

◆ unsetOutgoingDeps()

void BFRenameLiveRange::unsetOutgoingDeps ( )
protected

Member Data Documentation

◆ bb_

TTAProgram::BasicBlock* BFRenameLiveRange::bb_
protected

◆ createdAntidepEdges_

DataDependenceGraph::EdgeSet BFRenameLiveRange::createdAntidepEdges_
protected

Definition at line 97 of file BFRenameLiveRange.hh.

Referenced by renameLiveRange(), and undoNewAntiDeps().

◆ liveRange_

std::shared_ptr<LiveRange> BFRenameLiveRange::liveRange_
protected

◆ newReg_

TCEString BFRenameLiveRange::newReg_
protected

◆ oldKill_

MoveNodeUse BFRenameLiveRange::oldKill_
protected

Definition at line 91 of file BFRenameLiveRange.hh.

Referenced by setIncomingDeps(), and unsetIncomingDeps().

◆ oldLastKill_

MoveNodeUse BFRenameLiveRange::oldLastKill_
protected

Definition at line 90 of file BFRenameLiveRange.hh.

Referenced by setOutgoingDeps(), and unsetOutgoingDeps().

◆ oldReg_

class TTAProgram::Terminal* BFRenameLiveRange::oldReg_
protected

Definition at line 85 of file BFRenameLiveRange.hh.

Referenced by renameLiveRange(), undoSetTerminal(), and ~BFRenameLiveRange().

◆ oldRegDefines_

LiveRangeData::MoveNodeUseSet BFRenameLiveRange::oldRegDefines_
protected

Definition at line 94 of file BFRenameLiveRange.hh.

Referenced by setOutgoingDeps(), and unsetOutgoingDeps().

◆ oldRegFirstDefines_

LiveRangeData::MoveNodeUseSet BFRenameLiveRange::oldRegFirstDefines_
protected

Definition at line 95 of file BFRenameLiveRange.hh.

Referenced by setIncomingDeps(), and unsetIncomingDeps().

◆ oldRegFirstUses_

LiveRangeData::MoveNodeUseSet BFRenameLiveRange::oldRegFirstUses_
protected

Definition at line 96 of file BFRenameLiveRange.hh.

Referenced by setIncomingDeps(), and unsetIncomingDeps().

◆ targetCycle_

int BFRenameLiveRange::targetCycle_
protected

Definition at line 92 of file BFRenameLiveRange.hh.

Referenced by operator()().

◆ undoReadUpdateData_

std::map<const MoveNode*, DataDependenceGraph::UndoData, MoveNode::Comparator> BFRenameLiveRange::undoReadUpdateData_
protected

Definition at line 83 of file BFRenameLiveRange.hh.

Referenced by renameLiveRange(), and undoOnlyMe().

◆ undoWriteUpdateData_

DataDependenceGraph::UndoData BFRenameLiveRange::undoWriteUpdateData_
protected

Definition at line 79 of file BFRenameLiveRange.hh.

Referenced by renameLiveRange(), and undoOnlyMe().


The documentation for this class was generated from the following files:
TTAMachine::RegisterFile::firstReadPort
Port * firstReadPort() const
Definition: RegisterFile.cc:607
TTAMachine::Guard
Definition: Guard.hh:55
BFRenameLiveRange::setOutgoingDeps
void setOutgoingDeps()
Definition: BFRenameLiveRange.cc:207
LiveRangeData::regLastKills_
MoveNodeUseMapPair regLastKills_
Definition: LiveRangeData.hh:80
BoostGraph::predecessors
virtual NodeSet predecessors(const Node &node, bool ignoreBackEdges=false, bool ignoreForwardEdges=false) const
BoostGraph::connectNodes
virtual void connectNodes(const Node &nTail, const Node &nHead, Edge &e)
BFRenameLiveRange::setIncomingDeps
void setIncomingDeps()
Definition: BFRenameLiveRange.cc:186
BF2Scheduler::renamer
RegisterRenamer * renamer()
Definition: BF2Scheduler.hh:221
BoostGraph::removeEdge
virtual void removeEdge(Edge &e)
RegisterRenamer::renamedToRegister
void renamedToRegister(const TCEString &newReg)
Definition: RegisterRenamer.cc:1094
BFRenameLiveRange::undoSetRegDefsAndLastUses
void undoSetRegDefsAndLastUses()
Definition: BFRenameLiveRange.cc:243
TTAProgram::Terminal::index
virtual int index() const
Definition: Terminal.cc:274
BFRenameLiveRange::liveRange_
std::shared_ptr< LiveRange > liveRange_
Definition: BFRenameLiveRange.hh:86
BFRenameLiveRange::newReg_
TCEString newReg_
Definition: BFRenameLiveRange.hh:88
BFRenameLiveRange::undoSetFirstDefsAndUses
void undoSetFirstDefsAndUses()
Definition: BFRenameLiveRange.cc:289
TTAMachine::RegisterGuard::registerIndex
int registerIndex() const
TTAProgram::Terminal::registerFile
virtual const TTAMachine::RegisterFile & registerFile() const
Definition: Terminal.cc:225
BFOptimization::ii
unsigned int ii() const
Definition: BFOptimization.cc:85
BoostGraph< MoveNode, DataDependenceEdge >::NodeSet
std::set< MoveNode *, typename MoveNode ::Comparator > NodeSet
Definition: BoostGraph.hh:86
MoveNodeUse
Definition: MoveNodeUse.hh:20
TTAMachine::Bus
Definition: Bus.hh:53
BFRenameLiveRange::oldRegFirstDefines_
LiveRangeData::MoveNodeUseSet oldRegFirstDefines_
Definition: BFRenameLiveRange.hh:95
BFRenameLiveRange::setTerminals
void setTerminals()
Definition: BFRenameLiveRange.cc:89
RegisterRenamer::findConnectedRFs
RegisterFileSet findConnectedRFs(LiveRange &lr, bool allowLimm)
Definition: RegisterRenamer.cc:1206
LiveRangeData::regDefines_
MoveNodeUseMapSet regDefines_
Definition: LiveRangeData.hh:78
DataDependenceGraph::guardRenamed
DataDependenceGraph::UndoData guardRenamed(MoveNode &mn)
Definition: DataDependenceGraph.cc:5006
TTAProgram::Move::setGuard
void setGuard(MoveGuard *guard)
Definition: Move.cc:360
LiveRangeData::regKills_
MoveNodeUseMapPair regKills_
Definition: LiveRangeData.hh:85
DataDependenceEdge::EDGE_REGISTER
@ EDGE_REGISTER
Definition: DataDependenceEdge.hh:53
BFRenameLiveRange::unsetIncomingDeps
void unsetIncomingDeps()
Definition: BFRenameLiveRange.cc:196
BFOptimization::targetMachine
const TTAMachine::Machine & targetMachine() const
Definition: BFOptimization.cc:81
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
BFRenameLiveRange::createdAntidepEdges_
DataDependenceGraph::EdgeSet createdAntidepEdges_
Definition: BFRenameLiveRange.hh:97
assert
#define assert(condition)
Definition: Application.hh:86
BFRenameLiveRange::undoReadUpdateData_
std::map< const MoveNode *, DataDependenceGraph::UndoData, MoveNode::Comparator > undoReadUpdateData_
Definition: BFRenameLiveRange.hh:83
DataDependenceGraph::undo
void undo(UndoData &undoData)
Definition: DataDependenceGraph.cc:5898
BFRenameLiveRange::oldRegFirstUses_
LiveRangeData::MoveNodeUseSet oldRegFirstUses_
Definition: BFRenameLiveRange.hh:96
TTAProgram::Move::setDestination
void setDestination(Terminal *dst)
Definition: Move.cc:333
RegisterRenamer::bb
TTAProgram::BasicBlock & bb()
Definition: RegisterRenamer.hh:102
TTAMachine::RegisterFile::firstWritePort
Port * firstWritePort() const
Definition: RegisterFile.cc:618
BFRenameLiveRange::undoSetTerminal
void undoSetTerminal()
Definition: BFRenameLiveRange.cc:136
BFRenameLiveRange::undoWriteUpdateData_
DataDependenceGraph::UndoData undoWriteUpdateData_
Definition: BFRenameLiveRange.hh:79
TTAProgram::BasicBlock::liveRangeData_
LiveRangeData * liveRangeData_
Definition: BasicBlock.hh:111
BFRenameLiveRange::unsetOutgoingDeps
void unsetOutgoingDeps()
Definition: BFRenameLiveRange.cc:202
BFRenameLiveRange::setRegDefsAndLastUses
void setRegDefsAndLastUses()
Definition: BFRenameLiveRange.cc:222
BFRenameLiveRange::notifySelector
void notifySelector()
Definition: BFRenameLiveRange.cc:419
TTAMachine::RegisterGuard
Definition: Guard.hh:137
BF2ScheduleFront::mightBeReady
void mightBeReady(MoveNode &n) override
Definition: BF2ScheduleFront.cc:701
BFRenameLiveRange::oldReg_
class TTAProgram::Terminal * oldReg_
Definition: BFRenameLiveRange.hh:85
TTAProgram::Move::guard
MoveGuard & guard() const
Definition: Move.cc:345
LiveRangeData::regFirstDefines_
MoveNodeUseMapSet regFirstDefines_
Definition: LiveRangeData.hh:87
LiveRangeData::regLastUses_
MoveNodeUseMapSet regLastUses_
Definition: LiveRangeData.hh:79
BFRenameLiveRange::oldLastKill_
MoveNodeUse oldLastKill_
Definition: BFRenameLiveRange.hh:90
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
TTAProgram::Move
Definition: Move.hh:55
BFRenameLiveRange::setFirstDefsAndUses
void setFirstDefsAndUses()
Definition: BFRenameLiveRange.cc:263
TTAMachine::Bus::guardCount
int guardCount() const
Definition: Bus.cc:441
TTAMachine::Bus::guard
Guard * guard(int index) const
Definition: Bus.cc:456
DataDependenceEdge::DEP_WAW
@ DEP_WAW
Definition: DataDependenceEdge.hh:49
BFRenameLiveRange::undoNewAntiDeps
void undoNewAntiDeps()
Definition: BFRenameLiveRange.cc:179
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
TTAMachine::Guard::parentBus
virtual Bus * parentBus() const
BFRenameLiveRange::bb_
TTAProgram::BasicBlock * bb_
Definition: BFRenameLiveRange.hh:87
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
BF2Scheduler::currentFront
BF2ScheduleFront * currentFront()
Definition: BF2Scheduler.hh:188
TTAMachine::Guard::isInverted
virtual bool isInverted() const
DataDependenceGraph::destRenamed
DataDependenceGraph::UndoData destRenamed(MoveNode &mn)
Definition: DataDependenceGraph.cc:5055
TCEString
Definition: TCEString.hh:53
TTAProgram::Terminal::copy
virtual Terminal * copy() const =0
BFRenameLiveRange::oldRegDefines_
LiveRangeData::MoveNodeUseSet oldRegDefines_
Definition: BFRenameLiveRange.hh:94
DataDependenceGraph::firstScheduledRegisterWrites
NodeSet firstScheduledRegisterWrites(const TTAMachine::BaseRegisterFile &rf, int registerIndex) const
Definition: DataDependenceGraph.cc:1245
DataDependenceEdge
Definition: DataDependenceEdge.hh:43
BFRenameLiveRange::setGuard
void setGuard(TTAProgram::Move &move, const TTAMachine::RegisterFile &rf, int regIndex)
Definition: BFRenameLiveRange.cc:117
RegisterRenamer::findFreeRegistersInRF
std::set< TCEString > findFreeRegistersInRF(const RegisterFileSet &rfs) const
Definition: RegisterRenamer.cc:223
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
TTAProgram::MoveGuard::guard
const TTAMachine::Guard & guard() const
Definition: MoveGuard.cc:86
RegisterRenamer::revertedRenameToRegister
void revertedRenameToRegister(const TCEString &reg)
Definition: RegisterRenamer.cc:1106
DataDependenceEdge::DEP_WAR
@ DEP_WAR
Definition: DataDependenceEdge.hh:48
TTAProgram::MoveGuard
Definition: MoveGuard.hh:47
TTAMachine::RegisterGuard::registerFile
const RegisterFile * registerFile() const
BoostGraph::successors
virtual NodeSet successors(const Node &node, bool ignoreBackEdges=false, bool ignoreForwardEdges=false) const
BFRenameLiveRange::oldKill_
MoveNodeUse oldKill_
Definition: BFRenameLiveRange.hh:91
RegisterRenamer::findPartiallyUsedRegistersInRFAfterCycle
std::set< TCEString > findPartiallyUsedRegistersInRFAfterCycle(const RegisterFileSet &rfs, int latestCycle) const
Definition: RegisterRenamer.cc:310
BFRenameLiveRange::targetCycle_
int targetCycle_
Definition: BFRenameLiveRange.hh:92
BFRenameLiveRange::renameLiveRange
bool renameLiveRange(class LiveRange &liveRange, const class TCEString &reg, bool usedAfter)
Definition: BFRenameLiveRange.cc:319
TTAProgram::TerminalRegister
Definition: TerminalRegister.hh:53
LiveRangeData::regFirstUses_
MoveNodeUseMapSet regFirstUses_
Definition: LiveRangeData.hh:86
TTAProgram::Move::setSource
void setSource(Terminal *src)
Definition: Move.cc:312
DataDependenceGraph::sourceRenamed
DataDependenceGraph::UndoData sourceRenamed(MoveNode &mn)
Definition: DataDependenceGraph.cc:4970