Debian Codegraph @

arch/pdp7/macdefs.h

raw symbols SCIP
1 /* $Id: macdefs.h,v 1.9 2021/10/08 15:59:07 ragge Exp $ */
2 /*
3 * Copyright (c) 2003 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 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 /*
30 * Machine-dependent defines for both passes.
31 */
32 /*
33 * Convert (multi-)character constant to integer.
34 */
35 #define makecc(val,i) lastcon = val;
36
37 #define ARGINIT 18 /* # bits above fp where arguments start */
38 #define AUTOINIT 0 /* # bits below fp where automatics start */
39
40 /*
41 * Storage space requirements
42 */
43 #define SZCHAR 9
44 #define SZBOOL 9
45 #define SZSHORT 18
46 #define SZINT 18
47 #define SZFLOAT 18
48 #define SZDOUBLE 36
49 #define SZLDOUBLE 36
50 #define SZLONG 36
51 #define SZLONGLONG 36 /* XXX */
52 #define SZPOINT(t) 18 /* XXX */
53
54 /*
55 * Alignment constraints
56 */
57 #define ALCHAR 9
58 #define ALBOOL 9
59 #define ALSHORT 18
60 #define ALINT 18
61 #define ALFLOAT 18
62 #define ALDOUBLE 18
63 #define ALLDOUBLE 18
64 #define ALLONG 18
65 #define ALLONGLONG 18
66 #define ALPOINT 18
67 #undef ALSTRUCT /* Not defined if ELF ABI */
68 #define ALSTACK 18
69 #define ALMAX 18 /* not yet supported type */
70
71 /*
72 * Min/max values.
73 */
74 #define MIN_CHAR -256
75 #define MAX_CHAR 255
76 #define MAX_UCHAR 511
77 #define MIN_SHORT -131072
78 #define MAX_SHORT 131071
79 #define MAX_USHORT 262144
80 #define MIN_INT MIN_SHORT
81 #define MAX_INT MAX_SHORT
82 #define MAX_UNSIGNED MAX_USHORT
83 #define MIN_LONG MIN_INT
84 #define MAX_LONG MAX_INT
85 #define MAX_ULONG MAX_UNSIGNED
86 #define MIN_LONGLONG MIN_LONG
87 #define MAX_LONGLONG MAX_LONG
88 #define MAX_ULONGLONG MAX_ULONG
89
90 /* Default char is signed */
91 #define CHAR_UNSIGNED
92 #define BOOL_TYPE UCHAR /* what used to store _Bool */
93 #undef UNALIGNED_ACCESS
94 /*
95 * Use large-enough types.
96 */
97 typedef long long CONSZ;
98 typedef unsigned long long U_CONSZ;
99 typedef long long OFFSZ;
100
101 #define CONFMT "%llo" /* format for printing constants */
102 #define LABFMT "L%d" /* format for printing labels */
103
104 #define STACK_DOWN /* stack grows negatively for automatics */
105
106 #undef FIELDOPS /* no bit-field instructions */
107 #define TARGET_ENDIAN TARGET_LE
108
109 #define FINDMOPS /* to find isz */
110 #define CC_DIV_0 /* division by zero is safe in the compiler */
111 #define BYTEOFF(x) ((x)&01)
112 #define MYALIGN
113 #define MYINSTRING
114 #define MYDOTFILE
115 #define printdotfile(ftitle) /* just ignore */
116 void myendinit(void);
117 #define MYENDINIT myendinit();
118 #define WORD_ADDRESSED
119
120 #define szty(t) (((t) == DOUBLE || (t) == FLOAT || \
121 (t) == LONGLONG || (t) == ULONGLONG) ? 2 : (t) == LDOUBLE ? 3 : 1)
122
123 /*
124 * pdp7 has only one register.
125 * We emulate 7 memory positions to make the compiler happier.
126 */
127 #define AC 000 /* Scratch and return register */
128 #define POS1 001
129 #define POS2 002
130 #define POS3 003
131 #define POS4 004
132 #define POS5 005
133 #define POS6 006
134 #define POS7 007
135
136 #define FP 010
137 #define SP 011
138
139 #define MAXREGS 012
140
141 #define RSTATUS SAREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG, \
142 SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG, \
143 0, 0
144
145 #define ROVERLAP { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \
146 { -1 }, { -1 }, { -1 },
147
148
149 /* Return a register class based on the type of the node */
150 #define PCLASS(p) (p->n_op == REG && regno(p) > 7 ? 0 : \
151 (p->n_op == REG && regno(p)) ? SBREG : SAREG)
152
153 #define NUMCLASS 2 /* highest number of reg classes used */
154
155 int COLORMAP(int c, int *r);
156 #define GCLASS(x) ((x) == 0 ? CLASSA : CLASSB)
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(x) AC
163
164 /* XXX - to die */
165 #define FPREG FP /* frame pointer */
166 #define STKREG SP /* stack pointer */
167
168 #define SLDFPSP (MAXSPECIAL+1) /* load fp or sp */
169
170 extern int msettings;
171 #define M_CHAR18 001 /* Use chars that are word size */
172
173 #define ISCHAR18 (msettings & M_CHAR18)
174 #define ISCHAR9 ((msettings & M_CHAR18) == 0)
175
176 /* For acceptable() */
177 #define USECHAR9 0200
178 #define USECHAR18 0400