OpenASIP 2.2
Loading...
Searching...
No Matches
NullProcedure.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 NullProcedure.cc
26 *
27 * Implementation of NullProcedure class.
28 *
29 * @author Ari Metsähalme 2005 (ari.metsahalme-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include "NullProcedure.hh"
34#include "NullProgram.hh"
35#include "NullInstruction.hh"
36#include "NullAddress.hh"
37#include "NullAddressSpace.hh"
38
39using namespace TTAMachine;
40
41namespace TTAProgram {
42
43/////////////////////////////////////////////////////////////////////////////
44// NullProcedure
45/////////////////////////////////////////////////////////////////////////////
46
47NullProcedure NullProcedure::instance_;
48
49/**
50 * The constructor.
51 */
55
56/**
57 * The destructor.
58 */
61
62/**
63 * Returns an instance of NullProcedure class (singleton).
64 *
65 * @return Singleton instance of NullProcedure class.
66 */
71
72/**
73 * Aborts program with error log message.
74 *
75 * @return A null program.
76 * @exception IllegalRegistration never.
77 */
80 abortWithError("parent()");
81 return NullProgram::instance();
82}
83
84/**
85 * Aborts program with error log message.
86 */
87void
91
92/**
93 * Aborts program with error log message.
94 *
95 * @return False.
96 */
97bool
99 abortWithError("isInProgram()");
100 return false;
101}
102
103std::string
105 abortWithError("name()");
106 return "";
107}
108
109int
111 abortWithError("alignment()");
112 return -1;
113}
114
115/**
116 * Aborts program with error log message.
117 *
118 * @return A null address.
119 * @exception IllegalRegistration never.
120 */
123 abortWithError("address()");
124 return NullAddress::instance();
125}
126
127/**
128 * Aborts program with error log message.
129 *
130 * @return A null address.
131 */
134 abortWithError("startAddress()");
135 return NullAddress::instance();
136}
137
138/**
139 * Aborts program with error log message.
140 */
141void
143 abortWithError("setStartAddress()");
144}
145
146/**
147 * Aborts program with error log message.
148 *
149 * @return A null address.
150 */
153 abortWithError("endAddress()");
154 return NullAddress::instance();
155}
156
157/**
158 * Aborts program with error log message.
159 *
160 * @return -1.
161 */
162int
164 abortWithError("instructionCount()");
165 return -1;
166}
167
170 abortWithError("firstInstruction()");
172}
173
174/**
175 * Aborts program with error log message.
176 *
177 * @return A null instruction.
178 * @exception KeyNotFound never.
179 */
182 abortWithError("instructionAt()");
184}
185
186/**
187 * Aborts program with error log message.
188 *
189 * @return False.
190 * @exception IllegalRegistration never.
191 */
192bool
194 abortWithError("hasNextInstruction()");
195 return false;
196}
197
198/**
199 * Aborts program with error log message.
200 *
201 * @return A null instruction.
202 * @exception IllegalRegistration never.
203 */
206 abortWithError("nextInstruction()");
208}
209
210/**
211 * Aborts program with error log message.
212 *
213 * @return A null instruction.
214 * @exception IllegalRegistration never.
215 */
218 abortWithError("previousInstruction()");
220}
221
222/**
223 * Aborts program with error log message.
224 *
225 * @return A null instruction.
226 * @exception IllegalRegistration never.
227 */
230 abortWithError("lastInstruction()");
232}
233
234/**
235 * Aborts program with error log message.
236 *
237 * @exception IllegalRegistration never.
238 */
239void
243
244/**
245 * Aborts program with error log message.
246 *
247 * @exception IllegalRegistration never.
248 */
249void
251 abortWithError("insertInstructionAfter()");
252}
253}
#define abortWithError(message)
Word UIntWord
Definition BaseType.hh:144
static NullAddress & instance()
static NullInstruction & instance()
void addInstruction(Instruction &ins)
void setParent(Program &prog)
Program & parent() const
Instruction & instructionAt(UIntWord address) const
std::string name() const
Instruction & nextInstruction(const Instruction &ins) const
void insertInstructionAfter(const Instruction &pos, Instruction *ins)
void setStartAddress(Address start)
static NullProcedure instance_
Unique instance of NullProcedure.
Instruction & lastInstruction() const
Instruction & firstInstruction() const
Instruction & previousInstruction(const Instruction &ins) const
static NullProcedure & instance()
Address address(const Instruction &ins) const
bool hasNextInstruction(const Instruction &ins) const
static NullProgram & instance()