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

#include <BFShareOperands.hh>

Inheritance diagram for BFShareOperands:
Inheritance graph
Collaboration diagram for BFShareOperands:
Collaboration graph

Public Member Functions

 BFShareOperands (BF2Scheduler &sched, MoveNode &mn, int lc)
 
virtual bool operator() ()
 
virtual bool removedNode ()
 
- 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 maxCycle_
 

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 40 of file BFShareOperands.hh.

Constructor & Destructor Documentation

◆ BFShareOperands()

BFShareOperands::BFShareOperands ( BF2Scheduler sched,
MoveNode mn,
int  lc 
)
inline

Definition at line 42 of file BFShareOperands.hh.

42 :
43 BFOptimization(sched), mn_(mn), maxCycle_(lc+6) {
46 if (opts != NULL) {
47 if (opts->operandShareDistance() > -1) {
48 maxCycle_ = lc + opts->operandShareDistance();
49 }
50 }
51 }
static CmdLineOptions * cmdLineOptions()
virtual int operandShareDistance() const

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

Here is the call graph for this function:

Member Function Documentation

◆ operator()()

bool BFShareOperands::operator() ( )
virtual

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

Implements Reversible.

Definition at line 49 of file BFShareOperands.cc.

49 {
50 // TODO: alctually check the guards
51 if (!mn_.move().isUnconditional()) {
52 return false;
53 }
54
55#ifdef DEBUG_BUBBLEFISH_SCHEDULER
56 std::cerr << "\t\tShareOperands operator() called for:"
57 << mn_.toString() << std::endl;
58#endif
59
62#ifdef DEBUG_BUBBLEFISH_SCHEDULER
63 std::cerr << "\t\t\tIllegal operand share: " << mn_.toString()
64 << std::endl;
65#endif
66 return false;
67 }
68
69 bool didSomething = false;
71 const Operation& op = po.operation();
72 const TTAMachine::FunctionUnit* forcedFU = po.scheduledFU();
73
75 for (auto i : siblings) {
76 if (!i->isDestinationOperation()) {
77 continue;
78 }
79
80 if (i->isScheduled()) {
81 if (i->cycle() > maxCycle_) {
82 continue;
83 }
84 // limit operand sharing for reasonable distances
85 // TODO: use the cmd line parameter
86 int ddglc = ddg().latestCycle(mn_, ii(), false, false);
87 if (i->cycle() < ddglc - 5) {
88 continue;
89 }
90
91 // try share with already scheduled
92 const TTAProgram::Terminal& dt = i->move().destination();
93 if (dt.isFUPort()) {
95 if (!fu.hasOperation(op.name())) {
96 continue;
97 }
98 const TTAMachine::HWOperation* hwop = fu.operation(op.name());
99 const TTAMachine::FUPort *sharedPort =
101 if (sharedPort != &dt.port()) {
102 continue;
103 }
104 if (dt.isTriggering()) {
105 // TODO: is sibling commutative?
106 continue;
107 }
108 if (forcedFU != NULL) {
109 if (&fu == forcedFU) {
110 MoveNode* trigger =
112 mn_, targetMachine());
113 if (trigger == &mn_) {
114 continue;
115 }
116
119 if (runPreChild(sows)) {
120 didSomething = true;
121 }
122 }
123 } else {
124 if (fu.hasOperation(op.name())) {
125 if (sched_.isTrigger(fu, mn_)) {
126 // TODO: change commutative
127 continue;
128 }
129
132 if (runPreChild(sows)) {
133 didSomething = true;
134 }
135 }
136 }
137 }
138 }
139 }
140 return didSomething;
141}
DataDependenceGraph::NodeSet illegalOperandShares_
bool isTrigger(const TTAMachine::Unit &unit, MoveNode &mn)
BF2ScheduleFront * currentFront()
unsigned int ii() const
BF2Scheduler & sched_
static MoveNode * getSisterTrigger(const MoveNode &mn, const TTAMachine::Machine &mach)
DataDependenceGraph & ddg()
const TTAMachine::Machine & targetMachine() const
NodeSet regDepSiblings(const MoveNode &mn) const
int latestCycle(const MoveNode &moveNode, unsigned int ii=UINT_MAX, bool ignoreRegAntideps=false, bool ignoreUnscheduledSuccessors=true, bool ignoreGuards=false, bool ignoreFUDeps=false, bool ignoreSameOperationEdges=false) const
std::set< GraphNode *, typename GraphNode::Comparator > NodeSet
Definition Graph.hh:53
std::string toString() const
Definition MoveNode.cc:576
TTAProgram::Move & move()
ProgramOperation & destinationOperation(unsigned int index=0) const
virtual TCEString name() const
Definition Operation.cc:93
const Operation & operation() const
const TTAMachine::FunctionUnit * scheduledFU() const
bool runPreChild(Reversible *preChild)
virtual HWOperation * operation(const std::string &name) const
virtual bool hasOperation(const std::string &name) const
virtual FUPort * port(int operand) const
bool isUnconditional() const
Definition Move.cc:154
Terminal & destination() const
Definition Move.cc:323
virtual bool isTriggering() const
Definition Terminal.cc:298
virtual const TTAMachine::FunctionUnit & functionUnit() const
Definition Terminal.cc:251
virtual int operationIndex() const
Definition Terminal.cc:364
virtual const TTAMachine::Port & port() const
Definition Terminal.cc:378
virtual bool isFUPort() const
Definition Terminal.cc:118

References BF2Scheduler::currentFront(), BFOptimization::ddg(), TTAProgram::Move::destination(), MoveNode::destinationOperation(), TTAProgram::Terminal::functionUnit(), BFOptimization::getSisterTrigger(), TTAMachine::FunctionUnit::hasOperation(), BFOptimization::ii(), BF2ScheduleFront::illegalOperandShares_, TTAProgram::Terminal::isFUPort(), BF2Scheduler::isTrigger(), TTAProgram::Terminal::isTriggering(), TTAProgram::Move::isUnconditional(), DataDependenceGraph::latestCycle(), maxCycle_, mn_, MoveNode::move(), Operation::name(), ProgramOperation::operation(), TTAMachine::FunctionUnit::operation(), TTAProgram::Terminal::operationIndex(), TTAProgram::Terminal::port(), TTAMachine::HWOperation::port(), DataDependenceGraph::regDepSiblings(), Reversible::runPreChild(), BFOptimization::sched_, ProgramOperation::scheduledFU(), BFOptimization::targetMachine(), and MoveNode::toString().

Here is the call graph for this function:

◆ removedNode()

bool BFShareOperands::removedNode ( )
virtual

Definition at line 145 of file BFShareOperands.cc.

145{ return false; }

◆ undoOnlyMe()

void BFShareOperands::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 143 of file BFShareOperands.cc.

143{}

Member Data Documentation

◆ maxCycle_

int BFShareOperands::maxCycle_
private

Definition at line 59 of file BFShareOperands.hh.

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

◆ mn_

MoveNode& BFShareOperands::mn_
private

Definition at line 58 of file BFShareOperands.hh.

Referenced by operator()().


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