2 Copyright (c) 2002-2009 Tampere University.
4 This file is part of TTA-Based Codesign Environment (TCE).
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:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
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.
25 * @file RelocElement.icc
27 * Inline definitions of RelocElement class.
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
33 * @note rating: yellow
39 * Returns the type of relocation.
41 * @return The type of relocation.
43 inline RelocElement::RelocType
44 RelocElement::type() const {
49 * Sets the type of relocation.
51 * @param aType The type of relocation.
54 RelocElement::setType(RelocType aType) {
59 * Returns the element where is the location to be relocated.
61 * @return The element where is the location to be relocated.
63 inline SectionElement*
64 RelocElement::location() const {
65 return dynamic_cast<SectionElement*>(location_->pointer());
69 * Sets the element where is the location to be relocated.
71 * @param aLocation The element where is the location to be relocated.
74 RelocElement::setLocation(SectionElement* aLocation) {
76 ReferenceManager::SafePointer::replaceReference(location_, aLocation);
80 * Sets the element where is the location to be relocated.
82 * @param aLocation The element where is the location to be relocated.
85 RelocElement::setLocation(
86 const ReferenceManager::SafePointer* aLocation) {
87 location_ = aLocation;
91 * Returns the element where is the destination of the location to relocate.
93 * @return The element where is the destination of the location to relocate.
95 inline SectionElement*
96 RelocElement::destination() const {
97 return dynamic_cast<SectionElement*>(destination_->pointer());
101 * Sets the element where is the destination of the location to relocate.
103 * @param aDestination The destination of the location to relocate.
106 RelocElement::setDestination(SectionElement* aDestination) {
107 destination_ = ReferenceManager::SafePointer::replaceReference(
108 destination_, aDestination);
112 * Sets the element where is the destination of the location to relocate.
114 * @param aDestination The destination of the location to relocate.
117 RelocElement::setDestination(
118 const ReferenceManager::SafePointer* aDestination) {
119 destination_ = aDestination;
123 * Returns the bit width of value to be relocated.
125 * @return The bit width of value to be relocated.
128 RelocElement::size() const {
133 * Sets the bit width of value to be relocated.
135 * @param aSize The bit width of value to be relocated.
138 RelocElement::setSize(Byte aSize) {
143 * Returns the bit offset where bits of this chunk are in the whole value.
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.
150 * @return The bit offset where bits of this chunk are in the whole value.
153 RelocElement::bitOffset() const {
158 * Sets the bit offset where bits of this chunk should be in whole value.
160 * See bitOffset() method.
162 * @param anOffset Where bits of this chunk should be in whole value.
165 RelocElement::setBitOffset(Byte anOffset) {
166 bitOffset_ = anOffset;
170 * Returns The symbol of relocation.
172 * @return The symbol of relocation.
174 inline SymbolElement*
175 RelocElement::symbol() const {
176 return dynamic_cast<SymbolElement*>(symbol_->pointer());
180 * Sets the symbol of relocation.
182 * @param aSymbol The symbol of relocation.
185 RelocElement::setSymbol(SymbolElement* aSymbol) {
187 ReferenceManager::SafePointer::replaceReference(symbol_, aSymbol);
191 * Sets the symbol of relocation.
193 * @param aSymbol The symbol of relocation.
196 RelocElement::setSymbol(const ReferenceManager::SafePointer* aSymbol) {
201 * Returns the address space of destination element.
203 * @return The address space of destination element.
205 inline ASpaceElement*
206 RelocElement::aSpace() const {
207 return dynamic_cast<ASpaceElement*>(aSpace_->pointer());
211 * Sets the address space of destination element.
213 * @param anASpace The address space of relocated element.
216 RelocElement::setASpace(ASpaceElement* anASpace) {
218 ReferenceManager::SafePointer::replaceReference(aSpace_, anASpace);
222 * Sets the address space of destination element.
224 * @param anASpace The address space of destination element.
227 RelocElement::setASpace(const ReferenceManager::SafePointer* anASpace) {
232 * Returns true if relocation applies to chunked address.
234 * This property is probably never needed...
236 * @return True if relocation applies to chunked address.
239 RelocElement::chunked() const {
244 * Sets wether the relocation applies to chunked or complete address.
246 * @param isChunked True if reloacation applies to chunked address.
249 RelocElement::setChunked(bool isChunked) {
250 chunked_ = isChunked;