OpenASIP 2.2
Loading...
Searching...
No Matches
NullProgram.cc
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 NullProgram.cc
26 *
27 * Implementation of NullProgram class.
28 *
29 * @author Ari Metsähalme 2005 (ari.metsahalme-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include "NullProgram.hh"
34#include "NullProcedure.hh"
35#include "NullInstruction.hh"
36#include "NullAddress.hh"
37#include "NullAddressSpace.hh"
38#include "NullGlobalScope.hh"
40#include "NullMachine.hh"
41
42using namespace TTAMachine;
43
44namespace TTAProgram {
45
46/////////////////////////////////////////////////////////////////////////////
47// NullProgram
48/////////////////////////////////////////////////////////////////////////////
49
50NullProgram NullProgram::instance_;
51
52/**
53 * The constructor.
54 */
56 Program(
57 NullAddressSpace::instance(), NullAddress::instance()) {
58}
59
60/**
61 * The destructor.
62 */
65
66/**
67 * Returns an instance of NullProgram class (singleton).
68 *
69 * @return Singleton instance of NullProgram class.
70 */
75
76/**
77 * Aborts program with error log message.
78 *
79 * @return Nothing.
80 */
83 abortWithError("globalScope()");
85}
86
87const GlobalScope&
89 abortWithError("globalScopeConst()");
91}
92
93/**
94 * Aborts program with error log message.
95 *
96 * @return Nothing
97 */
98
101 abortWithError("targetProcessor()");
103}
104/**
105 * Aborts program with error log message.
106 *
107 * @return A null address.
108 */
111 abortWithError("startAddress()");
112 return NullAddress::instance();
113}
114
115/**
116 * Aborts program with error log message.
117 *
118 * @return A null address.
119 */
122 abortWithError("entryAddress()");
123 return NullAddress::instance();
124}
125
126/**
127 * Aborts program with error log message.
128 */
129void
131 abortWithError("setEntryAddress()");
132}
133
134/**
135 * Aborts program with error log message.
136 *
137 * @exception IllegalRegistration never.
138 */
139void
141 abortWithError("addProcedure()");
142}
143
144/**
145 * Aborts program with error log message.
146 *
147 * @exception IllegalRegistration never.
148 */
149void
153
154/**
155 * Aborts program with error log message.
156 */
157void
159 abortWithError("relocate()");
160}
161
162/**
163 * Aborts program with error log message.
164 *
165 * @exception InstanceNotFound never.
166 * @return Nothing.
167 */
170 abortWithError("firstProcedure()");
172}
173
174/**
175 * Aborts program with error log message.
176 *
177 * @exception InstanceNotFound never.
178 * @return Nothing.
179 */
182 abortWithError("lastProcedure()");
184}
185
186/**
187 * Aborts program with error log message.
188 *
189 * @return Nothing.
190 */
193 abortWithError("nextProcedure()");
195}
196
197/**
198 * Aborts program with error log message.
199 *
200 * @return -1.
201 */
202int
204 abortWithError("addInstruction()");
205 return -1;
206}
207
208/**
209 * Aborts program with error log message.
210 *
211 * @return a null procedure.
212 * @exception OutOfRange never.
213 */
216 abortWithError("addInstruction()");
218}
219
220/**
221 * Aborts program with error log message.
222 *
223 * @exception KeyNotFound never.
224 * @return Nothing.
225 */
227NullProgram::procedure(const std::string&) const {
228 abortWithError("procedure()");
230}
231
232/**
233 * Aborts program with error log message.
234 *
235 * @exception InstanceNotFound never.
236 * @return Nothing.
237 */
240 abortWithError("firstInstruction()");
242}
243
244/**
245 * Aborts program with error log message.
246 *
247 * @return A null instruction.
248 * @exception KeyNotFound never.
249 */
250const Instruction&
252 abortWithError("instructionAt()");
254}
255
256/**
257 * Aborts program with error log message.
258 *
259 * @return A null instruction.
260 */
261const Instruction&
263 abortWithError("nextInstruction()");
265}
266
267/**
268 * Aborts program with error log message.
269 *
270 * @exception InstanceNotFound never.
271 * @return Nothing.
272 */
275 abortWithError("lastInstruction()");
277}
278
279/**
280 * Aborts program with error log message.
281 *
282 * @return Nothing.
283 */
289
290}
#define abortWithError(message)
Word UIntWord
Definition BaseType.hh:144
static NullMachine & instance()
static NullAddress & instance()
static NullGlobalScope & instance()
static NullInstructionReferenceManager & instance()
static NullInstruction & instance()
static NullProcedure & instance()
TTAMachine::Machine & targetProcessor() const
Procedure & procedure(int index) const
const Instruction & nextInstruction(const Instruction &) const
Address entryAddress() const
static NullProgram & instance()
const GlobalScope & globalScopeConst() const
Procedure & nextProcedure(const Procedure &proc) const
void addProcedure(Procedure &proc)
Instruction & firstInstruction() const
Procedure & lastProcedure() const
static NullProgram instance_
Unique instance of NullProgram.
InstructionReferenceManager & instructionReferenceManager()
Procedure & firstProcedure() const
void relocate(const Procedure &proc, UIntWord howMuch)
void setEntryAddress(Address address)
void addInstruction(Instruction &ins)
const Instruction & instructionAt(UIntWord address) const
Address startAddress() const
GlobalScope & globalScope()
Instruction & lastInstruction() const