source: mainline/uspace/app/pcc/arch/arm/macdefs.h@ 087c27f6

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 087c27f6 was 711e7fe5, checked in by Prutkov Alex <prutkov.alex@…>, 14 years ago

Added printf module

  • Property mode set to 100755
File size: 7.2 KB
Line 
1/* $Id: macdefs.h,v 1.12 2009/01/24 21:43:48 gmcgarry Exp $ */
2/*
3 * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
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/*
34 * Convert (multi-)character constant to integer.
35 */
36#define makecc(val,i) lastcon = (lastcon<<8)|((val<<24)>>24);
37
38/*
39 * Storage space requirements
40 */
41#define SZCHAR 8
42#define SZBOOL 32
43#define SZINT 32
44#define SZFLOAT 32
45#define SZDOUBLE 64
46#define SZLDOUBLE 64
47#define SZLONG 32
48#define SZSHORT 16
49#define SZLONGLONG 64
50#define SZPOINT(t) 32
51
52/*
53 * Alignment constraints
54 */
55#define ALCHAR 8
56#define ALBOOL 32
57#define ALINT 32
58#define ALFLOAT 32
59#define ALDOUBLE 32
60#define ALLDOUBLE 32
61#define ALLONG 32
62#define ALLONGLONG 32
63#define ALSHORT 16
64#define ALPOINT 32
65#define ALSTRUCT 32
66#define ALSTACK 32
67
68/*
69 * Min/max values.
70 */
71#define MIN_CHAR -128
72#define MAX_CHAR 127
73#define MAX_UCHAR 255
74#define MIN_SHORT -32768
75#define MAX_SHORT 32767
76#define MAX_USHORT 65535
77#define MIN_INT -1
78#define MAX_INT 0x7fffffff
79#define MAX_UNSIGNED 0xffffffff
80#define MIN_LONG MIN_INT
81#define MAX_LONG MAX_INT
82#define MAX_ULONG MAX_UNSIGNED
83#define MIN_LONGLONG 0x8000000000000000LL
84#define MAX_LONGLONG 0x7fffffffffffffffLL
85#define MAX_ULONGLONG 0xffffffffffffffffULL
86
87#define BOOL_TYPE INT /* what used to store _Bool */
88
89/*
90 * Use large-enough types.
91 */
92typedef long long CONSZ;
93typedef unsigned long long U_CONSZ;
94typedef long long OFFSZ;
95
96#define CONFMT "#%lld" /* format for printing constants */
97#define LABFMT ".L%d" /* format for printing labels */
98#define STABLBL "LL%d" /* format for stab (debugging) labels */
99#define STAB_LINE_ABSOLUTE /* S_LINE fields use absolute addresses */
100
101#undef FIELDOPS /* no bit-field instructions */
102
103#define ENUMSIZE(high,low) INT /* enums are always stored in full int */
104
105/* Definitions mostly used in pass2 */
106
107#define BYTEOFF(x) ((x)&03)
108#define wdal(k) (BYTEOFF(k)==0)
109#define BITOOR(x) (x) /* bit offset to oreg offset XXX die! */
110
111#define STOARG(p)
112#define STOFARG(p)
113#define STOSTARG(p)
114
115#define szty(t) (((t) == DOUBLE || (t) == LDOUBLE || \
116 (t) == LONGLONG || (t) == ULONGLONG) ? 2 : 1)
117
118#define R0 0
119#define R1 1
120#define R2 2
121#define R3 3
122#define R4 4
123#define R5 5
124#define R6 6
125#define R7 7
126#define R8 8
127#define R9 9
128#define R10 10
129#define R11 11
130#define R12 12
131#define R13 13
132#define R14 14
133#define R15 15
134
135#define SL R10
136#define FP R11
137#define IP R12
138#define SP R13
139#define LR R14
140#define PC R15
141
142#define R0R1 16
143#define R1R2 17
144#define R2R3 18
145#define R3R4 19
146#define R4R5 20
147#define R5R6 21
148#define R6R7 22
149#define R7R8 23
150#define R8R9 24
151#define R9R10 25
152
153#define F0 26
154#define F1 27
155#define F2 28
156#define F3 29
157#define F4 30
158#define F5 31
159#define F6 32
160#define F7 33
161
162#define NUMCLASS 3
163#define MAXREGS 34
164
165#define RSTATUS \
166 SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, \
167 SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \
168 SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \
169 0, 0, 0, 0, 0, \
170 SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG, SBREG, \
171 SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \
172 SCREG, SCREG, SCREG, SCREG, \
173 SCREG, SCREG, SCREG, SCREG, \
174
175#define ROVERLAP \
176 { R0R1, -1 }, \
177 { R0R1, R1R2, -1 }, \
178 { R1R2, R2R3, -1 }, \
179 { R2R3, R3R4, -1 }, \
180 { R3R4, R4R5, -1 }, \
181 { R4R5, R5R6, -1 }, \
182 { R5R6, R6R7, -1 }, \
183 { R6R7, R7R8, -1 }, \
184 { R7R8, R8R9, -1 }, \
185 { R8R9, R9R10, -1 }, \
186 { R9R10, -1 }, \
187 { -1 }, \
188 { -1 }, \
189 { -1 }, \
190 { -1 }, \
191 { -1 }, \
192 { R0, R1, R1R2, -1 }, \
193 { R1, R2, R0R1, R2R3, -1 }, \
194 { R2, R3, R1R2, R3R4, -1 }, \
195 { R3, R4, R2R3, R4R5, -1 }, \
196 { R4, R5, R3R4, R5R6, -1 }, \
197 { R5, R6, R4R5, R6R7, -1 }, \
198 { R6, R7, R5R6, R7R8, -1 }, \
199 { R7, R8, R6R7, R8R9, -1 }, \
200 { R8, R9, R7R8, R9R10, -1 }, \
201 { R9, R10, R8R9, -1 }, \
202 { -1, }, \
203 { -1, }, \
204 { -1, }, \
205 { -1, }, \
206 { -1, }, \
207 { -1, }, \
208 { -1, }, \
209 { -1, }, \
210
211#define BACKTEMP /* stack grows negatively for temporaries */
212#define BACKAUTO /* stack grows negatively for automatics */
213
214#define ARGINIT (4*8) /* # bits above fp where arguments start */
215#define AUTOINIT (12*8) /* # bits above fp where automatics start */
216
217#undef FIELDOPS /* no bit-field instructions */
218#define RTOLBYTES 1 /* bytes are numbered right to left */
219
220/* XXX - to die */
221#define FPREG FP /* frame pointer */
222
223/* Return a register class based on the type of the node */
224#define PCLASS(p) (1 << gclass((p)->n_type))
225
226#define GCLASS(x) (x < 16 ? CLASSA : x < 26 ? CLASSB : CLASSC)
227#define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */
228#define ENCRD(x) (x) /* Encode dest reg in n_reg */
229#define ENCRA1(x) ((x) << 6) /* A1 */
230#define ENCRA2(x) ((x) << 12) /* A2 */
231#define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */
232#define RETREG(x) retreg(x)
233
234int COLORMAP(int c, int *r);
235int retreg(int ty);
236int features(int f);
237
238#define FEATURE_BIGENDIAN 0x00010000
239#define FEATURE_HALFWORDS 0x00020000 /* ldrsh/ldrh, ldrsb */
240#define FEATURE_EXTEND 0x00040000 /* sxth, sxtb, uxth, uxtb */
241#define FEATURE_MUL 0x00080000
242#define FEATURE_MULL 0x00100000
243#define FEATURE_FPA 0x10000000
244#define FEATURE_VFP 0x20000000
245#define FEATURE_HARDFLOAT (FEATURE_FPA|FEATURE_VFP)
246
247#define TARGET_STDARGS
248#define TARGET_BUILTINS \
249 { "__builtin_stdarg_start", arm_builtin_stdarg_start }, \
250 { "__builtin_va_arg", arm_builtin_va_arg }, \
251 { "__builtin_va_end", arm_builtin_va_end }, \
252 { "__builtin_va_copy", arm_builtin_va_copy },
253
254#define NODE struct node
255struct node;
256NODE *arm_builtin_stdarg_start(NODE *f, NODE *a);
257NODE *arm_builtin_va_arg(NODE *f, NODE *a);
258NODE *arm_builtin_va_end(NODE *f, NODE *a);
259NODE *arm_builtin_va_copy(NODE *f, NODE *a);
260#undef NODE
261
262#define COM "\t@ "
263#define NARGREGS 4
Note: See TracBrowser for help on using the repository browser.