* gas/mn10300/udf.s: New test.
[deliverable/binutils-gdb.git] / sim / common / cgen-types.h
CommitLineData
b9c8cd10
DE
1/* Types for Cpu tools GENerated simulators.
2 Copyright (C) 1996, 1997 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
4
5This file is part of GDB, the GNU debugger.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License along
18with this program; if not, write to the Free Software Foundation, Inc.,
1959 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21#ifndef CGEN_TYPES_H
22#define CGEN_TYPES_H
23
24#ifdef __GNUC__
25#define HAVE_LONGLONG
26#undef DI_FN_SUPPORT
27#define SIM_INLINE extern inline
28#else
29#undef HAVE_LONGLONG
30#define DI_FN_SUPPORT
31#define SIM_INLINE
32#endif
33
34#ifndef CGEN_CAT3
35#if defined(__STDC__) || defined(ALMOST_STDC)
36#define CGEN_XCAT3(a,b,c) a ## b ## c
37#define CGEN_CAT3(a,b,c) CGEN_XCAT3 (a, b, c)
38#else
39#define CGEN_CAT3(a,b,c) a/**/b/**/c
40#endif
41#endif
42\f
43extern const char *mode_names[];
44#define MODE_NAME(m) (mode_names[m])
45
46#ifdef __STDC__
47typedef /*FIXME*/ signed char BI;
48typedef /*FIXME*/ signed char QI;
49#else
50typedef /*FIXME*/ char BI;
51typedef /*FIXME*/ char QI;
52#endif
53typedef short HI;
54typedef int SI;
55typedef unsigned char UBI;
56typedef unsigned char UQI;
57typedef unsigned short UHI;
58typedef unsigned int USI;
59
60#ifdef HAVE_LONGLONG
61typedef long long DI;
62typedef unsigned long long UDI;
63#define GETLODI(di) ((SI) (di))
64#define GETHIDI(di) ((SI) ((di) >> 32))
65#define SETLODI(di, val) ((di) = (((di) & 0xffffffff00000000LL) | (val)))
66#define SETHIDI(di, val) ((di) = (((di) & 0xffffffffLL) | (((DI) (val)) << 32)))
67#define SETDI(di, hi, lo) ((di) = MAKEDI (hi, lo))
68#define MAKEDI(hi, lo) ((((DI) (hi)) << 32) | ((DI) (lo)))
69#else
70typedef struct { SI hi,lo; } DI;
71typedef DI UDI;
72#define GETLODI(di) ((di).lo)
73#define GETHIDI(di) ((di).hi)
74#define SETLODI(di, val) ((di).lo = (val))
75#define SETHIDI(di, val) ((di).hi = (val))
76#define SETDI(di, hi, lo) ((di) = MAKEDI (hi, lo))
77extern DI make_struct_di (SI, SI);
78#define MAKEDI(hi, lo) (make_struct_di ((hi), (lo)))
79#endif
80
81/* FIXME: Need to provide libraries if these aren't appropriate for target,
82 or user's needs. */
83typedef float SF;
84typedef double DF;
85typedef double XF; /* FIXME: configure, provide library */
86typedef double TF; /* FIXME: configure, provide library */
87
88struct argbuf;
89struct cgen_insn;
90struct scache;
91
92/* This is used to record extracted raw data from an instruction, among other
93 things. It must be a host data type, and not a target one so USI is
94 inappropriate. */
95typedef unsigned int UINT;
96
97typedef unsigned long PCADDR;
98typedef unsigned long ADDR;
99typedef /*FIXME*/ unsigned long insn_t;
100
101/* Forward declaration of STATE.
102 Must be defined before profile.h and other module headers. */
103typedef struct sim_state *STATE;
104\f
105/* Execution support.
106
107 Semantic functions come in two versions.
108 One that uses the cache, and one that doesn't.
109 The one that doesn't may eventually be thrown away or replaced with
110 something else. */
111
112/* ??? The cache stuff is still wip, but it at least works. */
113
114#ifdef SCACHE_P
115
116/* iaddr: instruction address */
117typedef PCADDR IADDR;
118/* cia: current instruction address */
119typedef PCADDR CIA;
120#define CIA_ADDR(cia) (cia)
121typedef struct scache *SEM_ARG;
122#define EX_FN_NAME(fn) CGEN_CAT3 (exc,_,fn)
123#define SEM_FN_NAME(fn) CGEN_CAT3 (semc,_,fn)
124
125/* extract.c support */
126/* scache_unset is a cache entry that is never used.
127 It's raison d'etre is so BRANCH_VIA_CACHE doesn't have to test for
128 newval.cache == NULL. */
129extern struct scache scache_unset;
130#define RECORD_IADDR(fld, val) \
131do { (fld) = (val); } while (0)
132
133/* semantics.c support */
134#define SEM_ARGBUF(sem_arg) (&(sem_arg)->argbuf)
135#define SEM_NEXT_PC(sc) ((sc)->next)
136#define SEM_BRANCH_VIA_CACHE(sc, newval) (newval)
137#define SEM_BRANCH_VIA_ADDR(sc, newval) (newval)
138/* Return address a branch insn will branch to.
139 This is only used during tracing. */
140#define SEM_NEW_PC_ADDR(new_pc) (new_pc)
141
142#else /* ! SCACHE_P */
143
144typedef PCADDR IADDR;
145typedef PCADDR CIA;
146#define CIA_ADDR(cia) (cia)
147typedef struct argbuf *SEM_ARG;
148#define EX_FN_NAME(fn) CGEN_CAT3 (ex,_,fn)
149#define SEM_FN_NAME(fn) CGEN_CAT3 (sem,_,fn)
150
151/* extract.c support */
152#define RECORD_IADDR(fld, val) \
153do { (fld) = (val); } while (0)
154
155/* semantics.c support */
156#define SEM_ARGBUF(sem_arg) (sem_arg)
157#define SEM_NEXT_PC(abuf) (abuf->addr + abuf->length)
158#define SEM_BRANCH_VIA_CACHE(abuf, newval) (newval)
159#define SEM_BRANCH_VIA_ADDR(abuf, newval) (newval)
160#define SEM_NEW_PC_ADDR(new_pc) (new_pc)
161
162#endif /* ! SCACHE_P */
163\f
164#define EXTRACT_SIGNED(val, total, start, length) \
165(((((val) >> ((total) - ((start) + (length)))) & ((1 << (length)) - 1)) \
166 ^ (1 << ((length) - 1))) \
167 - (1 << ((length) - 1)))
168
169#define EXTRACT_UNSIGNED(val, total, start, length) \
170(((val) >> ((total) - ((start) + (length)))) & ((1 << (length)) - 1))
171
172/* Compute number of longs required to hold N bits. */
173#define HOST_LONGS_FOR_BITS(n) \
174 (((n) + sizeof (long) * 8 - 1) / sizeof (long) * 8)
175
176#endif /* CGEN_TYPES_H */
This page took 0.076411 seconds and 4 git commands to generate.