OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
BFEarlyGuardBypass Class Reference

#include <BFEarlyGuardBypass.hh>

Inheritance diagram for BFEarlyGuardBypass:
Inheritance graph
Collaboration diagram for BFEarlyGuardBypass:
Collaboration graph

Public Member Functions

 BFEarlyGuardBypass (BF2Scheduler &sched, MoveNode &mn)
 
void undoOnlyMe () override
 
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

MoveNodemn_
 
MoveNodesrc_
 
const TTAMachine::GuardoriginalGuard_
 

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)
 
- 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 7 of file BFEarlyGuardBypass.hh.

Constructor & Destructor Documentation

◆ BFEarlyGuardBypass()

BFEarlyGuardBypass::BFEarlyGuardBypass ( BF2Scheduler sched,
MoveNode mn 
)
inline

Definition at line 10 of file BFEarlyGuardBypass.hh.

10  :
11  BFOptimization(sched), mn_(mn) {}

Member Function Documentation

◆ operator()()

bool BFEarlyGuardBypass::operator() ( )
overridevirtual

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

Implements Reversible.

Definition at line 12 of file BFEarlyGuardBypass.cc.

12  {
13 
15  if (!src_) {
16  return false;
17  }
19  const Operation& op = po->operation();
20 
22  targetMachine(), mn_);
23 
24  // TODO: this is not deterministic as this uses pointer as the key!
25  std::set<const TTAMachine::Bus*> buses;
26 
27  for (auto p: dPorts) {
29  }
30 
31  for (auto bus: buses) {
32  for (int i = 0; i < bus->guardCount(); i++) {
33  const TTAMachine::Guard* guard = bus->guard(i);
34  const TTAMachine::PortGuard* pg =
35  dynamic_cast<const TTAMachine::PortGuard*>(guard);
36  if (pg == NULL || pg->isInverted() != mn_.move().guard().isInverted()) {
37  continue;
38  }
39  const TTAMachine::FUPort* port = pg->port();
40  const TTAMachine::FunctionUnit* gfu = port->parentUnit();
41 
42  if (gfu->hasOperation(op.name()) &&
43  po->outputIndexFromGuard(*pg) ==
44  src_->move().source().operationIndex()) {
45 
46  if (!po->isLegalFU(*gfu)) {
47 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
48  std::cerr << "\t\t\tFU: " << gfu->name() << " not allowed for operation: " << po->toString() << std::endl;
49 #endif
50  continue;
51  }
52 
54  // TODO: backup old guard.
55  mn_.move().setGuard(new TTAProgram::MoveGuard(*guard));
57  return true;
58  }
59  }
60  }
61  return false;
62 }

References MachineConnectivityCheck::appendConnectedSourceBuses(), BFOptimization::ddg(), MachineConnectivityCheck::findPossibleDestinationPorts(), TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), DataDependenceGraph::guardConverted(), TTAMachine::FunctionUnit::hasOperation(), TTAProgram::MoveGuard::isInverted(), TTAMachine::Guard::isInverted(), mn_, MoveNode::move(), TTAMachine::Component::name(), Operation::name(), DataDependenceGraph::onlyRegisterRawSource(), TTAProgram::Terminal::operationIndex(), originalGuard_, TTAMachine::BaseFUPort::parentUnit(), TTAMachine::PortGuard::port(), TTAProgram::Move::setGuard(), TTAProgram::Move::source(), MoveNode::sourceOperationPtr(), src_, and BFOptimization::targetMachine().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFEarlyGuardBypass::undoOnlyMe ( )
overridevirtual

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 64 of file BFEarlyGuardBypass.cc.

64  {
65  ddg().guardRestored(*src_, mn_);
67 }

References BFOptimization::ddg(), DataDependenceGraph::guardRestored(), mn_, MoveNode::move(), originalGuard_, TTAProgram::Move::setGuard(), and src_.

Here is the call graph for this function:

Member Data Documentation

◆ mn_

MoveNode& BFEarlyGuardBypass::mn_
private

Definition at line 16 of file BFEarlyGuardBypass.hh.

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

◆ originalGuard_

const TTAMachine::Guard* BFEarlyGuardBypass::originalGuard_
private

Definition at line 18 of file BFEarlyGuardBypass.hh.

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

◆ src_

MoveNode* BFEarlyGuardBypass::src_
private

Definition at line 17 of file BFEarlyGuardBypass.hh.

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


The documentation for this class was generated from the following files:
TTAMachine::Guard
Definition: Guard.hh:55
MachineConnectivityCheck::findPossibleDestinationPorts
static PortSet findPossibleDestinationPorts(const TTAMachine::Machine &mach, const MoveNode &node)
Definition: MachineConnectivityCheck.cc:1474
BFEarlyGuardBypass::src_
MoveNode * src_
Definition: BFEarlyGuardBypass.hh:17
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
MachineConnectivityCheck::appendConnectedSourceBuses
static void appendConnectedSourceBuses(const TTAMachine::Port &port, std::set< const TTAMachine::Bus * > &buses)
Definition: MachineConnectivityCheck.cc:799
TTAMachine::PortGuard::port
FUPort * port() const
TTAMachine::BaseFUPort::parentUnit
FunctionUnit * parentUnit() const
Definition: BaseFUPort.cc:96
TTAProgram::MoveGuard::isInverted
bool isInverted() const
Definition: MoveGuard.cc:76
TTAProgram::Move::setGuard
void setGuard(MoveGuard *guard)
Definition: Move.cc:360
Operation::name
virtual TCEString name() const
Definition: Operation.cc:93
DataDependenceGraph::onlyRegisterRawSource
MoveNode * onlyRegisterRawSource(const MoveNode &mn, int allowGuardEdges=2, int backEdges=0) const
Definition: DataDependenceGraph.cc:4083
BFOptimization::targetMachine
const TTAMachine::Machine & targetMachine() const
Definition: BFOptimization.cc:81
ProgramOperationPtr
std::shared_ptr< ProgramOperation > ProgramOperationPtr
Definition: MoveNode.hh:52
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::FUPort
Definition: FUPort.hh:46
TTAProgram::Terminal::operationIndex
virtual int operationIndex() const
Definition: Terminal.cc:364
TTAProgram::Move::guard
MoveGuard & guard() const
Definition: Move.cc:345
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
TTAMachine::FunctionUnit::hasOperation
virtual bool hasOperation(const std::string &name) const
Definition: FunctionUnit.cc:330
Operation
Definition: Operation.hh:59
DataDependenceGraph::guardRestored
void guardRestored(MoveNode &guardSrc, MoveNode &dst)
Definition: DataDependenceGraph.cc:5849
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
BFEarlyGuardBypass::originalGuard_
const TTAMachine::Guard * originalGuard_
Definition: BFEarlyGuardBypass.hh:18
MoveNode::move
TTAProgram::Move & move()
TTAMachine::Guard::isInverted
virtual bool isInverted() const
DataDependenceGraph::guardConverted
void guardConverted(MoveNode &guardSrc, MoveNode &dst)
Definition: DataDependenceGraph.cc:5795
MoveNode::sourceOperationPtr
ProgramOperationPtr sourceOperationPtr() const
Definition: MoveNode.cc:458
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
BFEarlyGuardBypass::mn_
MoveNode & mn_
Definition: BFEarlyGuardBypass.hh:16
TTAMachine::PortGuard
Definition: Guard.hh:99
TTAProgram::MoveGuard::guard
const TTAMachine::Guard & guard() const
Definition: MoveGuard.cc:86
TTAProgram::MoveGuard
Definition: MoveGuard.hh:47