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

#include <BFEarlyBypasser.hh>

Inheritance diagram for BFEarlyBypasser:
Inheritance graph
Collaboration diagram for BFEarlyBypasser:
Collaboration graph

Public Member Functions

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

Private Member Functions

int bypassSourceLatestCycle (MoveNode &bypassSrc, MoveNode &bypassDst)
 

Private Attributes

MoveNodedst_
 
int bypassDistance_ = 5
 

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 ()
 
- 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 BFEarlyBypasser.hh.

Constructor & Destructor Documentation

◆ BFEarlyBypasser()

BFEarlyBypasser::BFEarlyBypasser ( BF2Scheduler sched,
MoveNode mn 
)

Definition at line 141 of file BFEarlyBypasser.cc.

141 :
142 BFOptimization(sched), dst_(mn) {
145 if (opts != NULL && opts->bypassDistance() > -1) {
147 }
148}
static CmdLineOptions * cmdLineOptions()

References SchedulerCmdLineOptions::bypassDistance(), bypassDistance_, and Application::cmdLineOptions().

Here is the call graph for this function:

Member Function Documentation

◆ bypassSourceLatestCycle()

int BFEarlyBypasser::bypassSourceLatestCycle ( MoveNode bypassSrc,
MoveNode bypassDst 
)
private

Checks that bypass source does not WHAT???

Definition at line 91 of file BFEarlyBypasser.cc.

92 {
94
95 int lc = INT_MAX;
96
97 if (bypassSrc.isSourceOperation()) {
98 ProgramOperation& po = bypassSrc.sourceOperation();
99 for (int j = 0; j < po.inputMoveCount(); j++) {
100 MoveNode& inputMove = po.inputMove(j);
101 // may also be a shared operand
102 if (!sched_.isPreLoopSharedOperand(inputMove)) {
103 nodes.insert(&inputMove);
104 }
105 }
106
107 for (int j = 0; j < po.outputMoveCount(); j++) {
108 MoveNode& outputMove = po.outputMove(j);
109 if (!sched_.isDeadResult(outputMove)) {
110 nodes.insert(&outputMove);
111 }
112 }
113 } else {
114 nodes.insert(&bypassSrc);
115 }
116
117 for (auto mn : nodes) {
119 for (auto e : edges) {
120 MoveNode& head = ddg().headNode(*e);
121 if (head.isScheduled()) {
122 lc = std::min(lc, head.cycle());
123 continue;
124 }
125 if (&head == &bypassDst || head.isInFrontier() ||
126 e->isBackEdge() || nodes.count(&head)) {
127 continue;
128 }
129#ifdef DEBUG_BUBBLEFISH_SCHEDULER
130 std::cerr << "\t\t\t\tEdge almost preventing bypass from: "
131 << bypassSrc.toString() << "to: " <<bypassDst.toString()
132 << ": " << e->toString() << " dst: "
133 << head.toString() << std::endl;
134#endif
135 return -1;
136 }
137 }
138 return lc;
139}
bool isDeadResult(MoveNode &mn) const
TTAMachine::FUPort * isPreLoopSharedOperand(MoveNode &mn) const
BF2Scheduler & sched_
DataDependenceGraph & ddg()
virtual Node & headNode(const Edge &edge) const
virtual EdgeSet outEdges(const Node &node) const
std::set< GraphNode *, typename GraphNode::Comparator > NodeSet
Definition Graph.hh:53
std::set< GraphEdge *, typename GraphEdge::Comparator > EdgeSet
Definition Graph.hh:54
int cycle() const
Definition MoveNode.cc:421
bool isInFrontier() const
ProgramOperation & sourceOperation() const
Definition MoveNode.cc:453
std::string toString() const
Definition MoveNode.cc:576
bool isSourceOperation() const
Definition MoveNode.cc:168
bool isScheduled() const
Definition MoveNode.cc:409
int outputMoveCount() const
int inputMoveCount() const
MoveNode & inputMove(int index) const
MoveNode & outputMove(int index) const

References MoveNode::cycle(), BFOptimization::ddg(), BoostGraph< GraphNode, GraphEdge >::headNode(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), BF2Scheduler::isDeadResult(), MoveNode::isInFrontier(), BF2Scheduler::isPreLoopSharedOperand(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), BoostGraph< GraphNode, GraphEdge >::outEdges(), ProgramOperation::outputMove(), ProgramOperation::outputMoveCount(), BFOptimization::sched_, MoveNode::sourceOperation(), and MoveNode::toString().

Referenced by operator()().

Here is the call graph for this function:

◆ operator()()

bool BFEarlyBypasser::operator() ( )
virtual

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

Implements Reversible.

Definition at line 48 of file BFEarlyBypasser.cc.

48 {
49
50 if (bypassDistance_ == 0) return false;
51
53 if (bypassEdge == NULL) {
54 return false;
55 }
56 MoveNode& src = ddg().tailNode(*bypassEdge);
57
58 if (sched_.currentFront()->illegalBypassSources_.count(&src)) {
59#ifdef DEBUG_BUBBLEFISH_SCHEDULER
60 std::cerr << "Bypass source illegal: " << src.toString() << std::endl;
61#endif
62 return 0;
63 }
64
65 if (!ddg().guardsAllowBypass(src, dst_, bypassEdge->isBackEdge())) {
66 return false;
67 }
68
70 src, dst_, sched_.targetMachine())) {
71 return false;
72 }
73
74 int bypassSourceLC = bypassSourceLatestCycle(src, dst_);
75 if (bypassSourceLC == -1) {
76 return false;
77 }
78
79 if (bypassEdge->isBackEdge()) {
80 if (!src.isScheduled() || src.cycle() < (int)ii()) {
81 return false;
82 }
83 } else {
84 return runPreChild(new BFEarlyBypass(sched_, src, dst_));
85 }
86 return false;
87}
DataDependenceGraph::NodeSet illegalBypassSources_
const TTAMachine::Machine & targetMachine() const
DataDependenceEdge * findBypassEdge(const MoveNode &mn)
BF2ScheduleFront * currentFront()
int bypassSourceLatestCycle(MoveNode &bypassSrc, MoveNode &bypassDst)
unsigned int ii() const
virtual Node & tailNode(const Edge &edge) const
static bool canBypass(const MoveNode &src, const MoveNode &user, const TTAMachine::Machine &targetMachine)
bool runPreChild(Reversible *preChild)

References bypassDistance_, bypassSourceLatestCycle(), MachineConnectivityCheck::canBypass(), BF2Scheduler::currentFront(), MoveNode::cycle(), BFOptimization::ddg(), dst_, BF2Scheduler::findBypassEdge(), BFOptimization::ii(), BF2ScheduleFront::illegalBypassSources_, DataDependenceEdge::isBackEdge(), MoveNode::isScheduled(), Reversible::runPreChild(), BFOptimization::sched_, BoostGraph< GraphNode, GraphEdge >::tailNode(), BF2Scheduler::targetMachine(), and MoveNode::toString().

Here is the call graph for this function:

Member Data Documentation

◆ bypassDistance_

int BFEarlyBypasser::bypassDistance_ = 5
private

Definition at line 50 of file BFEarlyBypasser.hh.

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

◆ dst_

MoveNode& BFEarlyBypasser::dst_
private

Definition at line 49 of file BFEarlyBypasser.hh.

Referenced by operator()().


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