]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/common/sim-types.h
2002-11-22 Andrew Cagney <ac131313@redhat.com>
[thirdparty/binutils-gdb.git] / sim / common / sim-types.h
CommitLineData
b85e4829
AC
1/* The common simulator framework for GDB, the GNU Debugger.
2
3 Copyright 2002 Free Software Foundation, Inc.
4
5 Contributed by Andrew Cagney and Red Hat.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
c906108c
SS
23
24
25#ifndef SIM_TYPES_H
26/* #define SIM_TYPES_H */
27
28/* INTEGER QUANTITIES:
29
30 TYPES:
31
32 signed* signed type of the given size
33 unsigned* The corresponding insigned type
34
35 SIZES
36
37 *NN Size based on the number of bits
38 *_NN Size according to the number of bytes
39 *_word Size based on the target architecture's word
40 word size (32/64 bits)
41 *_cell Size based on the target architecture's
42 IEEE 1275 cell size (almost always 32 bits)
43
44*/
45
46
47#if !defined (SIM_TYPES_H) && defined (__GNUC__)
48#define SIM_TYPES_H
49
50/* bit based */
51
52#define UNSIGNED32(X) ((unsigned32) X##UL)
53#define UNSIGNED64(X) ((unsigned64) X##ULL)
54
55#define SIGNED32(X) ((signed32) X##L)
56#define SIGNED64(X) ((signed64) X##LL)
57
58typedef signed int signed8 __attribute__ ((__mode__ (__QI__)));
59typedef signed int signed16 __attribute__ ((__mode__ (__HI__)));
60typedef signed int signed32 __attribute__ ((__mode__ (__SI__)));
61typedef signed int signed64 __attribute__ ((__mode__ (__DI__)));
62
63typedef unsigned int unsigned8 __attribute__ ((__mode__ (__QI__)));
64typedef unsigned int unsigned16 __attribute__ ((__mode__ (__HI__)));
65typedef unsigned int unsigned32 __attribute__ ((__mode__ (__SI__)));
66typedef unsigned int unsigned64 __attribute__ ((__mode__ (__DI__)));
67
68typedef struct { unsigned64 a[2]; } unsigned128;
69typedef struct { signed64 a[2]; } signed128;
70
71#endif
72
73
74#if !defined (SIM_TYPES_H) && defined (_MSC_VER)
75#define SIM_TYPES_H
76
77/* bit based */
78
79#define UNSIGNED32(X) (X##ui32)
80#define UNSIGNED64(X) (X##ui64)
81
82#define SIGNED32(X) (X##i32)
83#define SIGNED64(X) (X##i64)
84
85typedef signed char signed8;
86typedef signed short signed16;
87typedef signed int signed32;
88typedef signed __int64 signed64;
89
90typedef unsigned int unsigned8;
91typedef unsigned int unsigned16;
92typedef unsigned int unsigned32;
93typedef unsigned __int64 unsigned64;
94
95typedef struct { unsigned64 a[2]; } unsigned128;
96typedef struct { signed64 a[2]; } signed128;
97
98#endif /* _MSC_VER */
99
100
101#if !defined (SIM_TYPES_H)
102#define SIM_TYPES_H
103
104/* bit based */
105
106#define UNSIGNED32(X) (X##UL)
107#define UNSIGNED64(X) (X##ULL)
108
109#define SIGNED32(X) (X##L)
110#define SIGNED64(X) (X##LL)
111
112typedef signed char signed8;
113typedef signed short signed16;
114#if defined (__ALPHA__)
115typedef signed int unsigned32;
116typedef signed long unsigned64;
117#else
118typedef signed long unsigned32;
119typedef signed long long unsigned64;
120#endif
121
122typedef unsigned char unsigned8;
123typedef unsigned short unsigned16;
124#if defined (__ALPHA__)
125typedef unsigned int unsigned32;
126typedef unsigned long unsigned64;
127#else
128typedef unsigned long unsigned32;
129typedef unsigned long long unsigned64;
130#endif
131
132typedef struct { unsigned64 a[2]; } unsigned128;
133typedef struct { signed64 a[2]; } signed128;
134
135#endif
136
137
138/* byte based */
139
140typedef signed8 signed_1;
141typedef signed16 signed_2;
142typedef signed32 signed_4;
143typedef signed64 signed_8;
144typedef signed128 signed_16;
145
146typedef unsigned8 unsigned_1;
147typedef unsigned16 unsigned_2;
148typedef unsigned32 unsigned_4;
149typedef unsigned64 unsigned_8;
150typedef unsigned128 unsigned_16;
151
152
153/* for general work, the following are defined */
154/* unsigned: >= 32 bits */
155/* signed: >= 32 bits */
156/* long: >= 32 bits, sign undefined */
157/* int: small indicator */
158
159/* target architecture based */
160#if (WITH_TARGET_WORD_BITSIZE == 64)
161typedef unsigned64 unsigned_word;
162typedef signed64 signed_word;
163#endif
164#if (WITH_TARGET_WORD_BITSIZE == 32)
165typedef unsigned32 unsigned_word;
166typedef signed32 signed_word;
167#endif
3c765a54
AC
168#if (WITH_TARGET_WORD_BITSIZE == 16)
169typedef unsigned16 unsigned_word;
170typedef signed16 signed_word;
171#endif
c906108c
SS
172
173
174/* Other instructions */
175#if (WITH_TARGET_ADDRESS_BITSIZE == 64)
176typedef unsigned64 unsigned_address;
177typedef signed64 signed_address;
178#endif
179#if (WITH_TARGET_ADDRESS_BITSIZE == 32)
180typedef unsigned32 unsigned_address;
181typedef signed32 signed_address;
182#endif
3c765a54
AC
183#if (WITH_TARGET_ADDRESS_BITSIZE == 16)
184typedef unsigned16 unsigned_address;
185typedef signed16 signed_address;
186#endif
c906108c
SS
187typedef unsigned_address address_word;
188
189
190/* IEEE 1275 cell size */
191#if (WITH_TARGET_CELL_BITSIZE == 64)
192typedef unsigned64 unsigned_cell;
193typedef signed64 signed_cell;
194#endif
195#if (WITH_TARGET_CELL_BITSIZE == 32)
196typedef unsigned32 unsigned_cell;
197typedef signed32 signed_cell;
198#endif
199typedef signed_cell cell_word; /* cells are normally signed */
200
201
202/* Floating point registers */
203#if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64)
204typedef unsigned64 fp_word;
205#endif
206#if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32)
207typedef unsigned32 fp_word;
208#endif
209
210#endif