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

#include <BFRemoveGuardsFromSuccs.hh>

Inheritance diagram for BFRemoveGuardsFromSuccs:
Inheritance graph
Collaboration diagram for BFRemoveGuardsFromSuccs:
Collaboration graph

Public Member Functions

 BFRemoveGuardsFromSuccs (BF2Scheduler &sched, MoveNode &guardWrite, int oldLC, int maxLC)
 
bool operator() () override
 
- 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 Attributes

MoveNodeguardWrite_
 
int oldLC_
 
int maxLC_
 

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 45 of file BFRemoveGuardsFromSuccs.hh.

Constructor & Destructor Documentation

◆ BFRemoveGuardsFromSuccs()

BFRemoveGuardsFromSuccs::BFRemoveGuardsFromSuccs ( BF2Scheduler sched,
MoveNode guardWrite,
int  oldLC,
int  maxLC 
)
inline

Member Function Documentation

◆ operator()()

bool BFRemoveGuardsFromSuccs::operator() ( )
overridevirtual

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

Implements Reversible.

Definition at line 45 of file BFRemoveGuardsFromSuccs.cc.

45 {
46
48
49// std::list<BFRemoveGuardFromSucc*> guardRemoves;
50 std::list<MoveNode*> guardRemoveNodes;
51
52 for (auto e: outEdges) {
53 if (e->guardUse() &&
54 e->dependenceType() == DataDependenceEdge::DEP_RAW) {
55 MoveNode& head = ddg().headNode(*e);
56 if (head.move().isUnconditional()) {
57 std::cerr << "guard edge to uncond move?" << head.toString()
58 << std::endl;
59 continue;
60 }
61 if (head.isScheduled()) {
62 // this is not in critical path.
63 int cycle = head.cycle();
64 if (cycle > maxLC_ + head.guardLatency()) {
65 continue;
66 } else {
67 if (canBeSpeculated(head)) {
68 guardRemoveNodes.push_back(&head);
69 } else {
70 maxLC_ = std::min(
71 maxLC_, head.cycle() - head.guardLatency());
72 continue;
73 }
74 }
75 }
76 }
77 }
78
79 for (auto i: guardRemoveNodes) {
80 MoveNode& mn = *i;
81 if (mn.cycle() - mn.guardLatency() < maxLC_) {
83 }
84 }
85 if (postChildren_.empty()) {
86 return false;
87 }
88
89 // if could not improve schedule, return everything back the way it was
90 int ddglc = ddg().latestCycle(guardWrite_, ii(), false, false);
91 int rmlc = rm().latestCycle(ddglc, guardWrite_);
92 if (rmlc <= oldLC_) {
93 undo();
94 return false;
95 }
96
97 return true;
98}
unsigned int ii() const
BF2Scheduler & sched_
DataDependenceGraph & ddg()
SimpleResourceManager & rm() const
bool canBeSpeculated(const Operation &op)
virtual Node & headNode(const Edge &edge) const
virtual EdgeSet outEdges(const Node &node) 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< GraphEdge *, typename GraphEdge::Comparator > EdgeSet
Definition Graph.hh:54
int cycle() const
Definition MoveNode.cc:421
int guardLatency() const
Definition MoveNode.cc:779
std::string toString() const
Definition MoveNode.cc:576
TTAProgram::Move & move()
bool isScheduled() const
Definition MoveNode.cc:409
bool runPostChild(Reversible *preChild)
std::stack< Reversible * > postChildren_
Definition Reversible.hh:58
virtual void undo()
Definition Reversible.cc:69
virtual int latestCycle(MoveNode &node, const TTAMachine::Bus *bus=NULL, const TTAMachine::FunctionUnit *srcFU=NULL, const TTAMachine::FunctionUnit *dstFU=NULL, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
bool isUnconditional() const
Definition Move.cc:154

References BFOptimization::canBeSpeculated(), MoveNode::cycle(), BFOptimization::ddg(), DataDependenceEdge::DEP_RAW, MoveNode::guardLatency(), guardWrite_, BoostGraph< GraphNode, GraphEdge >::headNode(), BFOptimization::ii(), MoveNode::isScheduled(), TTAProgram::Move::isUnconditional(), DataDependenceGraph::latestCycle(), SimpleResourceManager::latestCycle(), maxLC_, MoveNode::move(), oldLC_, BoostGraph< GraphNode, GraphEdge >::outEdges(), Reversible::postChildren_, BFOptimization::rm(), Reversible::runPostChild(), BFOptimization::sched_, MoveNode::toString(), and Reversible::undo().

Here is the call graph for this function:

Member Data Documentation

◆ guardWrite_

MoveNode& BFRemoveGuardsFromSuccs::guardWrite_
private

Definition at line 53 of file BFRemoveGuardsFromSuccs.hh.

Referenced by operator()().

◆ maxLC_

int BFRemoveGuardsFromSuccs::maxLC_
private

Definition at line 55 of file BFRemoveGuardsFromSuccs.hh.

Referenced by operator()().

◆ oldLC_

int BFRemoveGuardsFromSuccs::oldLC_
private

Definition at line 54 of file BFRemoveGuardsFromSuccs.hh.

Referenced by operator()().


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