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

#include <BFRegCopyBefore.hh>

Inheritance diagram for BFRegCopyBefore:
Inheritance graph
Collaboration diagram for BFRegCopyBefore:
Collaboration graph

Public Member Functions

 BFRegCopyBefore (BF2Scheduler &sched, MoveNode &mn, int lc, const TTAMachine::RegisterFile *forbiddenRF=nullptr)
 
virtual ~BFRegCopyBefore ()
 
- Public Member Functions inherited from BFRegCopy
 BFRegCopy (BF2Scheduler &sched, MoveNode &mn, int lc)
 
bool operator() ()
 
MoveNodegetRegCopy ()
 
void undoOnlyMe ()
 
void undoDDG ()
 
void createAntidepsForReg (MoveNode &firstMove, MoveNode &lastMove, const TTAMachine::RegisterFile &rf, int index, TCEString regName, BasicBlockNode &bbn, bool loopScheduling)
 
- 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

bool splitMove (BasicBlockNode &bbn)
 
void undoSplit ()
 
- Protected Member Functions inherited from BFRegCopy
MoveNodecreateRegCopy (bool after)
 
- 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

const TTAMachine::RegisterFileforbiddenRF_
 
- Protected Attributes inherited from BFRegCopy
MoveNodemn_
 
MoveNoderegCopy_
 
int lc_
 
- Protected Attributes inherited from BFOptimization
BF2Schedulersched_
 
- Protected Attributes inherited from Reversible
std::stack< Reversible * > preChildren_
 
std::stack< Reversible * > postChildren_
 

Additional Inherited Members

- Static Public Member Functions inherited from BFOptimization
static void clearPrologMoves ()
 
static MoveNodegetSisterTrigger (const MoveNode &mn, const TTAMachine::Machine &mach)
 
- Static Protected Attributes inherited from BFOptimization
static std::map< MoveNode *, MoveNode *, MoveNode::ComparatorprologMoves_
 

Detailed Description

Definition at line 44 of file BFRegCopyBefore.hh.

Constructor & Destructor Documentation

◆ BFRegCopyBefore()

BFRegCopyBefore::BFRegCopyBefore ( BF2Scheduler sched,
MoveNode mn,
int  lc,
const TTAMachine::RegisterFile forbiddenRF = nullptr 
)
inline

Definition at line 46 of file BFRegCopyBefore.hh.

48 : BFRegCopy(sched,mn,lc), forbiddenRF_(forbiddenRF) {}
const TTAMachine::RegisterFile * forbiddenRF_

◆ ~BFRegCopyBefore()

virtual BFRegCopyBefore::~BFRegCopyBefore ( )
inlinevirtual

Definition at line 49 of file BFRegCopyBefore.hh.

49{}

Member Function Documentation

◆ splitMove()

bool BFRegCopyBefore::splitMove ( BasicBlockNode bbn)
protectedvirtual

Implements BFRegCopy.

Definition at line 51 of file BFRegCopyBefore.cc.

51 {
52
53 std::set<const TTAMachine::RegisterFile*,
56
57 // cannot create reg copy if no temp regs available.
58 if (rfs.empty()) {
59 return false;
60 }
61
62 const TTAMachine::RegisterFile& rf = **rfs.rbegin();
63
64 int lastRegisterIndex = rf.size()-1;
65 TTAMachine::Port* dstRFPort = rf.firstWritePort();
66 TTAMachine::Port* srcRFPort = rf.firstReadPort();
67
69 new TTAProgram::TerminalRegister(*dstRFPort, lastRegisterIndex);
70
72 new TTAProgram::TerminalRegister(*srcRFPort, lastRegisterIndex);
73
74 regCopy_->move().setDestination(tempWrite);
75 mn_.move().setSource(tempRead);
76
77 auto iEdges = ddg().rootGraph()->inEdges(mn_);
78 for (auto iEdge : iEdges) {
79 if (!iEdge->isRegisterOrRA() || iEdge->headPseudo()) {
80 continue;
81 }
82
83 //copy guard use edge to the regcopy.
84 if (iEdge->guardUse() &&
85 iEdge->dependenceType() == DataDependenceEdge::DEP_RAW) {
86 MoveNode& tail = ddg().rootGraph()->tailNode(*iEdge);
88 new BFConnectNodes(sched_, tail, *regCopy_, iEdge, true));
89 } else if (iEdge->isRAW()) {
90 MoveNode& tail = ddg().rootGraph()->tailNode(*iEdge);
91 runPostChild(new BFRemoveEdge(sched_, tail, mn_, *iEdge));
92 runPostChild(new BFConnectNodes(sched_, tail, *regCopy_, iEdge));
93 }
94 }
95
96 auto oEdges = ddg().rootGraph()->outEdges(mn_);
97 for (auto oEdge : oEdges) {
98 if (!oEdge->isRegisterOrRA() || oEdge->tailPseudo()) {
99 continue;
100 }
101 if (oEdge->dependenceType() == DataDependenceEdge::DEP_WAR &&
102 !oEdge->guardUse()) {
103 MoveNode& head = ddg().rootGraph()->headNode(*oEdge);
104 runPostChild(new BFRemoveEdge(sched_, mn_, head, *oEdge));
105 runPostChild(new BFConnectNodes(sched_, *regCopy_, head, oEdge));
106 }
107 }
108
109 TCEString tempRegName = rf.name() + '.' +
110 Conversion::toString(lastRegisterIndex);
111
112 DataDependenceEdge* newEdge =
115 DataDependenceEdge::DEP_RAW, tempRegName);
116
118
120 *regCopy_, mn_, rf, lastRegisterIndex,
121 tempRegName, bbn, ii()!= 0);
122
123 return true;
124}
std::set< const TTAMachine::RegisterFile *, TTAMachine::MachinePart::Comparator > possibleTempRegRFs(const MoveNode &mn, bool tempRegAfter, const TTAMachine::RegisterFile *forbiddenRF=nullptr)
unsigned int ii() const
BF2Scheduler & sched_
DataDependenceGraph & ddg()
MoveNode * regCopy_
Definition BFRegCopy.hh:70
void createAntidepsForReg(MoveNode &firstMove, MoveNode &lastMove, const TTAMachine::RegisterFile &rf, int index, TCEString regName, BasicBlockNode &bbn, bool loopScheduling)
Definition BFRegCopy.cc:99
MoveNode & mn_
Definition BFRegCopy.hh:69
BoostGraph * rootGraph()
virtual Node & headNode(const Edge &edge) const
virtual EdgeSet outEdges(const Node &node) const
virtual Node & tailNode(const Edge &edge) const
virtual EdgeSet inEdges(const Node &node) const
static std::string toString(const T &source)
TTAProgram::Move & move()
bool runPostChild(Reversible *preChild)
virtual int size() const
virtual TCEString name() const
Port * firstReadPort() const
Port * firstWritePort() const
void setSource(Terminal *src)
Definition Move.cc:312
void setDestination(Terminal *dst)
Definition Move.cc:333

References BFRegCopy::createAntidepsForReg(), BFOptimization::ddg(), DataDependenceEdge::DEP_RAW, DataDependenceEdge::DEP_WAR, DataDependenceEdge::EDGE_REGISTER, TTAMachine::RegisterFile::firstReadPort(), TTAMachine::RegisterFile::firstWritePort(), forbiddenRF_, BoostGraph< GraphNode, GraphEdge >::headNode(), BFOptimization::ii(), BoostGraph< GraphNode, GraphEdge >::inEdges(), BFRegCopy::mn_, MoveNode::move(), TTAMachine::Component::name(), BoostGraph< GraphNode, GraphEdge >::outEdges(), BF2Scheduler::possibleTempRegRFs(), BFRegCopy::regCopy_, BoostGraph< GraphNode, GraphEdge >::rootGraph(), Reversible::runPostChild(), BFOptimization::sched_, TTAProgram::Move::setDestination(), TTAProgram::Move::setSource(), TTAMachine::BaseRegisterFile::size(), BoostGraph< GraphNode, GraphEdge >::tailNode(), and Conversion::toString().

Here is the call graph for this function:

◆ undoSplit()

void BFRegCopyBefore::undoSplit ( )
protectedvirtual

Implements BFRegCopy.

Definition at line 126 of file BFRegCopyBefore.cc.

126 {
128}
Terminal & source() const
Definition Move.cc:302
virtual Terminal * copy() const =0

References TTAProgram::Terminal::copy(), BFRegCopy::mn_, MoveNode::move(), BFRegCopy::regCopy_, TTAProgram::Move::setSource(), and TTAProgram::Move::source().

Here is the call graph for this function:

Member Data Documentation

◆ forbiddenRF_

const TTAMachine::RegisterFile* BFRegCopyBefore::forbiddenRF_
protected

Definition at line 53 of file BFRegCopyBefore.hh.

Referenced by splitMove().


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