]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/common/sim-types.h
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / sim / common / sim-types.h
CommitLineData
b85e4829
AC
1/* The common simulator framework for GDB, the GNU Debugger.
2
8acc9f48 3 Copyright 2002-2013 Free Software Foundation, Inc.
b85e4829
AC
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
4744ac1b 11 the Free Software Foundation; either version 3 of the License, or
b85e4829
AC
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
4744ac1b 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c
SS
21
22
23#ifndef SIM_TYPES_H
24/* #define SIM_TYPES_H */
25
26/* INTEGER QUANTITIES:
27
28 TYPES:
29
30 signed* signed type of the given size
31 unsigned* The corresponding insigned type
32
33 SIZES
34
35 *NN Size based on the number of bits
36 *_NN Size according to the number of bytes
37 *_word Size based on the target architecture's word
38 word size (32/64 bits)
39 *_cell Size based on the target architecture's
40 IEEE 1275 cell size (almost always 32 bits)
41
42*/
43
44
45#if !defined (SIM_TYPES_H) && defined (__GNUC__)
46#define SIM_TYPES_H
47
48/* bit based */
49
50#define UNSIGNED32(X) ((unsigned32) X##UL)
51#define UNSIGNED64(X) ((unsigned64) X##ULL)
52
53#define SIGNED32(X) ((signed32) X##L)
54#define SIGNED64(X) ((signed64) X##LL)
55
56typedef signed int signed8 __attribute__ ((__mode__ (__QI__)));
57typedef signed int signed16 __attribute__ ((__mode__ (__HI__)));
58typedef signed int signed32 __attribute__ ((__mode__ (__SI__)));
59typedef signed int signed64 __attribute__ ((__mode__ (__DI__)));
60
61typedef unsigned int unsigned8 __attribute__ ((__mode__ (__QI__)));
62typedef unsigned int unsigned16 __attribute__ ((__mode__ (__HI__)));
63typedef unsigned int unsigned32 __attribute__ ((__mode__ (__SI__)));
64typedef unsigned int unsigned64 __attribute__ ((__mode__ (__DI__)));
65
66typedef struct { unsigned64 a[2]; } unsigned128;
67typedef struct { signed64 a[2]; } signed128;
68
69#endif
70
71
72#if !defined (SIM_TYPES_H) && defined (_MSC_VER)
73#define SIM_TYPES_H
74
75/* bit based */
76
77#define UNSIGNED32(X) (X##ui32)
78#define UNSIGNED64(X) (X##ui64)
79
80#define SIGNED32(X) (X##i32)
81#define SIGNED64(X) (X##i64)
82
83typedef signed char signed8;
84typedef signed short signed16;
85typedef signed int signed32;
86typedef signed __int64 signed64;
87
88typedef unsigned int unsigned8;
89typedef unsigned int unsigned16;
90typedef unsigned int unsigned32;
91typedef unsigned __int64 unsigned64;
92
93typedef struct { unsigned64 a[2]; } unsigned128;
94typedef struct { signed64 a[2]; } signed128;
95
96#endif /* _MSC_VER */
97
98
99#if !defined (SIM_TYPES_H)
100#define SIM_TYPES_H
101
102/* bit based */
103
104#define UNSIGNED32(X) (X##UL)
105#define UNSIGNED64(X) (X##ULL)
106
107#define SIGNED32(X) (X##L)
108#define SIGNED64(X) (X##LL)
109
110typedef signed char signed8;
111typedef signed short signed16;
112#if defined (__ALPHA__)
3f6da722
MI
113typedef signed int signed32;
114typedef signed long signed64;
c906108c 115#else
3f6da722
MI
116typedef signed long signed32;
117typedef signed long long signed64;
c906108c
SS
118#endif
119
120typedef unsigned char unsigned8;
121typedef unsigned short unsigned16;
122#if defined (__ALPHA__)
123typedef unsigned int unsigned32;
124typedef unsigned long unsigned64;
125#else
126typedef unsigned long unsigned32;
127typedef unsigned long long unsigned64;
128#endif
129
130typedef struct { unsigned64 a[2]; } unsigned128;
131typedef struct { signed64 a[2]; } signed128;
132
133#endif
134
135
136/* byte based */
137
138typedef signed8 signed_1;
139typedef signed16 signed_2;
140typedef signed32 signed_4;
141typedef signed64 signed_8;
142typedef signed128 signed_16;
143
144typedef unsigned8 unsigned_1;
145typedef unsigned16 unsigned_2;
146typedef unsigned32 unsigned_4;
147typedef unsigned64 unsigned_8;
148typedef unsigned128 unsigned_16;
149
150
151/* for general work, the following are defined */
152/* unsigned: >= 32 bits */
153/* signed: >= 32 bits */
154/* long: >= 32 bits, sign undefined */
155/* int: small indicator */
156
157/* target architecture based */
158#if (WITH_TARGET_WORD_BITSIZE == 64)
159typedef unsigned64 unsigned_word;
160typedef signed64 signed_word;
161#endif
162#if (WITH_TARGET_WORD_BITSIZE == 32)
163typedef unsigned32 unsigned_word;
164typedef signed32 signed_word;
165#endif
3c765a54
AC
166#if (WITH_TARGET_WORD_BITSIZE == 16)
167typedef unsigned16 unsigned_word;
168typedef signed16 signed_word;
169#endif
c906108c
SS
170
171
172/* Other instructions */
173#if (WITH_TARGET_ADDRESS_BITSIZE == 64)
174typedef unsigned64 unsigned_address;
175typedef signed64 signed_address;
176#endif
177#if (WITH_TARGET_ADDRESS_BITSIZE == 32)
178typedef unsigned32 unsigned_address;
179typedef signed32 signed_address;
180#endif
3c765a54
AC
181#if (WITH_TARGET_ADDRESS_BITSIZE == 16)
182typedef unsigned16 unsigned_address;
183typedef signed16 signed_address;
184#endif
c906108c
SS
185typedef unsigned_address address_word;
186
187
188/* IEEE 1275 cell size */
189#if (WITH_TARGET_CELL_BITSIZE == 64)
190typedef unsigned64 unsigned_cell;
191typedef signed64 signed_cell;
192#endif
193#if (WITH_TARGET_CELL_BITSIZE == 32)
194typedef unsigned32 unsigned_cell;
195typedef signed32 signed_cell;
196#endif
197typedef signed_cell cell_word; /* cells are normally signed */
198
199
200/* Floating point registers */
201#if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64)
202typedef unsigned64 fp_word;
203#endif
204#if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32)
205typedef unsigned32 fp_word;
206#endif
207
208#endif