OpenASIP  2.0
BBSchedulerController.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2015 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 BBSchedulerController.hh
26  *
27  * Declaration of BBSchedulerController class.
28  * @author Pekka Jääskeläinen 2006-2011 (pjaaskel-no.spam-cs.tut.fi)
29  * @author Heikki Kultala 2009 (hkultala-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_BB_SCHEDULER_CONTROLLER_HH
34 #define TTA_BB_SCHEDULER_CONTROLLER_HH
35 
36 #include <boost/progress.hpp>
37 
38 #include "BasicBlockPass.hh"
39 #include "ControlFlowGraphPass.hh"
40 #include "ProcedurePass.hh"
41 #include "ProgramPass.hh"
42 #include "Program.hh"
43 
44 class BasicBlockNode;
45 class SoftwareBypasser;
48 class DDGPass;
50 
51 namespace TTAProgram {
52  class Procedure;
53  class Program;
54 }
55 
56 /**
57  * A class that control operation of a basic block scheduler.
58  *
59  * This class handles calling other optimization passes and tranferring data
60  * for the actual BB scheduler and loop scheudlers etc.
61  */
63  public BasicBlockPass, public ControlFlowGraphPass, public ProcedurePass,
64  public ProgramPass {
65 public:
67  const TTAMachine::Machine& targetMachine,
68  InterPassData& data, SoftwareBypasser* bypasser=NULL,
69  CopyingDelaySlotFiller* delaySlotFiller=NULL,
70  DataDependenceGraph* bigDDG = NULL);
71  virtual ~BBSchedulerController();
72 
73  virtual void handleBasicBlock(
74  TTAProgram::BasicBlock& bb, const TTAMachine::Machine& targetMachine,
76  BasicBlockNode* bbn = NULL) override;
77 
78  virtual void handleControlFlowGraph(
79  ControlFlowGraph& cfg,
80  const TTAMachine::Machine& targetMachine) override;
81 
82  virtual void handleProcedure(
83  TTAProgram::Procedure& procedure,
84  const TTAMachine::Machine& targetMachine) override;
85 
86  // is needed only for some sw bypass statistics
87  virtual void handleProgram(
89  const TTAMachine::Machine& targetMachine) override;
90 
91  bool handleBBNode(
93  const TTAMachine::Machine& targetMachine, int nodeCount);
94 
95  virtual void executeDDGPass(
96  TTAProgram::BasicBlock& bb, const TTAMachine::Machine& targetMachine,
98  std::vector<DDGPass*> ddgPasses, BasicBlockNode* bbn = NULL) override;
99 
100  virtual void handleCFGDDG(
101  ControlFlowGraph& cfg,
102  DataDependenceGraph* ddg,
103  const TTAMachine::Machine& targetMachine);
104 
105  virtual std::string shortDescription() const override;
106  virtual std::string longDescription() const override;
107 
108 protected:
111 
112 private:
113 
115 
116  /// The currently scheduled procedure.
118 
119  /// Control flow graph of the procedure.
121 
122  /// whole-procedure DDG.
124  /// The software bypasser to use to bypass registers when possible.
126 
128 
129  /// Number of basic blocks scheduled so far.
131  /// Total basic blocks in the CFG currently being scheduled.
133  /// Fancy progress bar. Pointer because creation outputs the initial
134  /// progress bar and we want it only on verbose mode.
135  boost::progress_display* progressBar_;
136 
138 };
139 
140 #endif
ProcedurePass
Definition: ProcedurePass.hh:53
TTAProgram
Definition: Estimator.hh:65
TTAProgram::Program
Definition: Program.hh:63
BBSchedulerController::handleCFGDDG
virtual void handleCFGDDG(ControlFlowGraph &cfg, DataDependenceGraph *ddg, const TTAMachine::Machine &targetMachine)
Definition: BBSchedulerController.cc:603
BBSchedulerController::bigDDG_
DataDependenceGraph * bigDDG_
whole-procedure DDG.
Definition: BBSchedulerController.hh:123
BBSchedulerController::handleProgram
virtual void handleProgram(TTAProgram::Program &program, const TTAMachine::Machine &targetMachine) override
Definition: BBSchedulerController.cc:414
ProgramPass
Definition: ProgramPass.hh:52
BBSchedulerController::options_
LLVMTCECmdLineOptions * options_
Definition: BBSchedulerController.hh:137
BBSchedulerController::longDescription
virtual std::string longDescription() const override
Definition: BBSchedulerController.cc:439
BBSchedulerController::handleBBNode
bool handleBBNode(ControlFlowGraph &cfg, BasicBlockNode &bbn, const TTAMachine::Machine &targetMachine, int nodeCount)
Definition: BBSchedulerController.cc:575
BasicBlockPass
Definition: BasicBlockPass.hh:60
BBSchedulerController::~BBSchedulerController
virtual ~BBSchedulerController()
Definition: BBSchedulerController.cc:109
ProgramPass.hh
BBSchedulerController::delaySlotFiller_
CopyingDelaySlotFiller * delaySlotFiller_
Definition: BBSchedulerController.hh:127
ProcedurePass.hh
BasicBlockPass.hh
BBSchedulerController::cfg_
ControlFlowGraph * cfg_
Control flow graph of the procedure.
Definition: BBSchedulerController.hh:120
BBSchedulerController::progressBar_
boost::progress_display * progressBar_
Fancy progress bar. Pointer because creation outputs the initial progress bar and we want it only on ...
Definition: BBSchedulerController.hh:135
CopyingDelaySlotFiller
Definition: CopyingDelaySlotFiller.hh:71
BasicBlockNode
Definition: BasicBlockNode.hh:64
BBSchedulerController::executeDDGPass
virtual void executeDDGPass(TTAProgram::BasicBlock &bb, const TTAMachine::Machine &targetMachine, TTAProgram::InstructionReferenceManager &irm, std::vector< DDGPass * > ddgPasses, BasicBlockNode *bbn=NULL) override
Definition: BBSchedulerController.cc:472
InterPassData
Definition: InterPassData.hh:48
LLVMTCECmdLineOptions
Definition: LLVMTCECmdLineOptions.hh:48
BBSchedulerController::shortDescription
virtual std::string shortDescription() const override
Definition: BBSchedulerController.cc:426
TTAProgram::BasicBlock
Definition: BasicBlock.hh:85
DDGPass
Definition: DDGPass.hh:51
TTAProgram::InstructionReferenceManager
Definition: InstructionReferenceManager.hh:82
Program.hh
BBSchedulerController::handleControlFlowGraph
virtual void handleControlFlowGraph(ControlFlowGraph &cfg, const TTAMachine::Machine &targetMachine) override
Definition: BBSchedulerController.cc:398
BBSchedulerController::BBSchedulerController
BBSchedulerController(const TTAMachine::Machine &targetMachine, InterPassData &data, SoftwareBypasser *bypasser=NULL, CopyingDelaySlotFiller *delaySlotFiller=NULL, DataDependenceGraph *bigDDG=NULL)
Definition: BBSchedulerController.cc:92
ControlFlowGraphPass.hh
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
SoftwareBypasser
Definition: SoftwareBypasser.hh:52
BBSchedulerController::totalBasicBlocks_
int totalBasicBlocks_
Total basic blocks in the CFG currently being scheduled.
Definition: BBSchedulerController.hh:132
BBSchedulerController::createDDGFromBB
virtual DataDependenceGraph * createDDGFromBB(TTAProgram::BasicBlock &bb, const TTAMachine::Machine &mach)
Definition: BBSchedulerController.cc:455
BBSchedulerController::softwareBypasser_
SoftwareBypasser * softwareBypasser_
The software bypasser to use to bypass registers when possible.
Definition: BBSchedulerController.hh:125
ControlFlowGraphPass
Definition: ControlFlowGraphPass.hh:50
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80
BBSchedulerController::scheduledProcedure_
TTAProgram::Procedure * scheduledProcedure_
The currently scheduled procedure.
Definition: BBSchedulerController.hh:117
BBSchedulerController::targetMachine_
const TTAMachine::Machine & targetMachine_
Definition: BBSchedulerController.hh:114
BBSchedulerController::basicBlocksScheduled_
int basicBlocksScheduled_
Number of basic blocks scheduled so far.
Definition: BBSchedulerController.hh:130
BBSchedulerController::handleProcedure
virtual void handleProcedure(TTAProgram::Procedure &procedure, const TTAMachine::Machine &targetMachine) override
Definition: BBSchedulerController.cc:284
BBSchedulerController::handleBasicBlock
virtual void handleBasicBlock(TTAProgram::BasicBlock &bb, const TTAMachine::Machine &targetMachine, TTAProgram::InstructionReferenceManager &irm, BasicBlockNode *bbn=NULL) override
Definition: BBSchedulerController.cc:123
TTAProgram::Procedure
Definition: Procedure.hh:55
ControlFlowGraph
Definition: ControlFlowGraph.hh:100
BBSchedulerController
Definition: BBSchedulerController.hh:62
TTAMachine::Machine
Definition: Machine.hh:73