OpenASIP  2.0
BFEarlyGuardBypass.cc
Go to the documentation of this file.
1 #include "BFEarlyGuardBypass.hh"
2 #include "DataDependenceGraph.hh"
3 #include "Operation.hh"
4 #include "Move.hh"
5 #include "MoveGuard.hh"
7 #include "Bus.hh"
8 #include "Guard.hh"
9 #include "Terminal.hh"
10 #include "FUPort.hh"
11 
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 }
63 
65  ddg().guardRestored(*src_, mn_);
67 }
TTAMachine::Guard
Definition: Guard.hh:55
MachineConnectivityCheck::findPossibleDestinationPorts
static PortSet findPossibleDestinationPorts(const TTAMachine::Machine &mach, const MoveNode &node)
Definition: MachineConnectivityCheck.cc:1474
BFEarlyGuardBypass::undoOnlyMe
void undoOnlyMe() override
Definition: BFEarlyGuardBypass.cc:64
BFEarlyGuardBypass.hh
BFEarlyGuardBypass::src_
MoveNode * src_
Definition: BFEarlyGuardBypass.hh:17
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
MachineConnectivityCheck.hh
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
DataDependenceGraph.hh
TTAProgram::Move::setGuard
void setGuard(MoveGuard *guard)
Definition: Move.cc:360
Terminal.hh
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
BFEarlyGuardBypass::operator()
bool operator()() override
Definition: BFEarlyGuardBypass.cc:12
TTAProgram::Move::guard
MoveGuard & guard() const
Definition: Move.cc:345
Guard.hh
Operation.hh
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
TTAMachine::FunctionUnit::hasOperation
virtual bool hasOperation(const std::string &name) const
Definition: FunctionUnit.cc:330
Bus.hh
Operation
Definition: Operation.hh:59
DataDependenceGraph::guardRestored
void guardRestored(MoveNode &guardSrc, MoveNode &dst)
Definition: DataDependenceGraph.cc:5849
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
FUPort.hh
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
Move.hh
TTAProgram::MoveGuard
Definition: MoveGuard.hh:47
MoveGuard.hh