OpenASIP 2.2
Loading...
Searching...
No Matches
RelocElement.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 RelocElement.hh
26 *
27 * Declaration of RelocElement class.
28 *
29 * @author Jussi Nykänen 2003 (nykanen-no.spam-cs.tut.fi)
30 * @author Mikael Lepistö 18.12.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
36#ifndef TTA_RELOC_ELEMENT_HH
37#define TTA_RELOC_ELEMENT_HH
38
39#include "SectionElement.hh"
40#include "SymbolElement.hh"
41#include "ASpaceElement.hh"
42
43namespace TPEF {
44 namespace ReferenceManager {
45 class SafePointer;
46 }
47
48/**
49 * Relocation table entry.
50 */
52public:
53 /**
54 * TPEF relocation types.
55 */
56 enum RelocType {
57 RT_NOREL = 0x00, ///< No relocation
58 RT_SELF = 0x01, ///< Absolute address, relocate relative to
59 ///< address self.
60 RT_PAGE = 0x02, ///< Paged address, relocate page offset.
61 RT_PCREL = 0x03 ///< PC-relative, relocate only if
62 ///< displacement changes.
63 };
64
66 virtual ~RelocElement();
67
68 RelocType type() const;
69 void setType(RelocType aType);
70
72 void setLocation(SectionElement* aLocation);
74
76 void setDestination(SectionElement* aDestination);
78
79 Byte size() const;
80 void setSize(Byte aSize);
81
82 Byte bitOffset() const;
83 void setBitOffset(Byte anOffset);
84
86 void setSymbol(SymbolElement* aSymbol);
88
90 void setASpace(ASpaceElement* anASpace);
92
93 bool chunked() const;
94 void setChunked(bool isChunked);
95
96private:
97 /// The type of the relocation.
99 /// The element containing location to be relocated.
101 /// The destination element of the location to be relocated.
103 /// Bit width of value(or chunk of value) to be relocated.
105 /// Bit offset where in whole value bits of this chunk should be.
107 /// The symbol of relocation.
109 /// The address space of relocated element.
111 /// Does relocation refer to chunked address.
113};
114}
115
116#include "RelocElement.icc"
117
118#endif
unsigned char Byte
Definition BaseType.hh:116
SectionElement * destination() const
void setLocation(const ReferenceManager::SafePointer *aLocation)
void setDestination(const ReferenceManager::SafePointer *aDestination)
void setASpace(ASpaceElement *anASpace)
RelocType type_
The type of the relocation.
void setLocation(SectionElement *aLocation)
ASpaceElement * aSpace() const
void setBitOffset(Byte anOffset)
const ReferenceManager::SafePointer * aSpace_
The address space of relocated element.
Byte size_
Bit width of value(or chunk of value) to be relocated.
const ReferenceManager::SafePointer * location_
The element containing location to be relocated.
void setASpace(const ReferenceManager::SafePointer *anASpace)
void setSymbol(const ReferenceManager::SafePointer *aSymbol)
RelocType type() const
void setSize(Byte aSize)
virtual ~RelocElement()
void setSymbol(SymbolElement *aSymbol)
SymbolElement * symbol() const
void setChunked(bool isChunked)
Byte bitOffset() const
void setType(RelocType aType)
bool chunked() const
@ RT_PCREL
PC-relative, relocate only if displacement changes.
@ RT_SELF
Absolute address, relocate relative to address self.
@ RT_PAGE
Paged address, relocate page offset.
@ RT_NOREL
No relocation.
SectionElement * location() const
void setDestination(SectionElement *aDestination)
const ReferenceManager::SafePointer * destination_
The destination element of the location to be relocated.
Byte size() const
const ReferenceManager::SafePointer * symbol_
The symbol of relocation.
Byte bitOffset_
Bit offset where in whole value bits of this chunk should be.
bool chunked_
Does relocation refer to chunked address.