OpenASIP 2.2
Loading...
Searching...
No Matches
RelocElement.icc
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 RelocElement.icc
26 *
27 * Inline definitions of RelocElement class.
28 *
29 * @author Jussi Nykänen 2003 (nykanen-no.spam-cs.tut.fi)
30 * @author Mikael Lepistö 2003 (tmlepist-no.spam-cs.tut.fi)
31 * @note reviewed 22 October 2003 by ml, jn, ao, tr
32 *
33 * @note rating: yellow
34 */
35
36namespace TPEF {
37
38/**
39 * Returns the type of relocation.
40 *
41 * @return The type of relocation.
42 */
43inline RelocElement::RelocType
44RelocElement::type() const {
45 return type_;
46}
47
48/**
49 * Sets the type of relocation.
50 *
51 * @param aType The type of relocation.
52 */
53inline void
54RelocElement::setType(RelocType aType) {
55 type_ = aType;
56}
57
58/**
59 * Returns the element where is the location to be relocated.
60 *
61 * @return The element where is the location to be relocated.
62 */
63inline SectionElement*
64RelocElement::location() const {
65 return dynamic_cast<SectionElement*>(location_->pointer());
66}
67
68/**
69 * Sets the element where is the location to be relocated.
70 *
71 * @param aLocation The element where is the location to be relocated.
72 */
73inline void
74RelocElement::setLocation(SectionElement* aLocation) {
75 location_ =
76 ReferenceManager::SafePointer::replaceReference(location_, aLocation);
77}
78
79/**
80 * Sets the element where is the location to be relocated.
81 *
82 * @param aLocation The element where is the location to be relocated.
83 */
84inline void
85RelocElement::setLocation(
86 const ReferenceManager::SafePointer* aLocation) {
87 location_ = aLocation;
88}
89
90/**
91 * Returns the element where is the destination of the location to relocate.
92 *
93 * @return The element where is the destination of the location to relocate.
94 */
95inline SectionElement*
96RelocElement::destination() const {
97 return dynamic_cast<SectionElement*>(destination_->pointer());
98}
99
100/**
101 * Sets the element where is the destination of the location to relocate.
102 *
103 * @param aDestination The destination of the location to relocate.
104 */
105inline void
106RelocElement::setDestination(SectionElement* aDestination) {
107 destination_ = ReferenceManager::SafePointer::replaceReference(
108 destination_, aDestination);
109}
110
111/**
112 * Sets the element where is the destination of the location to relocate.
113 *
114 * @param aDestination The destination of the location to relocate.
115 */
116inline void
117RelocElement::setDestination(
118 const ReferenceManager::SafePointer* aDestination) {
119 destination_ = aDestination;
120}
121
122/**
123 * Returns the bit width of value to be relocated.
124 *
125 * @return The bit width of value to be relocated.
126 */
127inline Byte
128RelocElement::size() const {
129 return size_;
130}
131
132/**
133 * Sets the bit width of value to be relocated.
134 *
135 * @param aSize The bit width of value to be relocated.
136 */
137inline void
138RelocElement::setSize(Byte aSize) {
139 size_ = aSize;
140}
141
142/**
143 * Returns the bit offset where bits of this chunk are in the whole value.
144 *
145 * This property applies only for chunked relocations. If destination
146 * address is stored in many immediate elements (chunked address),
147 * this offset tells which part of the destination address are stored
148 * in the location() immediate of this relocation element.
149 *
150 * @return The bit offset where bits of this chunk are in the whole value.
151 */
152inline Byte
153RelocElement::bitOffset() const {
154 return bitOffset_;
155}
156
157/**
158 * Sets the bit offset where bits of this chunk should be in whole value.
159 *
160 * See bitOffset() method.
161 *
162 * @param anOffset Where bits of this chunk should be in whole value.
163 */
164inline void
165RelocElement::setBitOffset(Byte anOffset) {
166 bitOffset_ = anOffset;
167}
168
169/**
170 * Returns The symbol of relocation.
171 *
172 * @return The symbol of relocation.
173 */
174inline SymbolElement*
175RelocElement::symbol() const {
176 return dynamic_cast<SymbolElement*>(symbol_->pointer());
177}
178
179/**
180 * Sets the symbol of relocation.
181 *
182 * @param aSymbol The symbol of relocation.
183 */
184inline void
185RelocElement::setSymbol(SymbolElement* aSymbol) {
186 symbol_ =
187 ReferenceManager::SafePointer::replaceReference(symbol_, aSymbol);
188}
189
190/**
191 * Sets the symbol of relocation.
192 *
193 * @param aSymbol The symbol of relocation.
194 */
195inline void
196RelocElement::setSymbol(const ReferenceManager::SafePointer* aSymbol) {
197 symbol_ = aSymbol;
198}
199
200/**
201 * Returns the address space of destination element.
202 *
203 * @return The address space of destination element.
204 */
205inline ASpaceElement*
206RelocElement::aSpace() const {
207 return dynamic_cast<ASpaceElement*>(aSpace_->pointer());
208}
209
210/**
211 * Sets the address space of destination element.
212 *
213 * @param anASpace The address space of relocated element.
214 */
215inline void
216RelocElement::setASpace(ASpaceElement* anASpace) {
217 aSpace_ =
218 ReferenceManager::SafePointer::replaceReference(aSpace_, anASpace);
219}
220
221/**
222 * Sets the address space of destination element.
223 *
224 * @param anASpace The address space of destination element.
225 */
226inline void
227RelocElement::setASpace(const ReferenceManager::SafePointer* anASpace) {
228 aSpace_ = anASpace;
229}
230
231/**
232 * Returns true if relocation applies to chunked address.
233 *
234 * This property is probably never needed...
235 *
236 * @return True if relocation applies to chunked address.
237 */
238inline bool
239RelocElement::chunked() const {
240 return chunked_;
241}
242
243/**
244 * Sets wether the relocation applies to chunked or complete address.
245 *
246 * @param isChunked True if reloacation applies to chunked address.
247 */
248inline void
249RelocElement::setChunked(bool isChunked) {
250 chunked_ = isChunked;
251}
252
253}