Debian Codegraph @

arch/nova/macdefs.h

raw symbols SCIP
1 /* $Id: macdefs.h,v 1.19 2022/01/11 08:22:37 ragge Exp $ */
2 /*
3 * Copyright (c) 2006 Anders Magnusson ([email protected]).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 /*
28 * Machine-dependent defines for Data General Nova.
29 */
30
31 /*
32 * Convert (multi-)character constant to integer.
33 */
34 #define makecc(val,i) lastcon = (lastcon<<8)|(val);
35
36 /*
37 * Storage space requirements
38 */
39 #define SZCHAR 8
40 #define SZBOOL 8
41 #define SZINT 16
42 #define SZFLOAT 32
43 #define SZDOUBLE 64
44 #define SZLDOUBLE 64
45 #define SZLONG 32
46 #define SZSHORT 16
47 #define SZLONGLONG 64
48 #define SZPOINT(t) 16
49
50 /*
51 * Alignment constraints
52 */
53 #define ALCHAR 8
54 #define ALBOOL 8
55 #define ALINT 16
56 #define ALFLOAT 16
57 #define ALDOUBLE 16
58 #define ALLDOUBLE 16
59 #define ALLONG 16
60 #define ALLONGLONG 16
61 #define ALSHORT 16
62 #define ALPOINT 16
63 #define ALSTRUCT 16
64 #define ALSTACK 16
65
66 /*
67 * Min/max values.
68 */
69 #define MIN_CHAR -128
70 #define MAX_CHAR 127
71 #define MAX_UCHAR 255
72 #define MIN_SHORT -32768
73 #define MAX_SHORT 32767
74 #define MAX_USHORT 65535
75 #define MIN_INT MIN_SHORT
76 #define MAX_INT MAX_SHORT
77 #define MAX_UNSIGNED MAX_USHORT
78 #define MIN_LONG 0x80000000L
79 #define MAX_LONG 0x7fffffffL
80 #define MAX_ULONG 0xffffffffUL
81 #define MIN_LONGLONG 0x8000000000000000LL
82 #define MAX_LONGLONG 0x7fffffffffffffffLL
83 #define MAX_ULONGLONG 0xffffffffffffffffULL
84
85 /* Default char is unsigned */
86 #define CHAR_UNSIGNED
87 #define WORD_ADDRESSED
88 #undef STACK_DOWN /* nova stack grows upward */
89 #define STACK_TYPE INT /* type for accessing stack */
90 #define BOOL_TYPE UCHAR
91 #define MYALIGN /* provide private alignment function */
92 #undef FIELDOPS /* no bit-field instructions */
93 #define TARGET_ENDIAN TARGET_LE /* XXX should be both */
94 #define AUTOINIT 16 /* first var one word above offset */
95 #define ARGINIT 16 /* start args one word below fp */
96 #define FINDMOPS /* can in/decrement memory directly. */
97 #define NEWNEED /* new-style needs definitions */
98
99 /*
100 * Use large-enough types.
101 */
102 typedef long CONSZ;
103 typedef unsigned long U_CONSZ;
104 typedef long OFFSZ;
105
106 #define CONFMT "0%lo" /* format for printing constants */
107 #define LABFMT "L%d" /* format for printing labels */
108 #define STABLBL "LL%d" /* format for stab (debugging) labels */
109
110 /* Definitions mostly used in pass2 */
111
112 #define BYTEOFF(x) ((x)&01)
113 #define wdal(k) (BYTEOFF(k)==0)
114
115 #define szty(t) ((t) == DOUBLE || (t) == LDOUBLE || \
116 (t) == LONGLONG || (t) == ULONGLONG ? 4 : \
117 ((t) == LONG || (t) == ULONG || (t) == FLOAT) ? 2 : 1)
118
119 /*
120 * The Nova has three register classes.
121 * Register 6 and 7 are FP and SP (in zero page or HW regs).
122 *
123 * The classes used on Nova are:
124 * A - AC0-AC3 (AC3 not available) : reg 0-3
125 * B - LC0 (long, AC0-1 concatenated) : reg 4
126 * C - FP0 (floating point) : 5
127 */
128 #define AC0 0
129 #define AC1 1
130 #define AC2 2
131 #define AC3 3
132 #define LC0 4
133 #define FP0 5
134 #define FP 6
135 #define SP 7
136
137 #define MAXREGS 8 /* 0-5 */
138
139 #define RSTATUS \
140 SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, 0, \
141 SBREG|TEMPREG, 0, SCREG|TEMPREG, 0, 0
142
143
144 #define ROVERLAP \
145 { LC0, -1 }, { LC0, -1 }, { -1 }, { -1 }, \
146 { 0, 1, -1 }, { -1 }, { -1 }, { -1 },
147
148 /* Return a register class based on the type of the node */
149 /* Used in tshape, avoid matching fp/sp as reg */
150 #define PCLASS(p) \
151 (p->n_type == LONG || p->n_type == ULONG ? SBREG : SAREG) /* XXX FP */
152
153 #define NUMCLASS 3 /* highest number of reg classes used */
154
155 int COLORMAP(int c, int *r);
156 #define GCLASS(x) (x < 4 ? CLASSA : x == LC0 ? CLASSB : CLASSC)
157 #define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */
158 #define ENCRD(x) (x) /* Encode dest reg in n_reg */
159 #define ENCRA1(x) ((x) << 6) /* A1 */
160 #define ENCRA2(x) ((x) << 12) /* A2 */
161 #define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */
162 #define RETREG(t) (t==LONG || t==ULONG ? LC0 : ISPTR(t) ? AC2 : AC0)
163
164 #define FPREG AC3 /* frame pointer, kept in AC3 */
165 #define STKREG SP /* stack pointer */
166
167 #ifdef os_none
168 #define MYINSTRING
169 #endif
170
171 /*
172 * special shapes for sp/fp.
173 */
174 #define SLDFPSP (MAXSPECIAL+1) /* load fp or sp */
175
176 /* floating point definitions */
177 #define FDFLOAT
178 #define DEFAULT_FPI_DEFS { &fpi_ffloat, &fpi_dfloat, &fpi_dfloat }