OpenASIP  2.0
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 
43 namespace TPEF {
44  namespace ReferenceManager {
45  class SafePointer;
46  }
47 
48 /**
49  * Relocation table entry.
50  */
51 class RelocElement : public SectionElement {
52 public:
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 
65  RelocElement();
66  virtual ~RelocElement();
67 
68  RelocType type() const;
69  void setType(RelocType aType);
70 
71  SectionElement* location() const;
72  void setLocation(SectionElement* aLocation);
73  void setLocation(const ReferenceManager::SafePointer* aLocation);
74 
75  SectionElement* destination() const;
76  void setDestination(SectionElement* aDestination);
77  void setDestination(const ReferenceManager::SafePointer* aDestination);
78 
79  Byte size() const;
80  void setSize(Byte aSize);
81 
82  Byte bitOffset() const;
83  void setBitOffset(Byte anOffset);
84 
85  SymbolElement* symbol() const;
86  void setSymbol(SymbolElement* aSymbol);
87  void setSymbol(const ReferenceManager::SafePointer* aSymbol);
88 
89  ASpaceElement* aSpace() const;
90  void setASpace(ASpaceElement* anASpace);
91  void setASpace(const ReferenceManager::SafePointer* anASpace);
92 
93  bool chunked() const;
94  void setChunked(bool isChunked);
95 
96 private:
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.
112  bool chunked_;
113 };
114 }
115 
116 #include "RelocElement.icc"
117 
118 #endif
ASpaceElement.hh
TPEF::RelocElement::size_
Byte size_
Bit width of value(or chunk of value) to be relocated.
Definition: RelocElement.hh:104
TPEF::RelocElement::RT_PCREL
@ RT_PCREL
PC-relative, relocate only if displacement changes.
Definition: RelocElement.hh:61
TPEF::RelocElement::type_
RelocType type_
The type of the relocation.
Definition: RelocElement.hh:98
TPEF::RelocElement::bitOffset
Byte bitOffset() const
TPEF::RelocElement::chunked
bool chunked() const
Byte
unsigned char Byte
Definition: BaseType.hh:116
TPEF::RelocElement::bitOffset_
Byte bitOffset_
Bit offset where in whole value bits of this chunk should be.
Definition: RelocElement.hh:106
TPEF::RelocElement::size
Byte size() const
TPEF::RelocElement::symbol
SymbolElement * symbol() const
TPEF::RelocElement::destination_
const ReferenceManager::SafePointer * destination_
The destination element of the location to be relocated.
Definition: RelocElement.hh:102
TPEF::ReferenceManager::SafePointer
Definition: SafePointer.hh:188
TPEF::RelocElement::aSpace
ASpaceElement * aSpace() const
TPEF::RelocElement::setType
void setType(RelocType aType)
TPEF::ASpaceElement
Definition: ASpaceElement.hh:48
TPEF::RelocElement::RT_SELF
@ RT_SELF
Absolute address, relocate relative to address self.
Definition: RelocElement.hh:58
TPEF::RelocElement::setSize
void setSize(Byte aSize)
TPEF::RelocElement::chunked_
bool chunked_
Does relocation refer to chunked address.
Definition: RelocElement.hh:112
TPEF::RelocElement::destination
SectionElement * destination() const
TPEF::SectionElement
Definition: SectionElement.hh:44
TPEF::RelocElement::type
RelocType type() const
TPEF::RelocElement::setChunked
void setChunked(bool isChunked)
TPEF::RelocElement::symbol_
const ReferenceManager::SafePointer * symbol_
The symbol of relocation.
Definition: RelocElement.hh:108
TPEF::RelocElement::setSymbol
void setSymbol(SymbolElement *aSymbol)
TPEF::SymbolElement
Definition: SymbolElement.hh:52
TPEF::RelocElement::location_
const ReferenceManager::SafePointer * location_
The element containing location to be relocated.
Definition: RelocElement.hh:100
TPEF::RelocElement::setLocation
void setLocation(SectionElement *aLocation)
TPEF::RelocElement
Definition: RelocElement.hh:51
TPEF::RelocElement::RT_NOREL
@ RT_NOREL
No relocation.
Definition: RelocElement.hh:57
TPEF::RelocElement::setBitOffset
void setBitOffset(Byte anOffset)
SectionElement.hh
SymbolElement.hh
TPEF::RelocElement::setASpace
void setASpace(ASpaceElement *anASpace)
TPEF::RelocElement::RT_PAGE
@ RT_PAGE
Paged address, relocate page offset.
Definition: RelocElement.hh:60
RelocElement.icc
TPEF::RelocElement::RelocElement
RelocElement()
Definition: RelocElement.cc:46
TPEF::RelocElement::RelocType
RelocType
Definition: RelocElement.hh:56
TPEF::RelocElement::setDestination
void setDestination(SectionElement *aDestination)
TPEF::RelocElement::location
SectionElement * location() const
TPEF::RelocElement::~RelocElement
virtual ~RelocElement()
Definition: RelocElement.cc:56
TPEF::RelocElement::aSpace_
const ReferenceManager::SafePointer * aSpace_
The address space of relocated element.
Definition: RelocElement.hh:110
TPEF
Definition: Assembler.hh:43