OpenASIP  2.0
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
BFUnscheduleMove Class Reference

#include <BFUnscheduleMove.hh>

Inheritance diagram for BFUnscheduleMove:
Inheritance graph
Collaboration diagram for BFUnscheduleMove:
Collaboration graph

Public Member Functions

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

Protected Member Functions

void returnOriginal ()
 
- 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

MoveNodemn_
 
int oldCycle_
 
const TTAMachine::BusoldBus_
 
const TTAMachine::BusprologBus_
 
int oldImmWriteCycle_
 
int prologImmWriteCycle_
 
const TTAMachine::FunctionUnitdstFU_
 
const TTAMachine::FunctionUnitsrcFU_
 
const TTAMachine::ImmediateUnitimmu_
 
int immRegIndex_
 
- Protected Attributes inherited from BFOptimization
BF2Schedulersched_
 
- Protected Attributes inherited from Reversible
std::stack< Reversible * > preChildren_
 
std::stack< Reversible * > postChildren_
 

Static Protected Attributes

static int recurseCounter_ = 0
 
- Static Protected Attributes inherited from BFOptimization
static std::map< MoveNode *, MoveNode *, MoveNode::ComparatorprologMoves_
 

Additional Inherited Members

- Static Public Member Functions inherited from BFOptimization
static void clearPrologMoves ()
 
static MoveNodegetSisterTrigger (const MoveNode &mn, const TTAMachine::Machine &mach)
 

Detailed Description

Definition at line 48 of file BFUnscheduleMove.hh.

Constructor & Destructor Documentation

◆ BFUnscheduleMove()

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

Definition at line 51 of file BFUnscheduleMove.hh.

52  :
53  BFOptimization(sched), mn_(mn), prologBus_(NULL),
55  srcFU_(NULL), immu_(NULL), immRegIndex_(-1) {}

Referenced by BFPushMoveUp2::operator()().

Member Function Documentation

◆ operator()()

bool BFUnscheduleMove::operator() ( )
virtual

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

Implements Reversible.

Definition at line 152 of file BFUnscheduleMove.cc.

152  {
154  return true;
155 }

References unscheduleOriginal().

Here is the call graph for this function:

◆ returnOriginal()

void BFUnscheduleMove::returnOriginal ( )
protected

Definition at line 107 of file BFUnscheduleMove.cc.

107  {
108 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
109  for (int i = 0; i < recurseCounter_*2; i++)
110  std::cerr << "\t";
111 
112  std::cerr << "\t\treturning original: " << mn_.toString() << " current bus: "
113  << mn_.move().bus().name() << " old bus: " << oldBus_->name()
114  << " cycle: " << oldCycle_ << std::endl;
115 #endif
116 
117 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
120  immRegIndex_, true)) {
121  std::cerr << "Cannot return to old cycle: " << mn_.toString() << " cycle: " << oldCycle_ << std::endl;
122  if (mn_.isDestinationOperation()) {
123  std::cerr << "dstPO: " << mn_.destinationOperation().toString() << std::endl;
124  }
125  if (mn_.isSourceOperation()) {
126  std::cerr << "srcPO: " << mn_.sourceOperation().toString() << std::endl;
127  }
128  std::cerr << "Original bus: " << oldBus_->name() << std::endl;
129  ddg().writeToDotFile("cannot_return_old_cycle.dot");
131  for (int i = 0; i < ins->moveCount(); i++) {
132  std::cerr << "\t" << POMDisassembler::disassemble(ins->move(i))
133  << " bus: " << ins->move(i).bus().name()
134  << std::endl;
135  }
136  std::cerr << "ins contains " << ins->immediateCount() << " immediates." << std::endl;
137  assert(false);
138  }
139 #endif
142 }

References assert, BFOptimization::assign(), TTAProgram::Move::bus(), BFOptimization::canAssign(), BFOptimization::ddg(), MoveNode::destinationOperation(), POMDisassembler::disassemble(), dstFU_, TTAProgram::Instruction::immediateCount(), immRegIndex_, immu_, SimpleResourceManager::instruction(), MoveNode::isDestinationOperation(), MoveNode::isSourceOperation(), mn_, TTAProgram::Instruction::move(), MoveNode::move(), TTAProgram::Instruction::moveCount(), TTAMachine::Component::name(), oldBus_, oldCycle_, oldImmWriteCycle_, prologBus_, prologImmWriteCycle_, recurseCounter_, BFOptimization::rm(), MoveNode::sourceOperation(), srcFU_, MoveNode::toString(), ProgramOperation::toString(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().

Referenced by BFPushMoveUp::operator()(), BFPushMoveUp2::operator()(), BFRescheduleMove::undoOnlyMe(), and undoOnlyMe().

Here is the call graph for this function:

◆ undoOnlyMe()

void BFUnscheduleMove::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 144 of file BFUnscheduleMove.cc.

144  {
145 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
146  std::cerr << "BFUnscheudleMove undo" << std::endl;
147 #endif
148  returnOriginal();
149 }

References returnOriginal().

Here is the call graph for this function:

◆ unscheduleOriginal()

void BFUnscheduleMove::unscheduleOriginal ( )

Definition at line 47 of file BFUnscheduleMove.cc.

47  {
48  oldCycle_ = mn_.cycle();
49  oldBus_ = &mn_.move().bus();
50 
51  if (mn_.isSourceOperation()) {
53  }
54 
57  }
58 
59  if (mn_.move().source().isImmediateRegister()) {
63  }
64 
65  MoveNode* prologMN = ii() ? duplicator().getMoveNode(mn_) : NULL;
66  if (prologMN != NULL) {
67  prologBus_ = &prologMN->move().bus();
68 
69  if (prologMN->move().source().isImmediateRegister()) {
71  }
72 
73 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
74  std::cerr << "\t\t\t\tProlog move: " << prologMN->toString() << std::endl;
75  std::cerr << "\t\t\t\tBFUnscheduleMove Saving prolog bus: " << prologBus_->name() << " cycle: " << oldCycle_ << std::endl;
76 #endif
77  }
78 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
79  for (int i = 0; i < recurseCounter_*2; i++)
80  std::cerr << "\t";
81 
82  std::cerr << "\t\tUnscheduling original: " << mn_.toString() << " bus: " << oldBus_->name() << std::endl;
83 #endif
84  unassign(mn_, false);
85 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
88  for (int i = 0; i < recurseCounter_*2; i++)
89  std::cerr << "\t";
90 
91  std::cerr << "\t\tCannot assign to old cycle: " << mn_.toString()
92  << " old cycle: " << oldCycle_ << std::endl;
93  ddg().writeToDotFile("cannot_assign_old_cycle.dot");
94  if (mn_.isSourceOperation()) {
95  std::cerr << "\t\twhole src PO: " << mn_.sourceOperation().toString()
96  << std::endl;
97  }
99  std::cerr << "\t\twhole dst PO: " << mn_.destinationOperation().toString()
100  << std::endl;
101  }
102  assert(false);
103  }
104 #endif
105 }

References assert, TTAProgram::Move::bus(), BFOptimization::canAssign(), MoveNode::cycle(), BFOptimization::ddg(), TTAProgram::Move::destination(), MoveNode::destinationOperation(), dstFU_, BFOptimization::duplicator(), TTAProgram::Terminal::functionUnit(), MoveNodeDuplicator::getMoveNode(), BFOptimization::ii(), TTAProgram::Terminal::immediateUnit(), SimpleResourceManager::immediateWriteCycle(), immRegIndex_, immu_, TTAProgram::Terminal::index(), MoveNode::isDestinationOperation(), TTAProgram::Terminal::isImmediateRegister(), MoveNode::isSourceOperation(), mn_, MoveNode::move(), TTAMachine::Component::name(), oldBus_, oldCycle_, oldImmWriteCycle_, prologBus_, prologImmWriteCycle_, BFOptimization::prologRM(), recurseCounter_, BFOptimization::rm(), TTAProgram::Move::source(), MoveNode::sourceOperation(), srcFU_, MoveNode::toString(), ProgramOperation::toString(), BFOptimization::unassign(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().

Referenced by BFPushMoveUp::operator()(), BFPushAntidepDown::operator()(), BFPushMoveUp2::operator()(), and operator()().

Here is the call graph for this function:

Member Data Documentation

◆ dstFU_

const TTAMachine::FunctionUnit* BFUnscheduleMove::dstFU_
protected

Definition at line 67 of file BFUnscheduleMove.hh.

Referenced by returnOriginal(), and unscheduleOriginal().

◆ immRegIndex_

int BFUnscheduleMove::immRegIndex_
protected

Definition at line 70 of file BFUnscheduleMove.hh.

Referenced by returnOriginal(), and unscheduleOriginal().

◆ immu_

const TTAMachine::ImmediateUnit* BFUnscheduleMove::immu_
protected

Definition at line 69 of file BFUnscheduleMove.hh.

Referenced by returnOriginal(), and unscheduleOriginal().

◆ mn_

MoveNode& BFUnscheduleMove::mn_
protected

◆ oldBus_

const TTAMachine::Bus* BFUnscheduleMove::oldBus_
protected

◆ oldCycle_

int BFUnscheduleMove::oldCycle_
protected

◆ oldImmWriteCycle_

int BFUnscheduleMove::oldImmWriteCycle_
protected

◆ prologBus_

const TTAMachine::Bus* BFUnscheduleMove::prologBus_
protected

◆ prologImmWriteCycle_

int BFUnscheduleMove::prologImmWriteCycle_
protected

◆ recurseCounter_

int BFUnscheduleMove::recurseCounter_ = 0
staticprotected

◆ srcFU_

const TTAMachine::FunctionUnit* BFUnscheduleMove::srcFU_
protected

Definition at line 68 of file BFUnscheduleMove.hh.

Referenced by returnOriginal(), and unscheduleOriginal().


The documentation for this class was generated from the following files:
SimpleResourceManager::immediateWriteCycle
virtual int immediateWriteCycle(const MoveNode &) const
Definition: SimpleResourceManager.cc:520
BFOptimization::unassign
virtual void unassign(MoveNode &mn, bool disposePrologCopy=true)
Definition: BFOptimization.cc:196
BFOptimization::assign
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)
Definition: BFOptimization.cc:103
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
BFOptimization::duplicator
MoveNodeDuplicator & duplicator() const
Definition: BFOptimization.cc:87
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
BFUnscheduleMove::oldBus_
const TTAMachine::Bus * oldBus_
Definition: BFUnscheduleMove.hh:63
TTAProgram::Instruction::move
Move & move(int i) const
Definition: Instruction.cc:193
TTAProgram::Terminal::index
virtual int index() const
Definition: Terminal.cc:274
MoveNode::isDestinationOperation
bool isDestinationOperation() const
BFOptimization::ii
unsigned int ii() const
Definition: BFOptimization.cc:85
TTAProgram::Instruction
Definition: Instruction.hh:57
BFUnscheduleMove::returnOriginal
void returnOriginal()
Definition: BFUnscheduleMove.cc:107
TTAProgram::Move::destination
Terminal & destination() const
Definition: Move.cc:323
TTAProgram::Move::bus
const TTAMachine::Bus & bus() const
Definition: Move.cc:373
MoveNode
Definition: MoveNode.hh:65
BFUnscheduleMove::dstFU_
const TTAMachine::FunctionUnit * dstFU_
Definition: BFUnscheduleMove.hh:67
BFUnscheduleMove::oldCycle_
int oldCycle_
Definition: BFUnscheduleMove.hh:62
BFUnscheduleMove::mn_
MoveNode & mn_
Definition: BFUnscheduleMove.hh:61
BFUnscheduleMove::oldImmWriteCycle_
int oldImmWriteCycle_
Definition: BFUnscheduleMove.hh:65
MoveNode::sourceOperation
ProgramOperation & sourceOperation() const
Definition: MoveNode.cc:453
assert
#define assert(condition)
Definition: Application.hh:86
TTAProgram::Terminal::isImmediateRegister
virtual bool isImmediateRegister() const
Definition: Terminal.cc:97
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
BFOptimization::prologRM
SimpleResourceManager * prologRM() const
Definition: BFOptimization.cc:77
BFUnscheduleMove::recurseCounter_
static int recurseCounter_
Definition: BFUnscheduleMove.hh:71
MoveNode::isSourceOperation
bool isSourceOperation() const
Definition: MoveNode.cc:168
TTAProgram::Terminal::immediateUnit
virtual const TTAMachine::ImmediateUnit & immediateUnit() const
Definition: Terminal.cc:240
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
BFOptimization::rm
SimpleResourceManager & rm() const
Definition: BFOptimization.cc:76
BFUnscheduleMove::immu_
const TTAMachine::ImmediateUnit * immu_
Definition: BFUnscheduleMove.hh:69
GraphBase::writeToDotFile
virtual void writeToDotFile(const TCEString &fileName) const
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
TTAProgram::Terminal::functionUnit
virtual const TTAMachine::FunctionUnit & functionUnit() const
Definition: Terminal.cc:251
MoveNodeDuplicator::getMoveNode
MoveNode * getMoveNode(MoveNode &mn)
Definition: MoveNodeDuplicator.cc:85
MoveNode::destinationOperation
ProgramOperation & destinationOperation(unsigned int index=0) const
BFUnscheduleMove::unscheduleOriginal
void unscheduleOriginal()
Definition: BFUnscheduleMove.cc:47
MoveNode::move
TTAProgram::Move & move()
ProgramOperation::toString
std::string toString() const
Definition: ProgramOperation.cc:746
POMDisassembler::disassemble
static std::string disassemble(const TTAProgram::Move &move)
Definition: POMDisassembler.cc:629
BFUnscheduleMove::prologBus_
const TTAMachine::Bus * prologBus_
Definition: BFUnscheduleMove.hh:64
BFUnscheduleMove::immRegIndex_
int immRegIndex_
Definition: BFUnscheduleMove.hh:70
TTAProgram::Instruction::immediateCount
int immediateCount() const
Definition: Instruction.cc:267
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
BFUnscheduleMove::srcFU_
const TTAMachine::FunctionUnit * srcFU_
Definition: BFUnscheduleMove.hh:68
BFOptimization::canAssign
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)
Definition: BFOptimization.cc:495
TTAProgram::Instruction::moveCount
int moveCount() const
Definition: Instruction.cc:176
BFUnscheduleMove::prologImmWriteCycle_
int prologImmWriteCycle_
Definition: BFUnscheduleMove.hh:66
SimpleResourceManager::instruction
virtual TTAProgram::Instruction * instruction(int cycle) const override
Definition: SimpleResourceManager.cc:442