OpenASIP 2.2
Loading...
Searching...
No Matches
PostpassOperandSharer.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 PostpassOperandSharer.hh
26 *
27 * Declaration of PostpassOperandSharer class.
28 *
29 * This optimizer removes operand writes which are redundant due
30 * other operations using same value.
31 * This is executed after the main scheduler, so this mainly helps
32 * to reduce power consumption, not to improve performance.
33 *
34 * @author Heikki Kultala 2013 (hkultala-no.spam-cs.tut.fi)
35 * @note rating: red
36 */
37
38#include "BasicBlockPass.hh"
40
41namespace TTAProgram {
42 class BasicBlocK;
43 class Move;
44 class InstructionReferenceManager;
45}
46
49
50public:
55
56 virtual ~PostpassOperandSharer();
57
58 virtual void handleBasicBlock(
59 TTAProgram::BasicBlock& basicBlock,
60 const TTAMachine::Machine& targetMachine,
62 BasicBlockNode* bbn = NULL);
63
65 TTAProgram::BasicBlock& basicBlock,
66 int insIndex,
67 TTAProgram::Move& move);
68
69 static void printStats();
70
71 virtual std::string shortDescription() const {
72 return "Post-pass that reduced redundant operand writes";
73 }
74private:
76 static unsigned int moveCount_;
77 static unsigned int operandCount_;
78 static unsigned int removedOperands_;
79 static unsigned int registerReads_;
80 static unsigned int triggerCannotRemove_;
81};
virtual std::string shortDescription() const
TTAProgram::InstructionReferenceManager * irm_
static unsigned int operandCount_
bool tryRemoveOperandWrite(TTAProgram::BasicBlock &basicBlock, int insIndex, TTAProgram::Move &move)
PostpassOperandSharer(InterPassData &ipd, TTAProgram::InstructionReferenceManager &irm)
static unsigned int registerReads_
static unsigned int triggerCannotRemove_
static unsigned int moveCount_
virtual void handleBasicBlock(TTAProgram::BasicBlock &basicBlock, const TTAMachine::Machine &targetMachine, TTAProgram::InstructionReferenceManager &irm, BasicBlockNode *bbn=NULL)
static unsigned int removedOperands_