OpenASIP 2.2
Loading...
Searching...
No Matches
Peel2BBLoops.hh
Go to the documentation of this file.
1/**
2 * @file Peel2BBLoops.hh
3 *
4 * This optimizer optimizes some 2-bb loops into
5 * 1-BB loop be peeling out the 1st iteration which jumps into the middle
6 * of the jump. The resulting 1-BB loop can then be loop-scheduled.
7 *
8 * @author Heikki Kultala 2016 (heikki.kultala@tut.fi)
9 * @note rating: red
10 */
11
12#ifndef TTA_PEEL_2_BB_LOOPS_HH
13#define TTA_PEEL_2_BB_LOOPS_HH
14
15#include "ProcedurePass.hh"
17#include "ProgramPass.hh"
18#include "Application.hh"
19#include <vector>
20
21
23
24public:
26 InterPassData& data, const TTAMachine::Machine& targetMachine);
27
30 const TTAMachine::Machine& targetMachine) override;
31
32 virtual std::string shortDescription() const override {
33 return "optimizes two-BB inner loops into single-bb inner loops";
34 }
35private:
36 struct BBNodes {
37 BBNodes(bool ok) : BBNodes() {
38 assert(!ok && "only call this on fail to allow return false"); }
39 BBNodes() : preLoop(NULL), beginLoop(NULL),
40 endLoop(NULL), postLoop(NULL) {}
43 : preLoop(prel), beginLoop(bl), endLoop(el), postLoop(pol) {}
48 operator bool() const { return preLoop != NULL; }
49 };
50
52
54 void peel2BBLoop(ControlFlowGraph& cfg, BBNodes& bbns);
55 void updateCFG(ControlFlowGraph& cfg, BBNodes& bbns);
56 void performCodeMotion(BBNodes& bbns);
57 void appendBB(
58 const TTAProgram::BasicBlock& src,
60 BasicBlockNode* newJumpDest);
61
65};
66
67#endif
#define assert(condition)
std::shared_ptr< ProgramOperation > ProgramOperationPtr
Definition MoveNode.hh:53
TTAProgram::CodeGenerator * codeGenerator_
TTAProgram::InstructionReferenceManager * irm_
bool negateOp(ProgramOperationPtr po)
BBNodes testIf2BBLoop(ControlFlowGraph &cfg, BasicBlockNode &bbn)
void appendBB(const TTAProgram::BasicBlock &src, TTAProgram::BasicBlock &dest, BasicBlockNode *newJumpDest)
virtual std::string shortDescription() const override
void handleControlFlowGraph(ControlFlowGraph &cfg, const TTAMachine::Machine &targetMachine) override
void performCodeMotion(BBNodes &bbns)
const TTAMachine::Machine & mach_
void peel2BBLoop(ControlFlowGraph &cfg, BBNodes &bbns)
void updateCFG(ControlFlowGraph &cfg, BBNodes &bbns)
BasicBlockNode * preLoop
BasicBlockNode * postLoop
BasicBlockNode * beginLoop
BasicBlockNode * endLoop
BBNodes(BasicBlockNode *prel, BasicBlockNode *bl, BasicBlockNode *el, BasicBlockNode *pol)