OpenASIP 2.2
Loading...
Searching...
No Matches
FixedRegisters.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 FixedRegisters.cc
26 *
27 * Definition of FixedRegisters class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include "FixedRegisters.hh"
34#include "SimValue.hh"
35
36/**
37 * Constructor.
38 */
40 stackPointer_(NULL), intReturnValue_(NULL), floatReturnValue_(NULL) {
41}
42
43/**
44 * Destructor.
45 */
48
49/**
50 * Returns the stack pointer value.
51 *
52 * @return Stack pointer value.
53 */
56 if (stackPointer_ == NULL) {
58 }
59 return *stackPointer_;
60}
61
62/**
63 * Returns integer argument with a given index.
64 *
65 * If index is out of range, returns NullSimValue.
66 *
67 * @return Integer argument with a given index.
68 */
71 if (index < 0 || index > static_cast<int>(integerArgs_.size()) - 1) {
73 }
74 return *integerArgs_[index];
75}
76
77/**
78 * Returns float argument register with a given index.
79 *
80 * If index is out of range, returns NullSimValue.
81 *
82 * @return Float argument register with a given index.
83 */
86 if (index < 0 || index > static_cast<int>(floatArgs_.size()) - 1) {
88 }
89 return *floatArgs_[index];
90}
91
92/**
93 * Returns integer return value.
94 *
95 * @return Integer return value.
96 */
99 if (intReturnValue_ == NULL) {
100 return NullSimValue::instance();
101 }
102 return *intReturnValue_;
103}
104
105/**
106 * Returns float return value.
107 *
108 * @return Float return value.
109 */
112 if (floatReturnValue_ == NULL) {
113 return NullSimValue::instance();
114 }
115 return *floatReturnValue_;
116}
117
118/**
119 * Sets stack pointer to new value.
120 *
121 * @param value New value.
122 */
123void
127
128/**
129 * Adds new integer argument register.
130 *
131 * @param value New integer argument register value.
132 */
133void
137
138/**
139 * Adds new float argument register.
140 *
141 * @param value New float argument register value.
142 */
143void
147
148/**
149 * Sets integer return value to new value.
150 *
151 * @param value New value.
152 */
153void
157
158/**
159 * Sets float return value to new value.
160 *
161 * @param value New value.
162 */
163void
void setIntegerReturnValue(SimValue &value)
std::vector< SimValue * > floatArgs_
Floating point argument registers.
SimValue & integerReturnValue() const
virtual ~FixedRegisters()
SimValue & floatArgumentRegister(int index) const
SimValue * floatReturnValue_
Floating point return value.
void addIntegerArgumentRegister(SimValue &value)
void setFloatReturnValue(SimValue &value)
std::vector< SimValue * > integerArgs_
Integer argument registers.
SimValue * intReturnValue_
Integer return value.
SimValue * stackPointer_
Stack pointer.
SimValue & integerArgumentRegister(int index) const
SimValue & stackPointer() const
void setStackPointer(SimValue &value)
void addFloatArgumentRegister(SimValue &value)
SimValue & floatReturnValue() const
static SimValue & instance()
Definition SimValue.cc:1642