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