Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:ragge:20140601113502

Diff

Diff from 1.15 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/pcc/pcc/arch/arm/macdefs.h

Annotated File View

ragge
1.15
1 /*      $Id: macdefs.h,v 1.15 2014/06/01 11:35:02 ragge Exp $   */
gmcgarry
1.1
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
gmcgarry
1.4
46 #define SZLDOUBLE       64
gmcgarry
1.1
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  */
92 typedef long long CONSZ;
93 typedef unsigned long long U_CONSZ;
94 typedef 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 /* Definitions mostly used in pass2 */
104
105 #define BYTEOFF(x)      ((x)&03)
106 #define wdal(k)         (BYTEOFF(k)==0)
107
108 #define STOARG(p)
109 #define STOFARG(p)
110 #define STOSTARG(p)
111
gmcgarry
1.4
112 #define szty(t) (((t) == DOUBLE || (t) == LDOUBLE || \
113         (t) == LONGLONG || (t) == ULONGLONG) ? 2 : 1)
gmcgarry
1.1
114
115 #define R0      0
116 #define R1      1
117 #define R2      2
118 #define R3      3
119 #define R4      4
120 #define R5      5
121 #define R6      6
122 #define R7      7
123 #define R8      8
124 #define R9      9
gmcgarry
1.3
125 #define R10     10
gmcgarry
1.11
126 #define R11     11
127 #define R12     12
128 #define R13     13
129 #define R14     14
130 #define R15     15
131
132 #define SL      R10
133 #define FP      R11
134 #define IP      R12
135 #define SP      R13
136 #define LR      R14
137 #define PC      R15
gmcgarry
1.2
138
139 #define R0R1    16
140 #define R1R2    17
141 #define R2R3    18
142 #define R3R4    19
143 #define R4R5    20
144 #define R5R6    21
145 #define R6R7    22
146 #define R7R8    23
147 #define R8R9    24
148 #define R9R10   25
gmcgarry
1.1
149
gmcgarry
1.10
150 #define F0      26
151 #define F1      27
152 #define F2      28
153 #define F3      29
154 #define F4      30
155 #define F5      31
156 #define F6      32
157 #define F7      33
158
159 #define NUMCLASS 3
160 #define MAXREGS 34
gmcgarry
1.1
161
162 #define RSTATUS \
163         SAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREG,     \
164         SAREG|PERMREGSAREG|PERMREGSAREG|PERMREGSAREG|PERMREG,     \
gmcgarry
1.2
165         SAREG|PERMREGSAREG|PERMREGSAREG|PERMREG,                    \
gmcgarry
1.1
166         00000,                                                  \
167         SBREG|TEMPREGSBREG|TEMPREGSBREG|TEMPREGSBREG,             \
gmcgarry
1.4
168         SBREGSBREGSBREGSBREGSBREGSBREG,                       \
gmcgarry
1.10
169         SCREGSCREGSCREGSCREG,                                     \
170         SCREGSCREGSCREGSCREG,                                     \
gmcgarry
1.1
171
172 #define ROVERLAP \
173         { R0R1, -1 },                                   \
174         { R0R1R1R2, -1 },                             \
175         { R1R2R2R3, -1 },                             \
176         { R2R3R3R4, -1 },                             \
177         { R3R4R4R5, -1 },                             \
178         { R4R5R5R6, -1 },                             \
179         { R5R6R6R7, -1 },                             \
180         { R6R7R7R8, -1 },                             \
181         { R7R8R8R9, -1 },                             \
gmcgarry
1.2
182         { R8R9R9R10, -1 },                            \
183         { R9R10, -1 },                                  \
gmcgarry
1.1
184         { -1 },                                         \
185         { -1 },                                         \
186         { -1 },                                         \
187         { -1 },                                         \
188         { -1 },                                         \
189         { R0R1R1R2, -1 },                           \
190         { R1R2R0R1R2R3, -1 },                     \
191         { R2R3R1R2R3R4, -1 },                     \
192         { R3R4R2R3R4R5, -1 },                     \
193         { R4R5R3R4R5R6, -1 },                     \
194         { R5R6R4R5R6R7, -1 },                     \
195         { R6R7R5R6R7R8, -1 },                     \
196         { R7R8R6R7R8R9, -1 },                     \
gmcgarry
1.2
197         { R8R9R7R8R9R10, -1 },                    \
gmcgarry
1.3
198         { R9R10R8R9, -1 },                          \
gmcgarry
1.10
199         { -1, },                                        \
200         { -1, },                                        \
201         { -1, },                                        \
202         { -1, },                                        \
203         { -1, },                                        \
204         { -1, },                                        \
205         { -1, },                                        \
206         { -1, },                                        \
gmcgarry
1.1
207
208 #define BACKTEMP                /* stack grows negatively for temporaries */
209 #define BACKAUTO                /* stack grows negatively for automatics */
210
211 #define ARGINIT         (4*8)   /* # bits above fp where arguments start */
212 #define AUTOINIT        (12*8)  /* # bits above fp where automatics start */
213
gmcgarry
1.8
214 #undef  FIELDOPS                /* no bit-field instructions */
ragge
1.14
215 #define TARGET_ENDIAN TARGET_LE
gmcgarry
1.8
216
gmcgarry
1.1
217 /* XXX - to die */
218 #define FPREG   FP      /* frame pointer */
219
220 /* Return a register class based on the type of the node */
gmcgarry
1.4
221 #define PCLASS(p)       (1 << gclass((p)->n_type))
gmcgarry
1.1
222
gmcgarry
1.10
223 #define GCLASS(x)       (x < 16 ? CLASSA : x < 26 ? CLASSB : CLASSC)
gmcgarry
1.1
224 #define DECRA(x,y)      (((x) >> (y*6)) & 63)   /* decode encoded regs */
225 #define ENCRD(x)        (x)             /* Encode dest reg in n_reg */
226 #define ENCRA1(x)       ((x) << 6)      /* A1 */
227 #define ENCRA2(x)       ((x) << 12)     /* A2 */
228 #define ENCRA(x,y)      ((x) << (6+y*6))        /* encode regs in int */
gmcgarry
1.10
229 #define RETREG(x)       retreg(x)
gmcgarry
1.1
230
231 int COLORMAP(int cint *r);
gmcgarry
1.10
232 int retreg(int ty);
gmcgarry
1.7
233 int features(int f);
gmcgarry
1.1
234
gmcgarry
1.7
235 #define FEATURE_BIGENDIAN       0x00010000
236 #define FEATURE_HALFWORDS       0x00020000      /* ldrsh/ldrh, ldrsb */
237 #define FEATURE_EXTEND          0x00040000      /* sxth, sxtb, uxth, uxtb */
238 #define FEATURE_MUL             0x00080000
239 #define FEATURE_MULL            0x00100000
240 #define FEATURE_FPA             0x10000000
gmcgarry
1.10
241 #define FEATURE_VFP             0x20000000
242 #define FEATURE_HARDFLOAT       (FEATURE_FPA|FEATURE_VFP)
gmcgarry
1.7
243
244 #define TARGET_STDARGS
245 #define TARGET_BUILTINS                                         \
246         { "__builtin_stdarg_start"arm_builtin_stdarg_start }, \
247         { "__builtin_va_arg"arm_builtin_va_arg },             \
248         { "__builtin_va_end"arm_builtin_va_end },             \
249         { "__builtin_va_copy"arm_builtin_va_copy },
gmcgarry
1.4
250
251 #define NODE struct node
252 struct node;
253 NODE *arm_builtin_stdarg_start(NODE *fNODE *a);
254 NODE *arm_builtin_va_arg(NODE *fNODE *a);
255 NODE *arm_builtin_va_end(NODE *fNODE *a);
256 NODE *arm_builtin_va_copy(NODE *fNODE *a);
257 #undef NODE
gmcgarry
1.9
258
259 #define COM     "\t@ "
gmcgarry
1.10
260 #define NARGREGS        4
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-08-20 12:44 +0200