OpenASIP 2.2
Loading...
Searching...
No Matches
TerminalInstructionReference.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2011 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 TerminalInstructionAddress.cc
26 *
27 * Implementation of TerminalInstructionAddress class.
28 *
29 * @author Ari Metsähalme 2005 (ari.metsahalme-no.spam-tut.fi)
30 * @author Pekka Jääskeläinen 2011
31 * @note rating: red
32 */
33
36#include "Instruction.hh"
38#include "BasicBlock.hh"
39
40using namespace TTAMachine;
41
42namespace TTAProgram {
43
44/**
45 * The constructor.
46 *
47 * @param value The value of the inline immediate (the address).
48 * @param space The address space of the address the immediate refers to.
49 * @param ref The instruction this address refers to.
50 */
54
55/**
56 * The destructor.
57 */
60
61/**
62 * Returns the value of the immediate (instruction address).
63 *
64 * @return The value of the immediate (instruction address).
65 */
70
71/**
72 * Returns a reference to the instruction to which the immediate points.
73 *
74 * @return A reference to the instruction to which the immediate points.
75 * @exception WrongSubclass never.
76 */
81
82/**
83 * Returns a reference to the instruction to which the immediate points.
84 *
85 * @return A reference to the instruction to which the immediate points.
86 * @exception WrongSubclass never.
87 */
92
93/**
94 * Set a new referred instruction.
95 *
96 * @param ref The new instruction reference.
97 * @exception WrongSubclass never.
98 */
99void
104
105/**
106 * Creates an exact copy of the terminal and returns it.
107 *
108 * @return A copy of the terminal.
109 */
114
115/**
116 * Checks if terminals are equal.
117 *
118 * @param other Terminal to compare.
119 * @return true if terminals are equal.
120 */
121bool
123
124 const TerminalBasicBlockReference* otherBBRef =
125 dynamic_cast<const TerminalBasicBlockReference*>(&other);
126 if (otherBBRef) {
127 const BasicBlock& bb = otherBBRef->basicBlock();
128 return &ref_.instruction() == &(bb.firstInstruction());
129 }
130
131 const TerminalInstructionReference* otherInsRef =
132 dynamic_cast<const TerminalInstructionReference*>(&other);
133 if (otherInsRef) {
134 return otherInsRef->instructionReference() ==
135 ref_;
136 }
137 return false;
138}
139
140}
virtual Instruction & firstInstruction() const
Address address() const
virtual const BasicBlock & basicBlock() const
virtual bool equals(const Terminal &other) const
virtual void setInstructionReference(InstructionReference ref)
virtual const InstructionReference & instructionReference() const
InstructionReference ref_
Referred instruction.