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

#include <BFShareOperandLate.hh>

Inheritance diagram for BFShareOperandLate:
Inheritance graph
Collaboration diagram for BFShareOperandLate:
Collaboration graph

Public Member Functions

 BFShareOperandLate (BF2Scheduler &sched, MoveNode &removed, MoveNode &scheduled)
 
virtual bool operator() ()
 
virtual ~BFShareOperandLate ()
 
- Public Member Functions inherited from BFShareOperand
 BFShareOperand (BF2Scheduler &sched, MoveNode &removed, MoveNode &shared)
 
virtual ~BFShareOperand ()
 
- 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

virtual void undoOnlyMe ()
 
- 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)
 

Private Member Functions

void revert (int cycle)
 

Private Attributes

int originalCycle_
 
const TTAMachine::BusoriginalRemovedBus_
 
const TTAMachine::BusoriginalSharedBus_
 
const TTAMachine::BusoriginalRemovedPrologBus_
 
const TTAMachine::BusoriginalSharedPrologBus_
 
int removedImmWriteCycle_
 
int removedPrologImmWriteCycle_
 
const TTAMachine::ImmediateUnitremovedImmu_
 
int removedImmRegIndex_
 
int sharedImmWriteCycle_
 
int sharedPrologImmWriteCycle_
 
const TTAMachine::ImmediateUnitsharedImmu_
 
int sharedImmRegIndex_
 

Additional Inherited Members

- Static Public Member Functions inherited from BFOptimization
static void clearPrologMoves ()
 
static MoveNodegetSisterTrigger (const MoveNode &mn, const TTAMachine::Machine &mach)
 
- Protected Attributes inherited from BFShareOperand
MoveNoderemoved_
 
MoveNodeshared_
 
std::vector< ProgramOperationPtrops_
 
std::set< ProgramOperationPtrcreatedPrologPOs_
 
- Protected Attributes inherited from BFOptimization
BF2Schedulersched_
 
- Protected Attributes inherited from Reversible
std::stack< Reversible * > preChildren_
 
std::stack< Reversible * > postChildren_
 
- Static Protected Attributes inherited from BFOptimization
static std::map< MoveNode *, MoveNode *, MoveNode::ComparatorprologMoves_
 

Detailed Description

Definition at line 46 of file BFShareOperandLate.hh.

Constructor & Destructor Documentation

◆ BFShareOperandLate()

BFShareOperandLate::BFShareOperandLate ( BF2Scheduler sched,
MoveNode removed,
MoveNode scheduled 
)
inline

Definition at line 48 of file BFShareOperandLate.hh.

51  :
52  BFShareOperand(sched, removed, scheduled), originalCycle_(-1),
57  removedImmu_(NULL),
61  sharedImmu_(NULL),
62  sharedImmRegIndex_(-1) {}

◆ ~BFShareOperandLate()

virtual BFShareOperandLate::~BFShareOperandLate ( )
inlinevirtual

Definition at line 64 of file BFShareOperandLate.hh.

64 {}

Member Function Documentation

◆ operator()()

bool BFShareOperandLate::operator() ( )
virtual

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

Reimplemented from BFShareOperand.

Definition at line 52 of file BFShareOperandLate.cc.

52  {
53 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
54  std::cerr << "Sharing oeprand late: removing: " << removed_.toString()
55  << " shared: " << shared_.toString() << std::endl;
56 #endif
60 
65  }
66 
71  }
72 
73  MoveNode* removedPrologMN = ii() ? duplicator().getMoveNode(removed_) : NULL;
74  if (removedPrologMN != NULL) {
75  originalRemovedPrologBus_ = &removedPrologMN->move().bus();
76  if (removedPrologMN->move().source().isImmediateRegister()) {
78  prologRM()->immediateWriteCycle(*removedPrologMN);
79  }
80  }
81  MoveNode* sharedPrologMN = ii() ? duplicator().getMoveNode(shared_) : NULL;
82  if (sharedPrologMN != NULL) {
83  originalSharedPrologBus_ = &sharedPrologMN->move().bus();
84  if (sharedPrologMN->move().source().isImmediateRegister()) {
86  prologRM()->immediateWriteCycle(*sharedPrologMN);
87  }
88  }
89 
90  int cycle = shared_.cycle();
91  MoveNode* removedOpTrigger = removed_.destinationOperation().triggeringMove();
92 
93  unassign(shared_, false);
94  unassign(removed_, false);
97  if (BFShareOperand::operator()()) {
98  if (canAssign(cycle, shared_)) {
99  assign(cycle, shared_);
100 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
101  std::cerr << "\t\t\t\tShare operand late OK for: "
102  << shared_.toString() << std::endl;
103  std::cerr << "\t\t\t\tRescheduling trigger closer:"
104  << removedOpTrigger->toString() << std::endl;
105 #endif
106 
107  auto resched =
108  new BFRescheduleResultClose(sched_, *removedOpTrigger, 0);
109 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
110  if (runPostChild(resched)) {
111  std::cerr << "\t\t\tRescheduled trigger closer." << std::endl;
112  }
113 #else
114  runPostChild(resched);
115 #endif
116  return true;
117  } else {
118 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
119  std::cerr << "\t\t\t\tShare operand late FAIL on assign for: "
120  << shared_.toString() << std::endl;
121 #endif
123  revert(cycle);
124  return false;
125  }
126  } else {
127  revert(cycle);
128  return false;
129  }
130 }

References BFOptimization::assign(), TTAProgram::Move::bus(), BFOptimization::canAssign(), MoveNode::cycle(), BFOptimization::ddg(), MoveNode::destinationOperation(), BoostGraph< GraphNode, GraphEdge >::dropNode(), BFOptimization::duplicator(), MoveNodeDuplicator::getMoveNode(), BFOptimization::ii(), TTAProgram::Terminal::immediateUnit(), SimpleResourceManager::immediateWriteCycle(), TTAProgram::Terminal::index(), TTAProgram::Terminal::isImmediateRegister(), MoveNode::move(), BF2Scheduler::nodeAndCopyKilled(), originalCycle_, originalRemovedBus_, originalRemovedPrologBus_, originalSharedBus_, originalSharedPrologBus_, BFOptimization::prologRM(), BFShareOperand::removed_, removedImmRegIndex_, removedImmu_, removedImmWriteCycle_, removedPrologImmWriteCycle_, revert(), BFOptimization::rm(), Reversible::runPostChild(), BFOptimization::sched_, BFShareOperand::shared_, sharedImmRegIndex_, sharedImmu_, sharedImmWriteCycle_, sharedPrologImmWriteCycle_, TTAProgram::Move::source(), MoveNode::toString(), ProgramOperation::triggeringMove(), BFOptimization::unassign(), and BFShareOperand::undoOnlyMe().

Here is the call graph for this function:

◆ revert()

void BFShareOperandLate::revert ( int  cycle)
private

Definition at line 139 of file BFShareOperandLate.cc.

139  {
140 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
141  assert(
142  canAssign(
143  cycle, shared_, originalSharedBus_, NULL, NULL,
147 
148 #endif
149  assign(cycle, shared_, originalSharedBus_, NULL, NULL,
153 
156 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
158  NULL, NULL, originalRemovedPrologBus_,
161  std::cerr << "Cannot return to original: " << removed_.toString()
162  << std::endl
163  << "dest PO: " << removed_.destinationOperation().toString()
164  << std::endl
165  << "original cycle: " << originalCycle_ << std::endl;
167  for (int i = 0; i < ins->moveCount(); i++) {
168  TTAProgram::Move& m = ins->move(i);
169  std::cerr << "\t" << POMDisassembler::disassemble(m)
170  << " bus: " << m.bus().name() << std::endl;
171  }
172  assert(false);
173  }
174 #endif
176  NULL, NULL, originalRemovedPrologBus_,
179 }

References assert, BFOptimization::assign(), TTAProgram::Move::bus(), BFOptimization::canAssign(), BFOptimization::ddg(), MoveNode::destinationOperation(), POMDisassembler::disassemble(), SimpleResourceManager::instruction(), TTAProgram::Instruction::move(), TTAProgram::Instruction::moveCount(), TTAMachine::Component::name(), BF2Scheduler::nodeResurrected(), originalCycle_, originalRemovedBus_, originalRemovedPrologBus_, originalSharedBus_, originalSharedPrologBus_, BFShareOperand::removed_, removedImmRegIndex_, removedImmu_, removedImmWriteCycle_, removedPrologImmWriteCycle_, BoostGraph< GraphNode, GraphEdge >::restoreNodeFromParent(), BFOptimization::rm(), BFOptimization::sched_, BFShareOperand::shared_, sharedImmRegIndex_, sharedImmu_, sharedImmWriteCycle_, sharedPrologImmWriteCycle_, MoveNode::toString(), and ProgramOperation::toString().

Referenced by operator()(), and undoOnlyMe().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFShareOperandLate::undoOnlyMe ( )
protectedvirtual

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

Reimplemented from BFShareOperand.

Definition at line 132 of file BFShareOperandLate.cc.

132  {
133  int cycle = shared_.cycle();
134  unassign(shared_, false);
136  revert(cycle);
137 }

References MoveNode::cycle(), revert(), BFShareOperand::shared_, BFOptimization::unassign(), and BFShareOperand::undoOnlyMe().

Here is the call graph for this function:

Member Data Documentation

◆ originalCycle_

int BFShareOperandLate::originalCycle_
private

Definition at line 69 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ originalRemovedBus_

const TTAMachine::Bus* BFShareOperandLate::originalRemovedBus_
private

Definition at line 70 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ originalRemovedPrologBus_

const TTAMachine::Bus* BFShareOperandLate::originalRemovedPrologBus_
private

Definition at line 72 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ originalSharedBus_

const TTAMachine::Bus* BFShareOperandLate::originalSharedBus_
private

Definition at line 71 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ originalSharedPrologBus_

const TTAMachine::Bus* BFShareOperandLate::originalSharedPrologBus_
private

Definition at line 73 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ removedImmRegIndex_

int BFShareOperandLate::removedImmRegIndex_
private

Definition at line 78 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ removedImmu_

const TTAMachine::ImmediateUnit* BFShareOperandLate::removedImmu_
private

Definition at line 77 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ removedImmWriteCycle_

int BFShareOperandLate::removedImmWriteCycle_
private

Definition at line 75 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ removedPrologImmWriteCycle_

int BFShareOperandLate::removedPrologImmWriteCycle_
private

Definition at line 76 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ sharedImmRegIndex_

int BFShareOperandLate::sharedImmRegIndex_
private

Definition at line 83 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ sharedImmu_

const TTAMachine::ImmediateUnit* BFShareOperandLate::sharedImmu_
private

Definition at line 82 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ sharedImmWriteCycle_

int BFShareOperandLate::sharedImmWriteCycle_
private

Definition at line 80 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().

◆ sharedPrologImmWriteCycle_

int BFShareOperandLate::sharedPrologImmWriteCycle_
private

Definition at line 81 of file BFShareOperandLate.hh.

Referenced by operator()(), and revert().


The documentation for this class was generated from the following files:
BFShareOperandLate::originalCycle_
int originalCycle_
Definition: BFShareOperandLate.hh:69
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::Instruction::move
Move & move(int i) const
Definition: Instruction.cc:193
TTAProgram::Terminal::index
virtual int index() const
Definition: Terminal.cc:274
BFOptimization::ii
unsigned int ii() const
Definition: BFOptimization.cc:85
TTAProgram::Instruction
Definition: Instruction.hh:57
TTAProgram::Move::bus
const TTAMachine::Bus & bus() const
Definition: Move.cc:373
MoveNode
Definition: MoveNode.hh:65
BoostGraph::dropNode
virtual void dropNode(Node &node)
ProgramOperation::triggeringMove
MoveNode * triggeringMove() const
Definition: ProgramOperation.cc:643
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
BFShareOperandLate::sharedImmWriteCycle_
int sharedImmWriteCycle_
Definition: BFShareOperandLate.hh:80
assert
#define assert(condition)
Definition: Application.hh:86
BFShareOperandLate::originalRemovedPrologBus_
const TTAMachine::Bus * originalRemovedPrologBus_
Definition: BFShareOperandLate.hh:72
TTAProgram::Terminal::isImmediateRegister
virtual bool isImmediateRegister() const
Definition: Terminal.cc:97
BFShareOperandLate::removedImmu_
const TTAMachine::ImmediateUnit * removedImmu_
Definition: BFShareOperandLate.hh:77
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
BFOptimization::prologRM
SimpleResourceManager * prologRM() const
Definition: BFOptimization.cc:77
BFRescheduleResultClose
Definition: BFRescheduleResultClose.hh:44
BF2Scheduler::nodeAndCopyKilled
void nodeAndCopyKilled(MoveNode &mn)
Definition: BF2Scheduler.cc:803
BFShareOperandLate::removedImmWriteCycle_
int removedImmWriteCycle_
Definition: BFShareOperandLate.hh:75
BFShareOperand::BFShareOperand
BFShareOperand(BF2Scheduler &sched, MoveNode &removed, MoveNode &shared)
Definition: BFShareOperand.hh:45
BFShareOperandLate::sharedPrologImmWriteCycle_
int sharedPrologImmWriteCycle_
Definition: BFShareOperandLate.hh:81
BFShareOperandLate::removedPrologImmWriteCycle_
int removedPrologImmWriteCycle_
Definition: BFShareOperandLate.hh:76
TTAProgram::Terminal::immediateUnit
virtual const TTAMachine::ImmediateUnit & immediateUnit() const
Definition: Terminal.cc:240
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
TTAProgram::Move
Definition: Move.hh:55
BFShareOperandLate::originalSharedBus_
const TTAMachine::Bus * originalSharedBus_
Definition: BFShareOperandLate.hh:71
BFShareOperand::undoOnlyMe
virtual void undoOnlyMe()
Definition: BFShareOperand.cc:92
BFOptimization::rm
SimpleResourceManager & rm() const
Definition: BFOptimization.cc:76
BFShareOperandLate::originalSharedPrologBus_
const TTAMachine::Bus * originalSharedPrologBus_
Definition: BFShareOperandLate.hh:73
BFShareOperand::shared_
MoveNode & shared_
Definition: BFShareOperand.hh:53
MoveNodeDuplicator::getMoveNode
MoveNode * getMoveNode(MoveNode &mn)
Definition: MoveNodeDuplicator.cc:85
MoveNode::destinationOperation
ProgramOperation & destinationOperation(unsigned int index=0) const
MoveNode::move
TTAProgram::Move & move()
ProgramOperation::toString
std::string toString() const
Definition: ProgramOperation.cc:746
POMDisassembler::disassemble
static std::string disassemble(const TTAProgram::Move &move)
Definition: POMDisassembler.cc:629
BF2Scheduler::nodeResurrected
void nodeResurrected(MoveNode &mn)
Definition: BF2Scheduler.cc:811
BFShareOperandLate::sharedImmu_
const TTAMachine::ImmediateUnit * sharedImmu_
Definition: BFShareOperandLate.hh:82
BFShareOperandLate::originalRemovedBus_
const TTAMachine::Bus * originalRemovedBus_
Definition: BFShareOperandLate.hh:70
BFShareOperandLate::revert
void revert(int cycle)
Definition: BFShareOperandLate.cc:139
BFShareOperandLate::removedImmRegIndex_
int removedImmRegIndex_
Definition: BFShareOperandLate.hh:78
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
Reversible::runPostChild
bool runPostChild(Reversible *preChild)
Definition: Reversible.cc:139
BFShareOperandLate::sharedImmRegIndex_
int sharedImmRegIndex_
Definition: BFShareOperandLate.hh:83
BFOptimization::canAssign
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)
Definition: BFOptimization.cc:495
TTAProgram::Instruction::moveCount
int moveCount() const
Definition: Instruction.cc:176
SimpleResourceManager::instruction
virtual TTAProgram::Instruction * instruction(int cycle) const override
Definition: SimpleResourceManager.cc:442
BoostGraph::restoreNodeFromParent
void restoreNodeFromParent(GraphNode &node)