OpenASIP  2.0
PRegionAliasAnalyzer.cc
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 PRegionAliasAnalyzer.cc
26  *
27  * Implementation of PRegionAliasAnalyzer class.
28  *
29  * Too much copy-paste here.
30  *
31  * TODO: This should be handled by memory categories, not alias analyzers.
32  * This may cause too much ddg edges, slowing things down
33  *
34  * @author Faked Heikki Kultala 2007 (heikki.kultala-no.spam-tut.fi)
35  * Real auther from log: 1737 pekka.j
36  * @note rating: red
37  */
38 
39 #include "PRegionAliasAnalyzer.hh"
40 
41 #include "MoveNode.hh"
42 #include "Move.hh"
43 #include "DataDependenceGraph.hh"
44 #include "Terminal.hh"
45 
46 using namespace TTAProgram;
47 using namespace TTAMachine;
48 
49 bool
52 
53  return true;
54 }
55 
59  const ProgramOperation& pop1,
60  const ProgramOperation& pop2,
62 
63  const MoveNode *rawSrc1 = addressOperandMove(pop1);
64  const MoveNode *rawSrc2 = addressOperandMove(pop2);
65  if (rawSrc1 == NULL || rawSrc2 == NULL ||
66  !rawSrc1->isMove() || !rawSrc2->isMove()) return ALIAS_UNKNOWN;
67 
68  const TTAProgram::Move &m1 = rawSrc1->move();
69  const TTAProgram::Move &m2 = rawSrc2->move();
72  return ALIAS_UNKNOWN;
73 
74  int pregion1 = m1.annotation(
76  int pregion2 = m2.annotation(
78 
79  if (pregion1 != pregion2) {
80 
81 #if 0
83  << "### based on PREGION info, removed a memory edge between "
84  << m1.toString() << " (" << pregion1 << ") and "
85  << m2.toString() << " (" << pregion2 << ")" << std::endl;
87  << "### src lines: ";
88  if (m1.hasSourceLineNumber())
90  << m1.sourceLineNumber() << " ";
91  if (m2.hasSourceLineNumber())
93  << m2.sourceLineNumber() << " ";
94  Application::logStream() << std::endl;
95 #endif
96  return ALIAS_FALSE;
97  }
98 
99  return ALIAS_UNKNOWN;
100 }
101 
TTAProgram
Definition: Estimator.hh:65
TTAProgram::ProgramAnnotation::ANN_PARALLEL_REGION_ID
@ ANN_PARALLEL_REGION_ID
The ID from the _TCEPREGION_START(N) markers.
Definition: ProgramAnnotation.hh:171
MoveNodeUse::BBRelation
BBRelation
Definition: MoveNodeUse.hh:23
PRegionAliasAnalyzer::isAddressTraceable
virtual bool isAddressTraceable(DataDependenceGraph &ddg, const ProgramOperation &pop)
Definition: PRegionAliasAnalyzer.cc:50
TTAProgram::Move::sourceLineNumber
int sourceLineNumber() const
Definition: Move.cc:459
DataDependenceGraph.hh
ProgramOperation
Definition: ProgramOperation.hh:70
TTAProgram::Move::toString
std::string toString() const
Definition: Move.cc:436
MoveNode
Definition: MoveNode.hh:65
PRegionAliasAnalyzer::analyze
virtual AliasingResult analyze(DataDependenceGraph &ddg, const ProgramOperation &pop1, const ProgramOperation &pop2, MoveNodeUse::BBRelation bbInfo)
Definition: PRegionAliasAnalyzer.cc:57
Terminal.hh
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
MemoryAliasAnalyzer::AliasingResult
AliasingResult
Definition: MemoryAliasAnalyzer.hh:50
MoveNode::isMove
bool isMove() const
TTAProgram::ProgramAnnotation::intValue
int intValue() const
Definition: ProgramAnnotation.cc:95
TTAProgram::Move
Definition: Move.hh:55
TTAProgram::AnnotatedInstructionElement::hasAnnotations
bool hasAnnotations(ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID) const
Definition: AnnotatedInstructionElement.cc:165
PRegionAliasAnalyzer.hh
TTAProgram::AnnotatedInstructionElement::annotation
ProgramAnnotation annotation(int index, ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID) const
Definition: AnnotatedInstructionElement.cc:100
MoveNode::move
TTAProgram::Move & move()
TTAProgram::Move::hasSourceLineNumber
bool hasSourceLineNumber() const
Definition: Move.cc:445
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
PRegionAliasAnalyzer::~PRegionAliasAnalyzer
~PRegionAliasAnalyzer()
Definition: PRegionAliasAnalyzer.cc:102
Move.hh
TTAMachine
Definition: Assembler.hh:48
MoveNode.hh