OpenASIP 2.2
Loading...
Searching...
No Matches
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),
const TTAMachine::ImmediateUnit * removedImmu_
const TTAMachine::ImmediateUnit * sharedImmu_
const TTAMachine::Bus * originalSharedPrologBus_
const TTAMachine::Bus * originalRemovedPrologBus_

◆ ~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();
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}
void nodeAndCopyKilled(MoveNode &mn)
unsigned int ii() const
BF2Scheduler & sched_
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)
SimpleResourceManager * prologRM() const
DataDependenceGraph & ddg()
virtual void unassign(MoveNode &mn, bool disposePrologCopy=true)
MoveNodeDuplicator & duplicator() const
SimpleResourceManager & rm() 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)
const TTAMachine::Bus * originalSharedBus_
const TTAMachine::Bus * originalRemovedBus_
MoveNode & removed_
MoveNode & shared_
virtual void undoOnlyMe()
virtual void dropNode(Node &node)
MoveNode * getMoveNode(MoveNode &mn)
int cycle() const
Definition MoveNode.cc:421
std::string toString() const
Definition MoveNode.cc:576
TTAProgram::Move & move()
ProgramOperation & destinationOperation(unsigned int index=0) const
MoveNode * triggeringMove() const
bool runPostChild(Reversible *preChild)
virtual int immediateWriteCycle(const MoveNode &) const
Terminal & source() const
Definition Move.cc:302
const TTAMachine::Bus & bus() const
Definition Move.cc:373
virtual int index() const
Definition Terminal.cc:274
virtual bool isImmediateRegister() const
Definition Terminal.cc:97
virtual const TTAMachine::ImmediateUnit & immediateUnit() const
Definition Terminal.cc:240

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}
#define assert(condition)
void nodeResurrected(MoveNode &mn)
void restoreNodeFromParent(GraphNode &node)
static std::string disassemble(const TTAProgram::Move &move)
std::string toString() const
virtual TTAProgram::Instruction * instruction(int cycle) const override
virtual TCEString name() const
Move & move(int i) const

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: