OpenASIP 2.2
Loading...
Searching...
No Matches
BasicBlockScheduler.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2010 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file BasicBlockScheduler.hh
26 *
27 * Declaration of BasicBlockScheduler class.
28 *
29 * @author Pekka J��skel�inen 2006,2010 (pjaaskel-no.spam-cs.tut.fi)
30 * @author Fabio Garzia 2010 (fabio.garzia-no.spam-tut.fi)
31 * @note rating: red
32 */
33
34#ifndef TTA_BB_SCHEDULER_HH
35#define TTA_BB_SCHEDULER_HH
36
37#include "MoveNodeSelector.hh"
38#include "DDGPass.hh"
39#include "BasicBlockPass.hh"
41
45class RegisterRenamer;
46class MoveNode;
47class MoveNodeGroup;
49
50namespace TTAMachine {
51 class Unit;
52 class Port;
53 class RegisterFile;
54}
55
56/**
57 * A class that implements the functionality of a basic block scheduler.
58 *
59 * Schedules the program one basic block at a time. Does not fill delay slots
60 * if they couldn't be filled with the basic block's contents itself (no
61 * instruction importing).
62 */
64 public DDGPass, public BasicBlockPass {
65public:
67 InterPassData& data, SoftwareBypasser* bypasser=NULL,
68 RegisterRenamer* renamer=NULL);
69
70 virtual ~BasicBlockScheduler();
71
72 virtual int handleDDG(
74 const TTAMachine::Machine& targetMachine, int minCycle = 0,
75 bool testOnly = false) override;
76
77 virtual int handleLoopDDG(
79 const TTAMachine::Machine& targetMachine, int tripCount,
80 SimpleResourceManager* prologRM, bool testOnly = false) override;
81
82 virtual std::string shortDescription() const;
83 virtual std::string longDescription() const;
84
85 virtual void printStats() const;
86
88
89 static MoveNode* findTrigger(
90 const ProgramOperation& po,
91 const TTAMachine::Machine& mach);
92
93protected:
94 void scheduleRRMove(MoveNode& moveNode);
95
97
98 int scheduleOperandWrites(int& cycle, MoveNodeGroup& moves);
99
101
102 void scheduleMove(
103 MoveNode& move, int earliestCycle, bool allowPredicationAndRenaming);
104
106 MoveNode& regToRegMove, MoveNode& firstMove, int lastUse);
107
109 MoveNode& operandMove, MoveNode& operandWrite);
110
111 void unschedule(MoveNode& moveNode);
112
113 void unscheduleAllNodes();
114
115 void unscheduleInputOperandTempMoves(MoveNode& operandMove);
116
118 MoveNode& resultMove, MoveNode& resultRead, int lastUse);
119
120 void unscheduleResultReadTempMoves(MoveNode& resultMove);
121
122 void notifyScheduled(MoveNodeGroup& moves, MoveNodeSelector& selector);
123
124 void ddgSnapshot(
125 DataDependenceGraph& ddg, const std::string& name,
126 DataDependenceGraph::DumpFileFormat format, bool final,
127 bool resetCounter = false) const;
128
130
132 const ProgramOperation& po, const TTAMachine::Unit& unit);
133
135 const Operation& operation, const TTAMachine::Machine& machine);
136
138
140 std::set<std::pair<TTAProgram::Move*, int> > removedMoves);
141
142 bool tryToOptimizeWaw(const MoveNode& moveNode);
143
145
146 /// The target machine we are scheduling the program against.
148 /// DDG of the currently scheduled BB.
150 /// Resource Manager of the currently scheduled BB.
152 /// Stores the MoveNodes that were scheduled as temp moves during
153 /// scheduling of the operand move.
154 std::map<const MoveNode*, DataDependenceGraph::NodeSet> scheduledTempMoves_;
155 /// The software bypasser to use to bypass registers when possible.
157
159
160 /// The earliest cycle to schedule moves in. Used to leave room for
161 /// sched_yield() by the sched_yield() emitter.
163
167
169
171
173};
174
175#endif
TTAMachine::Machine * machine
the architecture definition of the estimated processor
virtual DataDependenceGraphBuilder & ddgBuilder()
void scheduleMove(MoveNode &move, int earliestCycle, bool allowPredicationAndRenaming)
void scheduleRRTempMoves(MoveNode &regToRegMove, MoveNode &firstMove, int lastUse)
MoveNodeSelector * selector_
bool tryToSwitchInputs(ProgramOperation &op)
void unscheduleInputOperandTempMoves(MoveNode &operandMove)
static MoveNode * findTriggerFromUnit(const ProgramOperation &po, const TTAMachine::Unit &unit)
bool tryToOptimizeWaw(const MoveNode &moveNode)
void tryToDelayOperands(MoveNodeGroup &moves)
SimpleResourceManager * rm_
Resource Manager of the currently scheduled BB.
static MoveNode * findTrigger(const ProgramOperation &po, const TTAMachine::Machine &mach)
int scheduleOperandWrites(int &cycle, MoveNodeGroup &moves)
bool scheduleResultReads(MoveNodeGroup &moves)
void unscheduleResultReadTempMoves(MoveNode &resultMove)
virtual int handleDDG(DataDependenceGraph &ddg, SimpleResourceManager &rm, const TTAMachine::Machine &targetMachine, int minCycle=0, bool testOnly=false) override
void scheduleRRMove(MoveNode &moveNode)
SoftwareBypasser * softwareBypasser_
The software bypasser to use to bypass registers when possible.
virtual std::string longDescription() const
void scheduleInputOperandTempMoves(MoveNode &operandMove, MoveNode &operandWrite)
const TTAMachine::Machine * targetMachine_
The target machine we are scheduling the program against.
DataDependenceGraph * ddg_
DDG of the currently scheduled BB.
virtual int handleLoopDDG(DataDependenceGraph &ddg, SimpleResourceManager &rm, const TTAMachine::Machine &targetMachine, int tripCount, SimpleResourceManager *prologRM, bool testOnly=false) override
virtual std::string shortDescription() const
std::map< const MoveNode *, DataDependenceGraph::NodeSet > scheduledTempMoves_
Stores the MoveNodes that were scheduled as temp moves during scheduling of the operand move.
void scheduleOperation(MoveNodeGroup &moves)
void handleRemovedResultMoves(std::set< std::pair< TTAProgram::Move *, int > > removedMoves)
int getTriggerOperand(const Operation &operation, const TTAMachine::Machine &machine)
LLVMTCECmdLineOptions * options_
void scheduleResultReadTempMoves(MoveNode &resultMove, MoveNode &resultRead, int lastUse)
int minCycle_
The earliest cycle to schedule moves in. Used to leave room for sched_yield() by the sched_yield() em...
void notifyScheduled(MoveNodeGroup &moves, MoveNodeSelector &selector)
void unschedule(MoveNode &moveNode)
MoveNode * succeedingTempMove(MoveNode &current)
virtual void printStats() const
RegisterRenamer * renamer_
void ddgSnapshot(DataDependenceGraph &ddg, const std::string &name, DataDependenceGraph::DumpFileFormat format, bool final, bool resetCounter=false) const