Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Types for Cpu tools GENerated simulators. |
42a4f53d | 2 | Copyright (C) 1996-2019 Free Software Foundation, Inc. |
c906108c SS |
3 | Contributed by Cygnus Support. |
4 | ||
5 | This file is part of GDB, the GNU debugger. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
4744ac1b JB |
9 | the Free Software Foundation; either version 3 of the License, or |
10 | (at your option) any later version. | |
c906108c SS |
11 | |
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
4744ac1b JB |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
c906108c SS |
19 | |
20 | /* This file is not included with cgen-sim.h as it defines types | |
21 | needed by sim-base.h. */ | |
22 | ||
23 | #ifndef CGEN_TYPES_H | |
24 | #define CGEN_TYPES_H | |
25 | ||
26 | /* Miscellaneous cgen configury defined here as this file gets | |
27 | included soon enough. */ | |
28 | ||
c906108c SS |
29 | /* Indicate we support --{profile,trace}-{range,function}. */ |
30 | #undef SIM_HAVE_ADDR_RANGE | |
31 | #define SIM_HAVE_ADDR_RANGE | |
32 | ||
33 | #ifdef __GNUC__ | |
34 | #define HAVE_LONGLONG | |
35 | #undef DI_FN_SUPPORT | |
36 | #else | |
37 | #undef HAVE_LONGLONG | |
38 | #define DI_FN_SUPPORT | |
39 | #endif | |
40 | \f | |
41 | /* Mode support. */ | |
42 | ||
43 | /* Common mode types. */ | |
44 | /* ??? Target specific modes. */ | |
45 | typedef enum mode_type { | |
104c1213 | 46 | MODE_VOID, MODE_BI, |
c906108c SS |
47 | MODE_QI, MODE_HI, MODE_SI, MODE_DI, |
48 | MODE_UQI, MODE_UHI, MODE_USI, MODE_UDI, | |
49 | MODE_SF, MODE_DF, MODE_XF, MODE_TF, | |
50 | MODE_TARGET_MAX /* = MODE_TF? */, | |
51 | /* These are host modes. */ | |
52 | MODE_INT, MODE_UINT, MODE_PTR, /*??? MODE_ADDR, MODE_IADDR,*/ | |
53 | MODE_MAX | |
54 | } MODE_TYPE; | |
55 | ||
56 | #define MAX_TARGET_MODES ((int) MODE_TARGET_MAX) | |
57 | #define MAX_MODES ((int) MODE_MAX) | |
58 | ||
4c171e25 | 59 | extern const char * const mode_names[]; |
c906108c SS |
60 | #define MODE_NAME(m) (mode_names[m]) |
61 | ||
2d84da1b | 62 | typedef void VOID; |
c906108c SS |
63 | typedef unsigned char BI; |
64 | typedef signed8 QI; | |
65 | typedef signed16 HI; | |
66 | typedef signed32 SI; | |
67 | typedef unsigned8 UQI; | |
68 | typedef unsigned16 UHI; | |
69 | typedef unsigned32 USI; | |
70 | ||
71 | #ifdef HAVE_LONGLONG | |
72 | typedef signed64 DI; | |
73 | typedef unsigned64 UDI; | |
74 | #define GETLODI(di) ((SI) (di)) | |
75 | #define GETHIDI(di) ((SI) ((UDI) (di) >> 32)) | |
76 | #define SETLODI(di, val) ((di) = (((di) & 0xffffffff00000000LL) | (val))) | |
77 | #define SETHIDI(di, val) ((di) = (((di) & 0xffffffffLL) | (((DI) (val)) << 32))) | |
c906108c SS |
78 | #define MAKEDI(hi, lo) ((((DI) (SI) (hi)) << 32) | ((UDI) (USI) (lo))) |
79 | #else | |
80 | /* DI mode support if "long long" doesn't exist. | |
81 | At one point CGEN supported K&R C compilers, and ANSI C compilers without | |
82 | "long long". One can argue the various merits of keeping this in or | |
83 | throwing it out. I went to the trouble of adding it so for the time being | |
84 | I'm leaving it in. */ | |
85 | typedef struct { SI hi,lo; } DI; | |
86 | typedef DI UDI; | |
87 | #define GETLODI(di) ((di).lo) | |
88 | #define GETHIDI(di) ((di).hi) | |
89 | #define SETLODI(di, val) ((di).lo = (val)) | |
90 | #define SETHIDI(di, val) ((di).hi = (val)) | |
c906108c SS |
91 | extern DI make_struct_di (SI, SI); |
92 | #define MAKEDI(hi, lo) (make_struct_di ((hi), (lo))) | |
93 | #endif | |
94 | ||
c906108c SS |
95 | /* These are used to record extracted raw data from an instruction, among other |
96 | things. It must be a host data type, and not a target one. */ | |
97 | typedef int INT; | |
98 | typedef unsigned int UINT; | |
99 | ||
100 | typedef unsigned_address ADDR; /* FIXME: wip*/ | |
101 | typedef unsigned_address IADDR; /* FIXME: wip*/ | |
102 | ||
43ff13b4 JM |
103 | /* fp types are in cgen-fpu.h */ |
104 | ||
c906108c | 105 | #endif /* CGEN_TYPES_H */ |