OpenASIP 2.2
Loading...
Searching...
No Matches
NullInstruction.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 NullInstruction.cc
26 *
27 * Implementation of NullInstruction class.
28 *
29 * @author Ari Metsähalme 2005 (ari.metsahalme-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include "NullInstruction.hh"
35#include "NullProcedure.hh"
36#include "NullAddress.hh"
37
38namespace TTAProgram {
39
40/////////////////////////////////////////////////////////////////////////////
41// NullInstruction
42/////////////////////////////////////////////////////////////////////////////
43
44NullInstruction NullInstruction::instance_;
45
46/**
47 * The constructor.
48 */
50 Instruction(TTAMachine::NullInstructionTemplate::instance()) {
51}
52
53/**
54 * The destructor.
55 */
58
59
60/**
61 * Returns an instance of NullInstruction class (singleton).
62 *
63 * @return Singleton instance of NullInstruction class.
64 */
69
70/**
71 * Aborts program with error log message.
72 *
73 * @return A null procedure.
74 * @exception IllegalRegistration never.
75 */
78 abortWithError("parent()");
80}
81
82/**
83 * Aborts program with error log message.
84 */
85void
87 abortWithError("setParent()");
88}
89
90/**
91 * Aborts program with error log message.
92 *
93 * @return False.
94 */
95bool
97 abortWithError("isInProcedure()");
98 return false;
99}
100
101/**
102 * Aborts program with error log message.
103 */
104void
108
109/**
110 * Aborts program with error log message.
111 *
112 * @return -1.
113 */
115 abortWithError("addMove()");
116 return -1;
117}
118
119/**
120 * Aborts program with error log message.
121 *
122 * @return A null move.
123 */
124const Move&
126 abortWithError("addMove()");
127 throw OutOfRange(__FILE__,__LINE__,__func__, "Null intruction is empty.");
128}
129
130/**
131 * Aborts program with error log message.
132 */
133void
137
138/**
139 * Aborts program with error log message.
140 *
141 * @return -1.
142 */
144 abortWithError("addMove()");
145 return -1;
146}
147
148/**
149 * Aborts program with error log message.
150 *
151 * @return A null immediate.
152 */
155 abortWithError("addMove()");
156 // to avoid warning:
157 throw new OutOfRange(__FILE__,__LINE__,__func__,"");
158}
159
160/**
161 * Aborts program with error log message.
162 *
163 * @return A null address.
164 */
165Address&
167 abortWithError("address()");
168 return NullAddress::instance();
169}
170
171/**
172 * Aborts program with error log message.
173 *
174 * @return -1.
175 */
176int
178 abortWithError("size()");
179 return -1;
180}
181
182}
#define __func__
#define abortWithError(message)
static NullAddress & instance()
static NullInstruction instance_
Unique instance of NullInstruction.
static NullInstruction & instance()
void addImmediate(Immediate &imm)
const Move & move(int i) const
void setParent(const Procedure &proc)
static NullProcedure & instance()