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

#include <BFShareOperandsLate.hh>

Inheritance diagram for BFShareOperandsLate:
Inheritance graph
Collaboration diagram for BFShareOperandsLate:
Collaboration graph

Public Member Functions

 BFShareOperandsLate (BF2Scheduler &sched, MoveNode &mn)
 
virtual 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 ()
 

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 Attributes

MoveNodemn_
 
int operandShareDistance_
 

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 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 42 of file BFShareOperandsLate.hh.

Constructor & Destructor Documentation

◆ BFShareOperandsLate()

BFShareOperandsLate::BFShareOperandsLate ( BF2Scheduler sched,
MoveNode mn 
)

Definition at line 49 of file BFShareOperandsLate.cc.

49 :
53 if (opts != NULL) {
54 if (opts->operandShareDistance() > -1) {
56 }
57 }
58
59}
static CmdLineOptions * cmdLineOptions()
virtual int operandShareDistance() const

References Application::cmdLineOptions(), SchedulerCmdLineOptions::operandShareDistance(), and operandShareDistance_.

Here is the call graph for this function:

Member Function Documentation

◆ operator()()

bool BFShareOperandsLate::operator() ( )
virtual

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

Implements Reversible.

Definition at line 62 of file BFShareOperandsLate.cc.

62 {
63#ifdef DEBUG_BUBBLEFISH_SCHEDULER
64 std::cerr << "\t\tTrying share operands late for: " << mn_.toString()
65 << std::endl;
66#endif
67 TTAProgram::Move& currMove = mn_.move();
68 TTAProgram::Terminal& currDest = currMove.destination();
69 TTAProgram::Terminal& currSrc = currMove.source();
70 if (currSrc.isImmediateRegister() ||
71 currSrc.isFUPort()) {
72 // lets not analyze yet when data in these change
73 return false;
74 }
75
76 if (!currDest.isFUPort() ||
77 currDest.isTriggering() ||
78 currDest.isOpcodeSetting()) {
79#ifdef DEBUG_BUBBLEFISH_SCHEDULER
80 std::cerr << "\t\t\tdest not operand port" << std::endl;
81#endif
82 return false;
83 }
84
85// TTAMachine::RegisterFile* guardRF = NULL;
86// int guardIndex = -1;
87// bool guardInverted = false;
88 if (!currMove.isUnconditional()) {
89 return false;
90 /*
91 TTAMachine::Guard& guard = move.guard().guard();
92 RegisterGuard* rg = dynamic_cast<TTAMachine::RegisterGuard*>(&guard);
93 if (rg) {
94 guardRF = rg->registerFile();
95 guardIndex = rg->registerIndex();
96 guardInverted = rg->isInverted();
97 }
98 */
99 }
100
101
102 int cycle = mn_.cycle();
103 unsigned int idx = rm().instructionIndex(cycle);
104 unsigned int limit = ii() ? std::min(ii(), idx+operandShareDistance_) :
105 std::min((unsigned)rm().largestCycle()+1, idx+operandShareDistance_);
106#ifdef DEBUG_BUBBLEFISH_SCHEDULER
107 std::cerr << "\t\t\tidx: " << idx << " limit:" << limit << std::endl;
108#endif
109 for (unsigned int i = idx; i < limit; i++) {
110 const TTAProgram::Instruction& ins = *rm().instruction(i);
111 for (int j = 0; j < ins.moveCount(); j++) {
112 const TTAProgram::Move& laterMove = ins.move(j);
113 const TTAProgram::Terminal& laterDest = laterMove.destination();
114 if (&laterMove == &currMove) {
115 continue;
116 }
117 if (!laterDest.equals(currDest)) {
118 continue;
119 }
120
121 const TTAProgram::Terminal& laterSrc = laterMove.source();
122 if (laterSrc.equals(currSrc)) {
123 MoveNode& laterNode = ddg().nodeOfMove(laterMove);
124#ifdef DEBUG_BUBBLEFISH_SCHEDULER
125 std::cerr << "\t\t\t\tOriginal scheduled move: " << mn_.toString()
126 << std::endl;
127 std::cerr << "\t\t\t\tLate op sharing Could remove later move: "
128 << laterNode.toString() << std::endl;
129#endif
130 BFShareOperandLate* bfsol =
131 new BFShareOperandLate(sched_,laterNode, mn_);
132 return runPostChild(bfsol);
133 } else {
134#ifdef DEBUG_BUBBLEFISH_SCHEDULER
135 std::cerr << "\t\t\tAnother move overwrites my dest"
136 << ddg().nodeOfMove(laterMove).toString() << std::endl;
137#endif
138 return false;
139 }
140 }
141 for (int j = 0; j < ins.moveCount(); j++) {
142 TTAProgram::Move& laterMove = ins.move(j);
143 TTAProgram::Terminal& laterDest = laterMove.destination();
144 // src is overwritten here
145 if (laterDest.equals(currSrc)) {
146#ifdef DEBUG_BUBBLEFISH_SCHEDULER
147 std::cerr << "\t\t\tOverwrites src: " <<
148 ddg().nodeOfMove(laterMove).toString() << std::endl;
149#endif
150 return false;
151 }
152 }
153 }
154 return false;
155}
unsigned int ii() const
BF2Scheduler & sched_
DataDependenceGraph & ddg()
SimpleResourceManager & rm() const
MoveNode & nodeOfMove(const TTAProgram::Move &move)
int cycle() const
Definition MoveNode.cc:421
std::string toString() const
Definition MoveNode.cc:576
TTAProgram::Move & move()
bool runPostChild(Reversible *preChild)
unsigned int instructionIndex(unsigned int) const
virtual TTAProgram::Instruction * instruction(int cycle) const override
Move & move(int i) const
bool isUnconditional() const
Definition Move.cc:154
Terminal & source() const
Definition Move.cc:302
Terminal & destination() const
Definition Move.cc:323
virtual bool isTriggering() const
Definition Terminal.cc:298
virtual bool isOpcodeSetting() const
Definition Terminal.cc:285
virtual bool equals(const Terminal &other) const =0
virtual bool isImmediateRegister() const
Definition Terminal.cc:97
virtual bool isFUPort() const
Definition Terminal.cc:118

References MoveNode::cycle(), BFOptimization::ddg(), TTAProgram::Move::destination(), TTAProgram::Terminal::equals(), BFOptimization::ii(), SimpleResourceManager::instruction(), SimpleResourceManager::instructionIndex(), TTAProgram::Terminal::isFUPort(), TTAProgram::Terminal::isImmediateRegister(), TTAProgram::Terminal::isOpcodeSetting(), TTAProgram::Terminal::isTriggering(), TTAProgram::Move::isUnconditional(), mn_, MoveNode::move(), TTAProgram::Instruction::move(), TTAProgram::Instruction::moveCount(), DataDependenceGraph::nodeOfMove(), operandShareDistance_, BFOptimization::rm(), Reversible::runPostChild(), BFOptimization::sched_, TTAProgram::Move::source(), and MoveNode::toString().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFShareOperandsLate::undoOnlyMe ( )
protectedvirtual

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 157 of file BFShareOperandsLate.cc.

157 {
158
159}

Member Data Documentation

◆ mn_

MoveNode& BFShareOperandsLate::mn_
private

Definition at line 49 of file BFShareOperandsLate.hh.

Referenced by operator()().

◆ operandShareDistance_

int BFShareOperandsLate::operandShareDistance_
private

Definition at line 50 of file BFShareOperandsLate.hh.

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


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