OpenASIP  2.0
Public Member Functions | Static Public Member Functions | List of all members
ScheduleEstimator Class Reference

#include <ScheduleEstimator.hh>

Inheritance diagram for ScheduleEstimator:
Inheritance graph
Collaboration diagram for ScheduleEstimator:
Collaboration graph

Public Member Functions

 ScheduleEstimator (InterPassData &data)
 
virtual void handleControlFlowGraph (ControlFlowGraph &cfg, const TTAMachine::Machine &mach) override
 
virtual std::string shortDescription () const
 
- Public Member Functions inherited from ControlFlowGraphPass
 ControlFlowGraphPass (InterPassData &data)
 
virtual ~ControlFlowGraphPass ()
 
void executeBasicBlockPass (ControlFlowGraph &cfg, const TTAMachine::Machine &targetMachine, BasicBlockPass &bbPass)
 
- Public Member Functions inherited from SchedulerPass
 SchedulerPass (InterPassData &data)
 
virtual ~SchedulerPass ()
 
InterPassDatainterPassData ()
 
virtual std::string longDescription () const
 

Static Public Member Functions

static int maximumSizeOfBB (TTAProgram::BasicBlock &bb, const TTAMachine::Machine &mach)
 

Detailed Description

Definition at line 46 of file ScheduleEstimator.hh.

Constructor & Destructor Documentation

◆ ScheduleEstimator()

ScheduleEstimator::ScheduleEstimator ( InterPassData data)
inline

Definition at line 49 of file ScheduleEstimator.hh.

49 : ControlFlowGraphPass(data) {}

Member Function Documentation

◆ handleControlFlowGraph()

void ScheduleEstimator::handleControlFlowGraph ( ControlFlowGraph cfg,
const TTAMachine::Machine targetMachine 
)
overridevirtual

Handles a single control flow graph.

The pass should work with any kind of control flow graph, it should not assume the CFG represents a whole procedure, for example.

Parameters
cfgThe control flow graph to handle.
machineThe target machine if any. (NullMachine::instance() if target machine is irrelevant).
Exceptions
Incase handling is unsuccesful for any reason (cfg might still get modified).

Reimplemented from ControlFlowGraphPass.

Definition at line 85 of file ScheduleEstimator.cc.

86  {
87 
88  for (int bbIndex = 0; bbIndex < cfg.nodeCount(); ++bbIndex) {
89  BasicBlockNode& bbn = cfg.node(bbIndex);
90  if (!bbn.isNormalBB()) {
91  bbn.setMaximumSize(0);
92  } else {
93  auto& bb = bbn.basicBlock();
94  bbn.setMaximumSize(
95  bbn.isScheduled() ?
96  bb.instructionCount() - bb.skippedFirstInstructions() :
97  maximumSizeOfBB(bb, mach));
98  }
99  }
100 }

References BasicBlockNode::basicBlock(), BasicBlockNode::isNormalBB(), BasicBlockNode::isScheduled(), maximumSizeOfBB(), BoostGraph< GraphNode, GraphEdge >::node(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), and BasicBlockNode::setMaximumSize().

Referenced by BBSchedulerController::handleCFGDDG().

Here is the call graph for this function:

◆ maximumSizeOfBB()

int ScheduleEstimator::maximumSizeOfBB ( TTAProgram::BasicBlock bb,
const TTAMachine::Machine mach 
)
static

Definition at line 49 of file ScheduleEstimator.cc.

50  {
51 
52  auto tempRegFiles = MachineConnectivityCheck::tempRegisterFiles(mach);
53  int tempRegCount = tempRegFiles.size();
54 
55  int size = 0;
56  int iCount = bb.instructionCount();
57 
58  for (int i = 0; i < iCount; i++) {
59  auto& ins = bb[i];
60  for (int j = 0; j < ins.moveCount(); j++) {
61  size++;
62  // temp reg copies may make schedule longer.
63  size += tempRegCount;
64  auto& m = ins.move(j);
65  auto& src = m.source();
66 
67  if (m.isControlFlowMove()) {
68  size += mach.controlUnit()->delaySlots() + 1;
69  }
70  if (src.isFUPort() && !src.isRA()) {
71  const Operation& o = src.hintOperation();
72  TCEString opName = o.name();
73  int lat = MachineInfo::maxLatency(mach,opName);
74  if (lat > 0) {
75  size += lat-1;
76  }
77  }
78  }
79  }
80  return size;
81 }

References TTAMachine::Machine::controlUnit(), TTAMachine::ControlUnit::delaySlots(), TTAProgram::CodeSnippet::instructionCount(), MachineInfo::maxLatency(), Operation::name(), and MachineConnectivityCheck::tempRegisterFiles().

Referenced by handleControlFlowGraph().

Here is the call graph for this function:

◆ shortDescription()

virtual std::string ScheduleEstimator::shortDescription ( ) const
inlinevirtual

A short description of the pass, usually the optimization name, such as "basic block scheduler".

Returns
The description as a string.

Implements SchedulerPass.

Definition at line 58 of file ScheduleEstimator.hh.

58 { return "Estimates max schedule length"; }

The documentation for this class was generated from the following files:
BoostGraph::node
Node & node(const int index) const
BasicBlockNode::isScheduled
bool isScheduled() const
Definition: BasicBlockNode.hh:93
ControlFlowGraphPass::ControlFlowGraphPass
ControlFlowGraphPass(InterPassData &data)
Definition: ControlFlowGraphPass.cc:42
MachineInfo::maxLatency
static int maxLatency(const TTAMachine::Machine &mach, TCEString &opName)
Definition: MachineInfo.cc:806
Operation::name
virtual TCEString name() const
Definition: Operation.cc:93
BasicBlockNode::basicBlock
TTAProgram::BasicBlock & basicBlock()
Definition: BasicBlockNode.cc:126
BasicBlockNode::setMaximumSize
void setMaximumSize(int sz)
Definition: BasicBlockNode.hh:128
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
TTAProgram::CodeSnippet::instructionCount
virtual int instructionCount() const
Definition: CodeSnippet.cc:205
BasicBlockNode
Definition: BasicBlockNode.hh:64
BasicBlockNode::isNormalBB
bool isNormalBB() const
Definition: BasicBlockNode.cc:239
TTAMachine::ControlUnit::delaySlots
int delaySlots() const
Operation
Definition: Operation.hh:59
MachineConnectivityCheck::tempRegisterFiles
static std::set< const TTAMachine::RegisterFile *, TTAMachine::MachinePart::Comparator > tempRegisterFiles(const TTAMachine::Machine &machine)
Definition: MachineConnectivityCheck.cc:1038
ScheduleEstimator::maximumSizeOfBB
static int maximumSizeOfBB(TTAProgram::BasicBlock &bb, const TTAMachine::Machine &mach)
Definition: ScheduleEstimator.cc:49
TCEString
Definition: TCEString.hh:53
BoostGraph::nodeCount
int nodeCount() const