OpenASIP 2.2
Loading...
Searching...
No Matches
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

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();
95 bbn.isScheduled() ?
96 bb.instructionCount() - bb.skippedFirstInstructions() :
97 maximumSizeOfBB(bb, mach));
98 }
99 }
100}
TTAProgram::BasicBlock & basicBlock()
bool isNormalBB() const
void setMaximumSize(int sz)
bool isScheduled() const
int nodeCount() const
Node & node(const int index) const
static int maximumSizeOfBB(TTAProgram::BasicBlock &bb, const TTAMachine::Machine &mach)

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}
static std::set< const TTAMachine::RegisterFile *, TTAMachine::MachinePart::Comparator > tempRegisterFiles(const TTAMachine::Machine &machine)
static int maxLatency(const TTAMachine::Machine &mach, TCEString &opName)
virtual TCEString name() const
Definition Operation.cc:93
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345
virtual int instructionCount() const

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: