Debian Codegraph @

arch/m16c/macdefs.h

raw symbols SCIP
1 /* $Id: macdefs.h,v 1.28 2021/10/08 15:59:06 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 #define makecc(val,i) lastcon = (lastcon<<8)|((val<<8)>>8);
33
34 #define ARGINIT 40 /* # bits above fp where arguments start */
35 #define AUTOINIT 0 /* # bits below fp where automatics start */
36
37 /*
38 * Convert (multi-)character constant to integer.
39 * Assume: If only one value; store at left side (char size), otherwise
40 * treat it as an integer.
41 */
42
43 /*
44 * Storage space requirements
45 */
46 #define SZCHAR 8
47 #define SZINT 16
48 #define SZFLOAT 16
49 #define SZDOUBLE 16
50 #define SZLDOUBLE 16
51 #define SZLONG 32
52 #define SZSHORT 16
53 #define SZLONGLONG 32
54 /* pointers are of different sizes on m16c */
55 #define SZPOINT(t) (ISFTN(DECREF(t)) ? 32 : 16)
56
57 /*
58 * Alignment constraints
59 */
60 #define ALCHAR 8
61 #define ALINT 16
62 #define ALFLOAT 16
63 #define ALDOUBLE 16
64 #define ALLDOUBLE 16
65 #define ALLONG 16
66 #define ALLONGLONG 16
67 #define ALSHORT 16
68 #define ALPOINT 16
69 #define ALSTRUCT 16
70 #define ALSTACK 16
71
72 /*
73 * Min/max values.
74 */
75 #define MIN_CHAR -128
76 #define MAX_CHAR 127
77 #define MAX_UCHAR 255
78 #define MIN_SHORT -32768
79 #define MAX_SHORT 32767
80 #define MAX_USHORT 65535
81 #define MIN_INT -32768
82 #define MAX_INT 32767
83 #define MAX_UNSIGNED 65535
84 #define MIN_LONG -2147483648
85 #define MAX_LONG 2147483647
86 #define MAX_ULONG 4294967295UL
87 #define MIN_LONGLONG -2147483648
88 #define MAX_LONGLONG 2147483647
89 #define MAX_ULONGLONG 4294967295UL
90
91 /* Default char is unsigned */
92 #undef CHAR_UNSIGNED
93
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 "%lld" /* 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 /* Definitions mostly used in pass2 */
110
111 #define BYTEOFF(x) 1
112
113 #define STOARG(p)
114 #define STOFARG(p)
115 #define STOSTARG(p)
116 #define genfcall(a,b) gencall(a,b)
117
118 #define szty(t) (((t) == LONG || (t) == ULONG || \
119 (ISPTR(t) && ISFTN(DECREF(t)))) ? 2 : 1)
120
121 /*
122 * m16c register classes:
123 * A - 16-bit data registers R0-R3
124 * B - 16-bit address registers A0-A1
125 * C - 8-bit data registers R0H, R0L, R1H, R1L
126 */
127
128 #define R0 0
129 #define R2 1
130 #define R1 2
131 #define R3 3
132
133 #define A0 4
134 #define A1 5
135 #define FB 6
136 #define SP 7
137
138 #define R0H 8
139 #define R0L 9
140 #define R1H 10
141 #define R1L 11
142
143 #define NUMCLASS 4 /* Number of register classes */
144
145 #define RETREG(x) (x == CHAR || x == UCHAR ? R0L : R0)
146
147 #define FPREG FB /* frame pointer */
148 #define STKREG SP /* stack pointer */
149
150 #if 0
151 #define REGSZ 8 /* Number of registers */
152 #define MINRVAR R1 /* first register variable */
153 #define MAXRVAR R2 /* last register variable */
154 #endif
155
156 #define MAXREGS 12 /* 12 registers */
157
158 #define RSTATUS \
159 SAREG|TEMPREG, SAREG|PERMREG, SAREG|TEMPREG, SAREG|PERMREG, \
160 SBREG|TEMPREG, SBREG|PERMREG, 0, 0, SCREG, SCREG, SCREG, SCREG,
161
162 #define ROVERLAP \
163 {R0H, R0L, -1},\
164 {-1},\
165 {R1H, R1L, -1},\
166 {-1},\
167 \
168 {-1},\
169 {-1},\
170 \
171 {-1},\
172 {-1},\
173 \
174 {R0, -1},\
175 {R0, -1},\
176 {R1, -1},\
177 {R1, -1},
178
179 #define PCLASS(p) (p->n_type <= UCHAR ? SCREG : ISPTR(p->n_type) ? SBREG:SAREG)
180
181 int COLORMAP(int c, int *r);
182 #define GCLASS(x) (x < 4 ? CLASSA : x < 6 ? CLASSB : x < 12 ? CLASSC : CLASSD)
183 #define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */
184 #define ENCRD(x) (x) /* Encode dest reg in n_reg */
185 #define ENCRA1(x) ((x) << 6) /* A1 */
186 #define ENCRA2(x) ((x) << 12) /* A2 */
187 #define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */
188
189 #define MYADDEDGE(x, t)
190
191 #ifndef NEW_READER
192 //#define TAILCALL
193 #endif
194 #define SFTN (SPECIAL|6)