OpenASIP  2.0
MemoryAliasAnalyzer.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 MemoryAliasAnalyzer.hh
26  *
27  * Declaration of Memory Alias Analyzer interface
28  *
29  * @author Heikki Kultala 2006-2009 (heikki.kultala-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_MEMORY_ALIAS_ANALYZER_HH
34 #define TTA_MEMORY_ALIAS_ANALYZER_HH
35 
36 namespace TTAProgram {
37  class Procedure;
38 }
39 
40 class ProgramOperation;
42 class Operation;
43 class MoveNode;
44 
45 #include "MoveNodeUse.hh"
46 
48 public:
49 
51  // Only Use ALIAS_TRUE if they really fully alias.
52  // It's used for transitivity optimizations.
56 
58 
59  virtual AliasingResult analyze(
60  DataDependenceGraph& ddg, const ProgramOperation& pop1,
61  const ProgramOperation& pop2, MoveNodeUse::BBRelation bbInfo) = 0;
62 
63  /**
64  * Checks whether the analyzer knows anything about the address.
65  *
66  * ie. if it can return true or false to some query
67  * concerning this address.
68  *
69  * @return true if analyzer can know something about the address.
70  */
71  virtual bool isAddressTraceable(
73  const ProgramOperation& pop) = 0;
74 
75  virtual ~MemoryAliasAnalyzer() {}
76 protected:
78  int index1,
79  int index2,
80  const ProgramOperation& pop1,
81  const ProgramOperation& pop2);
82  static const MoveNode* addressOperandMove(const ProgramOperation&po);
83 
87  int operand1;
88  int operand2;
91 
92  void clear() {
94  operand1 = 0;
95  operand2 = 0;
96  }
97  };
98 
99  static TwoPartAddressOperandDetection findTwoPartAddressOperands(
100  const ProgramOperation& po);
101 
103  DataDependenceGraph& ddg, const MoveNode &mn, long& loopIncrement);
104 
105  static const MoveNode* findIncrement(const MoveNode& mn, long& increment);
106 
107  static const MoveNode* detectConstantScale(const MoveNode& mn, int &shiftAmount);
108 private:
109  unsigned int mausOfOperation(const Operation& op);
110 };
111 
112 #endif
TTAProgram
Definition: Estimator.hh:65
MemoryAliasAnalyzer::ALIAS_UNKNOWN
@ ALIAS_UNKNOWN
Definition: MemoryAliasAnalyzer.hh:54
MoveNodeUse::BBRelation
BBRelation
Definition: MoveNodeUse.hh:23
MemoryAliasAnalyzer::TwoPartAddressOperandDetection::TwoPartAddressOperandDetection
TwoPartAddressOperandDetection()
Definition: MemoryAliasAnalyzer.hh:89
MemoryAliasAnalyzer::mausOfOperation
unsigned int mausOfOperation(const Operation &op)
Definition: MemoryAliasAnalyzer.cc:100
MemoryAliasAnalyzer::analyze
virtual AliasingResult analyze(DataDependenceGraph &ddg, const ProgramOperation &pop1, const ProgramOperation &pop2, MoveNodeUse::BBRelation bbInfo)=0
MemoryAliasAnalyzer::ALIAS_FALSE
@ ALIAS_FALSE
Definition: MemoryAliasAnalyzer.hh:50
MemoryAliasAnalyzer::TwoPartAddressOperandDetection::NOT_FOUND
@ NOT_FOUND
Definition: MemoryAliasAnalyzer.hh:85
MemoryAliasAnalyzer::isAddressTraceable
virtual bool isAddressTraceable(DataDependenceGraph &ddg, const ProgramOperation &pop)=0
MemoryAliasAnalyzer::~MemoryAliasAnalyzer
virtual ~MemoryAliasAnalyzer()
Definition: MemoryAliasAnalyzer.hh:75
MemoryAliasAnalyzer::ALIAS_PARTIAL
@ ALIAS_PARTIAL
Definition: MemoryAliasAnalyzer.hh:55
ProgramOperation
Definition: ProgramOperation.hh:70
MoveNode
Definition: MoveNode.hh:65
MemoryAliasAnalyzer::TwoPartAddressOperandDetection::clear
void clear()
Definition: MemoryAliasAnalyzer.hh:92
MemoryAliasAnalyzer::detectConstantScale
static const MoveNode * detectConstantScale(const MoveNode &mn, int &shiftAmount)
Definition: MemoryAliasAnalyzer.cc:389
MemoryAliasAnalyzer::findTwoPartAddressOperands
static TwoPartAddressOperandDetection findTwoPartAddressOperands(const ProgramOperation &po)
Definition: MemoryAliasAnalyzer.cc:175
MemoryAliasAnalyzer::TwoPartAddressOperandDetection::OffsetOperation
OffsetOperation
Definition: MemoryAliasAnalyzer.hh:85
MemoryAliasAnalyzer::TwoPartAddressOperandDetection::offsetOperation
OffsetOperation offsetOperation
Definition: MemoryAliasAnalyzer.hh:86
MemoryAliasAnalyzer::TwoPartAddressOperandDetection::operand2
int operand2
Definition: MemoryAliasAnalyzer.hh:88
MemoryAliasAnalyzer::AliasingResult
AliasingResult
Definition: MemoryAliasAnalyzer.hh:50
MemoryAliasAnalyzer::ALIAS_TRUE
@ ALIAS_TRUE
Definition: MemoryAliasAnalyzer.hh:53
MemoryAliasAnalyzer::initProcedure
virtual void initProcedure(TTAProgram::Procedure &)
Definition: MemoryAliasAnalyzer.hh:57
MemoryAliasAnalyzer
Definition: MemoryAliasAnalyzer.hh:47
MemoryAliasAnalyzer::searchLoopIndexBasedIncrement
static const MoveNode * searchLoopIndexBasedIncrement(DataDependenceGraph &ddg, const MoveNode &mn, long &loopIncrement)
Definition: MemoryAliasAnalyzer.cc:321
MemoryAliasAnalyzer::addressOperandMove
static const MoveNode * addressOperandMove(const ProgramOperation &po)
Definition: MemoryAliasAnalyzer.cc:147
Operation
Definition: Operation.hh:59
MemoryAliasAnalyzer::findIncrement
static const MoveNode * findIncrement(const MoveNode &mn, long &increment)
Definition: MemoryAliasAnalyzer.cc:273
MemoryAliasAnalyzer::TwoPartAddressOperandDetection::SUB
@ SUB
Definition: MemoryAliasAnalyzer.hh:85
MemoryAliasAnalyzer::compareIndeces
AliasingResult compareIndeces(int index1, int index2, const ProgramOperation &pop1, const ProgramOperation &pop2)
Definition: MemoryAliasAnalyzer.cc:62
MoveNodeUse.hh
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
MemoryAliasAnalyzer::TwoPartAddressOperandDetection::ADD
@ ADD
Definition: MemoryAliasAnalyzer.hh:85
MemoryAliasAnalyzer::TwoPartAddressOperandDetection
Definition: MemoryAliasAnalyzer.hh:84
TTAProgram::Procedure
Definition: Procedure.hh:55
MemoryAliasAnalyzer::TwoPartAddressOperandDetection::operand1
int operand1
Definition: MemoryAliasAnalyzer.hh:87