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

#include <BFCopyRegWithOp.hh>

Inheritance diagram for BFCopyRegWithOp:
Inheritance graph
Collaboration diagram for BFCopyRegWithOp:
Collaboration graph

Public Member Functions

 BFCopyRegWithOp (BF2Scheduler &sched, MoveNode &mn, int lc, MachineConnectivityCheck::FUSet candidateFUs)
 
virtual ~BFCopyRegWithOp ()
 
- 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

ProgramOperationPtr pop_
 
MachineConnectivityCheck::FUSet candidateFUs_
 
- 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 8 of file BFCopyRegWithOp.hh.

Constructor & Destructor Documentation

◆ BFCopyRegWithOp()

BFCopyRegWithOp::BFCopyRegWithOp ( BF2Scheduler sched,
MoveNode mn,
int  lc,
MachineConnectivityCheck::FUSet  candidateFUs 
)
inline

Definition at line 10 of file BFCopyRegWithOp.hh.

11  :
12  BFRegCopy(sched,mn,lc), candidateFUs_(candidateFUs) {}

◆ ~BFCopyRegWithOp()

virtual BFCopyRegWithOp::~BFCopyRegWithOp ( )
inlinevirtual

Definition at line 13 of file BFCopyRegWithOp.hh.

13 {}

Member Function Documentation

◆ splitMove()

bool BFCopyRegWithOp::splitMove ( BasicBlockNode bbn)
protectedvirtual

Implements BFRegCopy.

Definition at line 15 of file BFCopyRegWithOp.cc.

15  {
17  OperationPool opPool;
18  auto& op = opPool.operation("COPY");
19  pop_ = std::make_shared<ProgramOperation>(op);
20 
21  mn_.move().setSource(cGen.createTerminalFUPort("COPY",2));
22  regCopy_->move().setDestination(cGen.createTerminalFUPort("COPY",1));
23  pop_->addInputNode(*regCopy_);
24  pop_->addOutputNode(mn_);
27 
28  for (auto fu : candidateFUs_) {
29  TTAProgram::ProgramAnnotation srcCandidate(
31  fu->name());
32  mn_.move().addAnnotation(srcCandidate);
33 
34  TTAProgram::ProgramAnnotation dstCandidate(
36  fu->name());
37  regCopy_->move().addAnnotation(dstCandidate);
38  }
39 
40  // move RAW in edges...
41  for (int i = ddg().rootGraph()->inDegree(mn_)-1; i >= 0; i--) {
42  auto& e = ddg().rootGraph()->inEdge(mn_,i);
43  if (e.isRAW() && !e.headPseudo()) {
44  ddg().rootGraph()->moveInEdge(mn_, *regCopy_, e);
45  }
46  }
47 
48  // move antidep edges.
49  for (int i = ddg().rootGraph()->outDegree(mn_)-1; i >= 0; i--) {
50  auto& e = ddg().rootGraph()->outEdge(mn_,i);
51  if (e.isRegisterOrRA() && !e.isRAW() && !e.tailPseudo()) {
53  }
54  }
55 
56 
58  *(new DataDependenceEdge(
61  TCEString("COPY"))));
62  return true;
63 }

References TTAProgram::AnnotatedInstructionElement::addAnnotation(), MoveNode::addDestinationOperationPtr(), TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_DST, TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC, candidateFUs_, BoostGraph< GraphNode, GraphEdge >::connectNodes(), TTAProgram::CodeGenerator::createTerminalFUPort(), BFOptimization::ddg(), DataDependenceEdge::DEP_UNKNOWN, DataDependenceEdge::EDGE_OPERATION, BoostGraph< GraphNode, GraphEdge >::inEdge(), BFRegCopy::mn_, MoveNode::move(), BoostGraph< GraphNode, GraphEdge >::moveInEdge(), BoostGraph< GraphNode, GraphEdge >::moveOutEdge(), OperationPool::operation(), BoostGraph< GraphNode, GraphEdge >::outEdge(), pop_, BFRegCopy::regCopy_, BoostGraph< GraphNode, GraphEdge >::rootGraph(), TTAProgram::Move::setDestination(), TTAProgram::Move::setSource(), MoveNode::setSourceOperationPtr(), and BFOptimization::targetMachine().

Here is the call graph for this function:

◆ undoSplit()

void BFCopyRegWithOp::undoSplit ( )
protectedvirtual

Implements BFRegCopy.

Definition at line 65 of file BFCopyRegWithOp.cc.

65  {
66 
69 
70  // restore antidep edges.
71  for (int i = ddg().rootGraph()->outDegree(*regCopy_)-1; i >= 0; i--) {
72  auto& e = ddg().rootGraph()->outEdge(*regCopy_,i);
73  if (e.isRegisterOrRA() && !e.isRAW() && !e.tailPseudo()) {
75  }
76  }
77 
78  // restore raw edges
79  for (int i = ddg().rootGraph()->inDegree(*regCopy_)-1; i >= 0; i--) {
80  auto& e = ddg().rootGraph()->inEdge(*regCopy_,i);
81  if (e.isRAW() && !e.headPseudo()) {
82  ddg().rootGraph()->moveInEdge(*regCopy_, mn_, e);
83  }
84  }
85 
86 
87  pop_->removeOutputNode(mn_);
88  pop_->removeInputNode(*regCopy_);
92  pop_ = ProgramOperationPtr(); // this should delete the obj.
93 
95 }

References TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC, TTAProgram::Terminal::copy(), BFOptimization::ddg(), BoostGraph< GraphNode, GraphEdge >::disconnectNodes(), BoostGraph< GraphNode, GraphEdge >::inEdge(), BFRegCopy::mn_, MoveNode::move(), BoostGraph< GraphNode, GraphEdge >::moveInEdge(), BoostGraph< GraphNode, GraphEdge >::moveOutEdge(), BoostGraph< GraphNode, GraphEdge >::outEdge(), pop_, BFRegCopy::regCopy_, TTAProgram::AnnotatedInstructionElement::removeAnnotations(), MoveNode::removeDestinationOperation(), BoostGraph< GraphNode, GraphEdge >::rootGraph(), TTAProgram::Move::setSource(), TTAProgram::Move::source(), and MoveNode::unsetSourceOperation().

Here is the call graph for this function:

Member Data Documentation

◆ candidateFUs_

MachineConnectivityCheck::FUSet BFCopyRegWithOp::candidateFUs_
protected

Definition at line 18 of file BFCopyRegWithOp.hh.

Referenced by splitMove().

◆ pop_

ProgramOperationPtr BFCopyRegWithOp::pop_
protected

Definition at line 17 of file BFCopyRegWithOp.hh.

Referenced by splitMove(), and undoSplit().


The documentation for this class was generated from the following files:
BoostGraph::connectNodes
virtual void connectNodes(const Node &nTail, const Node &nHead, Edge &e)
BoostGraph::outEdge
virtual Edge & outEdge(const Node &node, const int index) const
OperationPool::operation
Operation & operation(const char *name)
Definition: OperationPool.cc:99
BFCopyRegWithOp::pop_
ProgramOperationPtr pop_
Definition: BFCopyRegWithOp.hh:17
BoostGraph::moveOutEdge
virtual void moveOutEdge(const Node &source, const Node &destination, Edge &edge, const Node *head=NULL, bool childs=false)
BFOptimization::targetMachine
const TTAMachine::Machine & targetMachine() const
Definition: BFOptimization.cc:81
ProgramOperationPtr
std::shared_ptr< ProgramOperation > ProgramOperationPtr
Definition: MoveNode.hh:52
BoostGraph::moveInEdge
virtual void moveInEdge(const Node &source, const Node &destination, Edge &edge, const Node *tail=NULL, bool childs=false)
BoostGraph::disconnectNodes
virtual void disconnectNodes(const Node &nTail, const Node &nHead)
MoveNode::setSourceOperationPtr
void setSourceOperationPtr(ProgramOperationPtr po)
Definition: MoveNode.cc:541
DataDependenceEdge::DEP_UNKNOWN
@ DEP_UNKNOWN
Definition: DataDependenceEdge.hh:46
TTAProgram::Move::setDestination
void setDestination(Terminal *dst)
Definition: Move.cc:333
TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC
@ ANN_CONN_CANDIDATE_UNIT_SRC
Src. unit candidate.
Definition: ProgramAnnotation.hh:115
BoostGraph::rootGraph
BoostGraph * rootGraph()
MoveNode::addDestinationOperationPtr
void addDestinationOperationPtr(ProgramOperationPtr po)
Definition: MoveNode.cc:533
BoostGraph::inEdge
virtual Edge & inEdge(const Node &node, const int index) const
DataDependenceEdge::EDGE_OPERATION
@ EDGE_OPERATION
Definition: DataDependenceEdge.hh:56
MoveNode::unsetSourceOperation
void unsetSourceOperation()
Definition: MoveNode.cc:760
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
BFRegCopy::regCopy_
MoveNode * regCopy_
Definition: BFRegCopy.hh:70
TTAProgram::AnnotatedInstructionElement::addAnnotation
void addAnnotation(const ProgramAnnotation &annotation)
Definition: AnnotatedInstructionElement.cc:63
MoveNode::move
TTAProgram::Move & move()
BFRegCopy::mn_
MoveNode & mn_
Definition: BFRegCopy.hh:69
MoveNode::removeDestinationOperation
void removeDestinationOperation(const ProgramOperation *po)
Definition: MoveNode.cc:741
BFCopyRegWithOp::candidateFUs_
MachineConnectivityCheck::FUSet candidateFUs_
Definition: BFCopyRegWithOp.hh:18
TCEString
Definition: TCEString.hh:53
TTAProgram::Terminal::copy
virtual Terminal * copy() const =0
TTAProgram::CodeGenerator
Definition: CodeGenerator.hh:53
DataDependenceEdge
Definition: DataDependenceEdge.hh:43
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
TTAProgram::ProgramAnnotation
Definition: ProgramAnnotation.hh:49
TTAProgram::AnnotatedInstructionElement::removeAnnotations
void removeAnnotations(ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID)
Definition: AnnotatedInstructionElement.cc:146
OperationPool
Definition: OperationPool.hh:52
BFRegCopy::BFRegCopy
BFRegCopy(BF2Scheduler &sched, MoveNode &mn, int lc)
Definition: BFRegCopy.hh:49
TTAProgram::Move::setSource
void setSource(Terminal *src)
Definition: Move.cc:312
TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_DST
@ ANN_CONN_CANDIDATE_UNIT_DST
Dst. unit candidate.
Definition: ProgramAnnotation.hh:116