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

#include <BFRenameSource.hh>

Inheritance diagram for BFRenameSource:
Inheritance graph
Collaboration diagram for BFRenameSource:
Collaboration graph

Public Member Functions

 BFRenameSource (BF2Scheduler &sched, MoveNode &mn, int originalDDGLC, int targetCycle)
 
virtual bool operator() ()
 
virtual ~BFRenameSource ()
 
- 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 Attributes

MoveNodemn_
 
int originalDDGLC_
 
int targetCycle_
 
- 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)
 
- 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)
 
virtual void undoOnlyMe ()
 
- Static Protected Attributes inherited from BFOptimization
static std::map< MoveNode *, MoveNode *, MoveNode::ComparatorprologMoves_
 

Detailed Description

Definition at line 42 of file BFRenameSource.hh.

Constructor & Destructor Documentation

◆ BFRenameSource()

BFRenameSource::BFRenameSource ( BF2Scheduler sched,
MoveNode mn,
int  originalDDGLC,
int  targetCycle 
)

Definition at line 44 of file BFRenameSource.cc.

45  :
46  BFOptimization(sched), mn_(mn),
47  originalDDGLC_(originalDDGLC),
48  targetCycle_(targetCycle) {}

◆ ~BFRenameSource()

virtual BFRenameSource::~BFRenameSource ( )
inlinevirtual

Definition at line 49 of file BFRenameSource.hh.

49 {}

Member Function Documentation

◆ operator()()

bool BFRenameSource::operator() ( )
virtual

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

Implements Reversible.

Definition at line 51 of file BFRenameSource.cc.

51  {
52 
53  if (sched_.renamer() == nullptr) {
54  return false;
55  }
56 
57  // not yet working with loop scheduling
58  if (ii()) {
59  return false;
60  }
61 
62  TTAProgram::Move& m = mn_.move();
64  if (!t.isGPR()) {
65  return false;
66  }
67 
68  std::shared_ptr<LiveRange> liveRange(ddg().findLiveRange(mn_, false, false));
69  if (liveRange->writes.size() != 1 ||
70  liveRange->reads.empty() ||
71  !liveRange->guards.empty()) {
72  return false;
73  }
74 
75  for (auto i: liveRange->writes) {
76  if (i->isScheduled()) {
77  return false;
78  }
79  }
80 
81  // for reads.
82  for (auto i: liveRange->reads) {
83  if (i->isScheduled()) {
84  return false;
85  }
86  }
87 
88  // for reads.
89  for (auto i: liveRange->guards) {
90  if (i->isScheduled()) {
91  return false;
92  }
93  }
94 
95  return runPreChild(new BFRenameLiveRange(sched_, liveRange, targetCycle_));
96 }

References BFOptimization::ddg(), LiveRange::guards, BFOptimization::ii(), TTAProgram::Terminal::isGPR(), mn_, MoveNode::move(), LiveRange::reads, BF2Scheduler::renamer(), Reversible::runPreChild(), BFOptimization::sched_, TTAProgram::Move::source(), targetCycle_, and LiveRange::writes.

Here is the call graph for this function:

Member Data Documentation

◆ mn_

MoveNode& BFRenameSource::mn_
protected

Definition at line 52 of file BFRenameSource.hh.

Referenced by operator()().

◆ originalDDGLC_

int BFRenameSource::originalDDGLC_
protected

Definition at line 53 of file BFRenameSource.hh.

◆ targetCycle_

int BFRenameSource::targetCycle_
protected

Definition at line 54 of file BFRenameSource.hh.

Referenced by operator()().


The documentation for this class was generated from the following files:
BF2Scheduler::renamer
RegisterRenamer * renamer()
Definition: BF2Scheduler.hh:221
BFOptimization::ii
unsigned int ii() const
Definition: BFOptimization.cc:85
BFRenameSource::originalDDGLC_
int originalDDGLC_
Definition: BFRenameSource.hh:53
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
BFRenameSource::targetCycle_
int targetCycle_
Definition: BFRenameSource.hh:54
TTAProgram::Terminal::isGPR
virtual bool isGPR() const
Definition: Terminal.cc:107
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
TTAProgram::Move
Definition: Move.hh:55
BFRenameLiveRange
Definition: BFRenameLiveRange.hh:45
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
MoveNode::move
TTAProgram::Move & move()
BFRenameSource::mn_
MoveNode & mn_
Definition: BFRenameSource.hh:52
Reversible::runPreChild
bool runPreChild(Reversible *preChild)
Definition: Reversible.cc:127
TTAProgram::Terminal
Definition: Terminal.hh:60
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302