]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/common/sim-types.h
This commit was generated by cvs2svn to track changes on a CVS vendor
[thirdparty/binutils-gdb.git] / sim / common / sim-types.h
1 /* This file is part of psim (model of the PowerPC(tm) architecture)
2
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License
7 as published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 --
20
21 PowerPC is a trademark of International Business Machines Corporation. */
22
23
24 /* Basic type sizes for the PowerPC */
25
26 #ifndef SIM_TYPES_H
27 #define SIM_TYPES_H
28
29
30 /* INTEGER QUANTITIES:
31
32 TYPES:
33
34 natural* sign determined by host
35 signed* signed type of the given size
36 unsigned* The corresponding insigned type
37
38 SIZES
39
40 *NN Size based on the number of bits
41 *_NN Size according to the number of bytes
42 *_word Size based on the target architecture's word
43 word size (32/64 bits)
44 *_cell Size based on the target architecture's
45 IEEE 1275 cell size (almost always 32 bits)
46 *_address Fits target address
47
48 NONSPECIFIC
49
50 address_word
51 Alias for unsigned_address
52
53 cell_word Alias for signed_cell
54
55 fp_word Holds a floating point word.
56
57 */
58
59
60 /* bit based */
61 typedef char natural8;
62 typedef short natural16;
63 typedef long natural32;
64
65 typedef signed char signed8;
66 typedef signed short signed16;
67 typedef signed long signed32;
68
69 typedef unsigned char unsigned8;
70 typedef unsigned short unsigned16;
71 typedef unsigned long unsigned32;
72
73 #if defined __GNUC__ || defined _MSC_VER
74 #ifdef __GNUC__
75
76 /* GDB sometimes likes to make what appear to be signed `0x*L' values
77 unsigned by default */
78
79 typedef long long natural64;
80 typedef signed long long signed64;
81 typedef unsigned long long unsigned64;
82
83 #define UNSIGNED64(X) (X##ULL)
84 #define SIGNED64(X) ((signed64) X##LL)
85
86 #define UNSIGNED32(X) (X##UL)
87 #define SIGNED32(X) ((signed32) X##L)
88
89 #else /* _MSC_VER */
90
91 typedef __int64 natural64;
92 typedef signed __int64 signed64;
93 typedef unsigned __int64 unsigned64;
94
95 #define UNSIGNED64(X) (X##ui64)
96 #define SIGNED64(X) (X##i64)
97
98 #define SIGNED32(X) (X##ui32)
99 #define UNSIGNED32(X) (X##i32)
100
101 #endif /* _MSC_VER */
102
103 typedef struct { unsigned64 a[2]; } unsigned128;
104 typedef struct { signed64 a[2]; } signed128;
105
106 #else /* Not GNUC or _MSC_VER */
107 /* Not supported */
108 #endif
109
110 /* byte based */
111 typedef natural8 natural_1;
112 typedef natural16 natural_2;
113 typedef natural32 natural_4;
114 typedef natural64 natural_8;
115 /* typedef natural64 natural_8; */
116
117 typedef signed8 signed_1;
118 typedef signed16 signed_2;
119 typedef signed32 signed_4;
120 typedef signed64 signed_8;
121 typedef signed128 signed_16;
122
123 typedef unsigned8 unsigned_1;
124 typedef unsigned16 unsigned_2;
125 typedef unsigned32 unsigned_4;
126 typedef unsigned64 unsigned_8;
127 typedef unsigned128 unsigned_16;
128
129
130 /* for general work, the following are defined */
131 /* unsigned: >= 32 bits */
132 /* signed: >= 32 bits */
133 /* long: >= 32 bits, sign undefined */
134 /* int: small indicator */
135
136 /* target architecture based */
137 #if (WITH_TARGET_WORD_BITSIZE == 64)
138 typedef natural64 natural_word;
139 typedef unsigned64 unsigned_word;
140 typedef signed64 signed_word;
141 #endif
142 #if (WITH_TARGET_WORD_BITSIZE == 32)
143 typedef natural32 natural_word;
144 typedef unsigned32 unsigned_word;
145 typedef signed32 signed_word;
146 #endif
147
148
149 /* Other instructions */
150 #if (WITH_TARGET_ADDRESS_BITSIZE == 64)
151 typedef unsigned64 unsigned_address;
152 typedef signed64 signed_address;
153 #endif
154 #if (WITH_TARGET_ADDRESS_BITSIZE == 32)
155 typedef unsigned32 unsigned_address;
156 typedef signed32 signed_address;
157 #endif
158 typedef unsigned_address address_word;
159
160 /* IEEE 1275 cell size */
161 #if (WITH_TARGET_CELL_BITSIZE == 64)
162 typedef natural64 natural_cell;
163 typedef unsigned64 unsigned_cell;
164 typedef signed64 signed_cell;
165 #endif
166 #if (WITH_TARGET_CELL_BITSIZE == 32)
167 typedef natural32 natural_cell;
168 typedef unsigned32 unsigned_cell;
169 typedef signed32 signed_cell;
170 #endif
171
172 /* Floating point registers */
173 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64)
174 typedef unsigned64 fp_word;
175 #endif
176 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32)
177 typedef unsigned32 fp_word;
178 #endif
179
180
181 #endif