OpenASIP 2.2
Loading...
Searching...
No Matches
PreOptimizer.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 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 PreOptimizer.hh
26 *
27 * Declaration of PreOptimizer class.
28 *
29 * This optimizer does some peephole optimizations before actual scheduling:
30 *
31 * Removes unneeded predicate arithmetic by using
32 * opposite guard instead where the guard is used.
33 *
34 * Changes registers of address calculations to eliminate entideps
35 *
36 * Removes adds of compile-time ocnstants
37 *
38 * @author Heikki Kultala 2009 (hkultala-no.spam-cs.tut.fi)
39 * @note rating: red
40 */
41
42#ifndef TTA_PRE_OPTIMIZER_HH
43#define TTA_PRE_OPTIMIZER_HH
44
45#include "ProcedurePass.hh"
46#include "ProgramPass.hh"
49#include "ControlFlowGraph.hh"
50
51namespace TTAProgram {
52 class CodeSnippet;
53 class Procedure;
54 class Program;
55 class InstructionReferenceManager;
56 class Instruction;
57}
58
59namespace TTAMachine {
60 class Machine;
61}
62
65
67 public ProcedurePass, public ProgramPass , public ControlFlowGraphPass {
68
69public:
71
72 void handleProgram(
73 TTAProgram::Program& program, const TTAMachine::Machine& targetMachine);
74
75 void handleProcedure(
76 TTAProgram::Procedure& procedure,
77 const TTAMachine::Machine& targetMachine);
78
80 ControlFlowGraph& cfg, const TTAMachine::Machine& targetMachine);
81
82 void handleCFGDDG(
85
86 std::string shortDescription() const {
87 return "optimizes away guard nagation operations, "
88 "uses opposite guards instead"; };
89private:
93
97
100
105 ControlFlowGraph& cfg);
106
111 ControlFlowGraph& cfg);
112
117 ControlFlowGraph& cfg);
118
121
124
125};
126
127#endif
find Finds info of the inner loops in the program
std::set< GraphNode *, typename GraphNode::Comparator > NodeSet
Definition Graph.hh:53
std::set< GraphEdge *, typename GraphEdge::Comparator > EdgeSet
Definition Graph.hh:54
ControlFlowGraph::NodeSet tryToRemoveGuardInversingOp(DataDependenceGraph &ddg, ProgramOperation &po, TTAProgram::InstructionReferenceManager *irm, ControlFlowGraph &cfg)
void tryToPrecalcConstantAdd(DataDependenceGraph &ddg, ProgramOperation &po)
bool checkGuardReversalAllowed(DataDependenceGraph &ddg, DataDependenceGraph::EdgeSet &oEdges)
void handleControlFlowGraph(ControlFlowGraph &cfg, const TTAMachine::Machine &targetMachine)
std::string shortDescription() const
ControlFlowGraph::NodeSet tryToRemoveEq(DataDependenceGraph &ddg, ProgramOperation &po, TTAProgram::InstructionReferenceManager *irm, ControlFlowGraph &cfg)
ControlFlowGraph::NodeSet inverseGuardsOfHeads(DataDependenceGraph &ddg, DataDependenceGraph::EdgeSet &oEdges)
ControlFlowGraph::NodeSet tryToRemoveXor(DataDependenceGraph &ddg, ProgramOperation &po, TTAProgram::InstructionReferenceManager *irm, ControlFlowGraph &cfg)
void handleProcedure(TTAProgram::Procedure &procedure, const TTAMachine::Machine &targetMachine)
void handleProgram(TTAProgram::Program &program, const TTAMachine::Machine &targetMachine)
bool tryToOptimizeAddressReg(DataDependenceGraph &ddg, ProgramOperation &po)
bool cfgAllowsJumpReversal(TTAProgram::Instruction &ins, ControlFlowGraph &cfg)
void handleCFGDDG(ControlFlowGraph &cfg, DataDependenceGraph &ddg)