OpenASIP 2.2
Loading...
Searching...
No Matches
DataSectionCreator.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 DataSectionCreator.hh
26 *
27 * Declaration of DataSectionCreator class.
28 *
29 * @author Mikael Lepistö 2005 (tmlepist-no.spam-cs.tut.fi)
30 * @note rating: yellow
31 */
32
33#ifndef TCEASM_DATA_SECTION_CREATOR_HH
34#define TCEASM_DATA_SECTION_CREATOR_HH
35
36#include "Exception.hh"
37#include "ParserStructs.hh"
38
39namespace TPEF {
40 class Binary;
41 class Section;
42 class DataSection;
43}
44
46class LabelManager;
48
49/**
50 * Collects data area information and parses data to tpef data sections.
51 */
53public:
55 MachineResourceManager &resourceManager,
57
59
60 void setAreaStartAddress(UValue address);
61
62 void addDataLine(const DataLine& origLine);
63
64 void finalize(TPEF::Binary& tpef, LabelManager& labels, bool littleEndian);
65
66 void cleanup();
67
68private:
69 /**
70 * Internal representation of data section.
71 */
73 /// Address space of the section.
74 std::string addressSpace;
75
76 /// If section contains initialization data.
78 /// Is start address of the section fixed.
80
81 /// The start address of the section.
83 /// Number of MAUs stored in section.
85
86 /// Initialization data of the section. (or uninitialization data;)
87 std::vector<DataLine*> lines;
88 };
89
91 std::map<std::string, UValue>& addressSpaceUsedMAUs,
92 std::vector<std::string>& addedLabels, LabelManager& labels);
93
95 DataLine* line, TPEF::DataSection* dataSection, LabelManager& labels,
96 UValue currentMAUIndex);
97
98 int sizeInWords(UValue value, int MAUWidth, bool isSigned) const;
99
100 /// TPEF Resources and strings.
102
103 /// Start address of next line (if fixed address).
105 /// Is next data line address fixed.
107
108 /// Internal data sections.
109 std::vector<InternalSection> sections_;
110};
111
112
113
114#endif
unsigned long UValue
void resolveDataAreaSizesAndLabelAddresses(std::map< std::string, UValue > &addressSpaceUsedMAUs, std::vector< std::string > &addedLabels, LabelManager &labels)
void addDataLine(const DataLine &origLine)
UValue writeDataLineToTPEF(DataLine *line, TPEF::DataSection *dataSection, LabelManager &labels, UValue currentMAUIndex)
void finalize(TPEF::Binary &tpef, LabelManager &labels, bool littleEndian)
void setAreaStartAddress(UValue address)
UValue currentStartAddress_
Start address of next line (if fixed address).
MachineResourceManager & resources_
TPEF Resources and strings.
bool isStartAddressDefined_
Is next data line address fixed.
std::vector< InternalSection > sections_
Internal data sections.
int sizeInWords(UValue value, int MAUWidth, bool isSigned) const
UValue length
Number of MAUs stored in section.
UValue startAddress
The start address of the section.
std::vector< DataLine * > lines
Initialization data of the section. (or uninitialization data;)
bool isInitialized
If section contains initialization data.
bool fixedStartAddress
Is start address of the section fixed.
std::string addressSpace
Address space of the section.