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

#include <BFDropPreShared.hh>

Inheritance diagram for BFDropPreShared:
Inheritance graph
Collaboration diagram for BFDropPreShared:
Collaboration graph

Public Member Functions

 BFDropPreShared (BF2Scheduler &sched, MoveNode &mn)
 
bool operator() ()
 
void undoOnlyMe ()
 
- 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_
 

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 41 of file BFDropPreShared.hh.

Constructor & Destructor Documentation

◆ BFDropPreShared()

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

Definition at line 43 of file BFDropPreShared.hh.

43  :
44  BFOptimization(sched), mn_(mn) {}

Member Function Documentation

◆ operator()()

bool BFDropPreShared::operator() ( )
virtual

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

Implements Reversible.

Definition at line 47 of file BFDropPreShared.cc.

47  {
48 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
49  std::cerr << "\tDropping pre-shared: " << mn_.toString() << std::endl;
50 #endif
52  if (trigger == &mn_) {
53 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
54  std::cerr << "Cannot pre-share trigger operand, must swap operands"
55  << std::endl;
56 #endif
58  const Operation& op = destPO->operation();
59  int operandCount = op.numberOfInputs();
60  bool swapped = false;
61  for (int i = 1 ; i <= operandCount && !swapped; i++) {
62  int idx = mn_.move().destination().operationIndex();
63  MoveNode& mn = destPO->inputNode(i).at(0);
64  if (i != idx && op.canSwap(i, idx) &&
66  // TODO: force the indeces here
67  BFSwapOperands* bfswo =
68  new BFSwapOperands(sched_, destPO, mn_, mn);
69  if (runPreChild(bfswo)) {
70  swapped = true;
71  }
72  }
73  }
74  if (!swapped) {
75  return false;
76  }
77  }
78  ddg().dropNode(mn_);
80  return true;
81 }

References Operation::canSwap(), BFOptimization::ddg(), TTAProgram::Move::destination(), MoveNode::destinationOperationPtr(), BoostGraph< GraphNode, GraphEdge >::dropNode(), BFOptimization::getSisterTrigger(), BF2Scheduler::isPreLoopSharedOperand(), mn_, MoveNode::move(), BF2Scheduler::nodeKilled(), Operation::numberOfInputs(), TTAProgram::Terminal::operationIndex(), Reversible::runPreChild(), BFOptimization::sched_, BFOptimization::targetMachine(), and MoveNode::toString().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFDropPreShared::undoOnlyMe ( )
virtual

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 84 of file BFDropPreShared.cc.

84  {
85 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
86  std::cerr << "\tUndoing dropping of pre-shared: " << mn_.toString()
87  << std::endl;
88 #endif
91 }

References BFOptimization::ddg(), mn_, BF2Scheduler::nodeResurrected(), BoostGraph< GraphNode, GraphEdge >::restoreNodeFromParent(), BFOptimization::sched_, and MoveNode::toString().

Here is the call graph for this function:

Member Data Documentation

◆ mn_

MoveNode& BFDropPreShared::mn_
private

Definition at line 48 of file BFDropPreShared.hh.

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


The documentation for this class was generated from the following files:
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
BFDropPreShared::mn_
MoveNode & mn_
Definition: BFDropPreShared.hh:48
TTAProgram::Move::destination
Terminal & destination() const
Definition: Move.cc:323
Operation::numberOfInputs
virtual int numberOfInputs() const
Definition: Operation.cc:192
BFOptimization::getSisterTrigger
static MoveNode * getSisterTrigger(const MoveNode &mn, const TTAMachine::Machine &mach)
Definition: BFOptimization.cc:848
MoveNode
Definition: MoveNode.hh:65
BoostGraph::dropNode
virtual void dropNode(Node &node)
BFOptimization::targetMachine
const TTAMachine::Machine & targetMachine() const
Definition: BFOptimization.cc:81
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
ProgramOperationPtr
std::shared_ptr< ProgramOperation > ProgramOperationPtr
Definition: MoveNode.hh:52
Operation::canSwap
virtual bool canSwap(int id1, int id2) const
Definition: Operation.cc:470
BF2Scheduler::isPreLoopSharedOperand
TTAMachine::FUPort * isPreLoopSharedOperand(MoveNode &mn) const
Definition: BF2Scheduler.cc:1625
TTAProgram::Terminal::operationIndex
virtual int operationIndex() const
Definition: Terminal.cc:364
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
Operation
Definition: Operation.hh:59
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
MoveNode::destinationOperationPtr
ProgramOperationPtr destinationOperationPtr(unsigned int index=0) const
MoveNode::move
TTAProgram::Move & move()
Reversible::runPreChild
bool runPreChild(Reversible *preChild)
Definition: Reversible.cc:127
BF2Scheduler::nodeResurrected
void nodeResurrected(MoveNode &mn)
Definition: BF2Scheduler.cc:811
BFSwapOperands
Definition: BFSwapOperands.hh:41
BF2Scheduler::nodeKilled
void nodeKilled(MoveNode &mn)
Definition: BF2Scheduler.cc:807
BoostGraph::restoreNodeFromParent
void restoreNodeFromParent(GraphNode &node)