Quick Search:

Mode

Context

Displaying the whole file. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.16
 
1.17
 
MAIN:ragge:20121201085340
 
macdefs.h
_>11 /*      $Id$    */
 22 /*
 33  * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
 44  * All rights reserved.
 55  *
 66  * Redistribution and use in source and binary forms, with or without
 77  * modification, are permitted provided that the following conditions
 88  * are met:
 99  * 1. Redistributions of source code must retain the above copyright
 1010  *    notice, this list of conditions and the following disclaimer.
 1111  * 2. Redistributions in binary form must reproduce the above copyright
 1212  *    notice, this list of conditions and the following disclaimer in the
 1313  *    documentation and/or other materials provided with the distribution.
 1414  * 3. The name of the author may not be used to endorse or promote products
 1515  *    derived from this software without specific prior written permission
 1616  *
 1717  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 1818  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 1919  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 2020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 2121  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 2222  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 2323  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 2424  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 2525  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 2626  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 2727  */
 2828 
 2929 /*
 3030  * MIPS port by Jan Enoksson (janeno-1@student.ltu.se) and
 3131  * Simon Olsson (simols-1@student.ltu.se) 2005.
 3232  */
 3333 
 3434 /*
 3535  * Machine-dependent defines for both passes.
 3636  */
 3737 
 3838 #if defined(os_netbsd)
 3939 #define USE_GAS
 4040 #endif
 4141 
 4242 /*
 4343  * Convert (multi-)character constant to integer.
 4444  * Assume: If only one value; store at left side (char size), otherwise
 4545  * treat it as an integer.
 4646  */
 4747 #define makecc(val,i)   lastcon = (lastcon<<8)|((val<<24)>>24);
 4848 
 4949 #define ARGINIT         (16*8)  /* # bits above fp where arguments start */
 5050 #define AUTOINIT        (0)     /* # bits below fp where automatics start */
 5151 
 5252 /*
 5353  * Storage space requirements
 5454  */
 5555 #define SZCHAR          8
 5656 #define SZBOOL          32
 5757 #define SZINT           32
 5858 #define SZFLOAT         32
 5959 #define SZDOUBLE        64
 6060 #define SZLDOUBLE       64
 6161 #define SZLONG          32
 6262 #define SZSHORT         16
 6363 #define SZLONGLONG      64
 6464 #define SZPOINT(t)      32
 6565 
 6666 /*
 6767  * Alignment constraints
 6868  */
 6969 #define ALCHAR          8
 7070 #define ALBOOL          32
 7171 #define ALINT           32
 7272 #define ALFLOAT         32
 7373 #define ALDOUBLE        64
 7474 #define ALLDOUBLE       64
 7575 #define ALLONG          32
 7676 #define ALLONGLONG      64
 7777 #define ALSHORT         16
 7878 #define ALPOINT         32
 7979 #define ALSTRUCT        64
 8080 #define ALSTACK         32
 8181 
 8282 /*
 8383  * Min/max values.
 8484  */
 8585 #define MIN_CHAR        -128
 8686 #define MAX_CHAR        127
 8787 #define MAX_UCHAR       255
 8888 #define MIN_SHORT       -32768
 8989 #define MAX_SHORT       32767
 9090 #define MAX_USHORT      65535
 9191 #define MIN_INT         -1
 9292 #define MAX_INT         0x7fffffff
 9393 #define MAX_UNSIGNED    0xffffffff
 9494 #define MIN_LONG        MIN_INT
 9595 #define MAX_LONG        MAX_INT
 9696 #define MAX_ULONG       MAX_UNSIGNED
 9797 #define MIN_LONGLONG    0x8000000000000000LL
 9898 #define MAX_LONGLONG    0x7fffffffffffffffLL
 9999 #define MAX_ULONGLONG   0xffffffffffffffffULL
 100100 
 101101 #undef  CHAR_UNSIGNED
 102102 #define BOOL_TYPE       INT
 103103 
 104104 /*
 105105  * Use large-enough types.
 106106  */
 107107 typedef long long CONSZ;
 108108 typedef unsigned long long U_CONSZ;
 109109 typedef long long OFFSZ;
 110110 
 111111 #define CONFMT  "%lld"          /* format for printing constants */
 112112 #ifdef USE_GAS
 113113 #define LABFMT  "$L%d"          /* format for printing labels */
 114114 #define STABLBL "$LL%d"         /* format for stab (debugging) labels */
 115115 #else
 116116 #define LABFMT  "L%d"           /* format for printing labels */
 117117 #define STABLBL "LL%d"          /* format for stab (debugging) labels */
 118118 #endif
 119119 
 120120 #define BACKAUTO                /* stack grows negatively for automatics */
 121121 #define BACKTEMP                /* stack grows negatively for temporaries */
 122122 
 123123 #undef  FIELDOPS                /* no bit-field instructions */
 124124 #define TARGET_ENDIAN TARGET_LE
 125125 #define MYALIGN
 126126 
 127127 /* Definitions mostly used in pass2 */
 128128 
 129129 #define BYTEOFF(x)      ((x)&03)
 130130 #define BITOOR(x)       (x)     /* bit offset to oreg offset */
 131131 
 132132 #define szty(t)         (((t) == DOUBLE || (t) == LDOUBLE || \
 133133         DEUNSIGN(t) == LONGLONG) ? 2 : 1)
 134134 
 135135 /*
 136136  * Register names.  These must match rnames[] and rstatus[] in local2.c.
 137137  */
 138138 #define ZERO    0
 139139 #define AT      1
 140140 #define V0      2
 141141 #define V1      3
 142142 #define A0      4
 143143 #define A1      5
 144144 #define A2      6
 145145 #define A3      7
 146146 #define A4      8
 147147 #define A5      9
 148148 #define A6      10
 149149 #define A7      11
 150150 #if defined(MIPS_N32) || defined(MIPS_N64)
 151151 #define T0      12
 152152 #define T1      13
 153153 #define T2      14
 154154 #define T3      15
 155155 #else
 156156 #define T0      8
 157157 #define T1      9
 158158 #define T2      10
 159159 #define T3      11
 160160 #endif
 161161 #define T4      12
 162162 #define T5      13
 163163 #define T6      14
 164164 #define T7      15
 165165 #define S0      16
 166166 #define S1      17
 167167 #define S2      18
 168168 #define S3      19
 169169 #define S4      20
 170170 #define S5      21
 171171 #define S6      22
 172172 #define S7      23
 173173 #define T8      24
 174174 #define T9      25
 175175 #define K0      26
 176176 #define K1      27
 177177 #define GP      28
 178178 #define SP      29
 179179 #define FP      30
 180180 #define RA      31
 181181 
 182182 #define V0V1    32
 183183 #define A0A1    33
 184184 #define A1A2    34
 185185 #define A2A3    35
 186186 
 187187 /* we just use o32 naming here, but it works ok for n32/n64 */
 188188 #define A3T0    36
 189189 #define T0T1    37
 190190 #define T1T2    38
 191191 #define T2T3    39
 192192 #define T3T4    40
 193193 #define T4T5    41
 194194 #define T5T6    42
 195195 #define T6T7    43
 196196 #define T7T8    44
 197197 
 198198 #define T8T9    45
 199199 #define S0S1    46
 200200 #define S1S2    47
 201201 #define S2S3    48
 202202 #define S3S4    49
 203203 #define S4S5    50
 204204 #define S5S6    51
 205205 #define S6S7    52
 206206 
 207207 #define F0      53
 208208 #define F2      54
 209209 #define F4      55
 210210 #define F6      56
 211211 #define F8      57
 212212 #define F10     58
 213213 #define F12     59
 214214 #define F14     60
 215215 #define F16     61
 216216 #define F18     62
 217217 #define F20     63
 218218 /* and the rest for later */
 219219 #define F22     64
 220220 #define F24     65
 221221 #define F26     66
 222222 #define F28     67
 223223 #define F30     68
 224224 
 225225 #define MAXREGS 64
 226226 #define NUMCLASS 3
 227227 
 228228 #define RETREG(x)       (DEUNSIGN(x) == LONGLONG ? V0V1 : \
 229229                             (x) == DOUBLE || (x) == LDOUBLE || (x) == FLOAT ? \
 230230                             F0 : V0)
 231231 #define FPREG   FP      /* frame pointer */
 232232 
 233233 #define MIPS_N32_NARGREGS       8
 234234 #define MIPS_O32_NARGREGS       4
 235235 
 236236 #define RSTATUS \
 237237         0, 0,                                                           \
 238238         SAREG|TEMPREG, SAREG|TEMPREG,                                   \
 239239         SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG,     \
 240240         SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG,     \
 241241         SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG,     \
 242242         SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG,     \
 243243         SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG,     \
 244244         SAREG|TEMPREG, SAREG|TEMPREG,                                   \
 245245         0, 0,                                                           \
 246246         0, 0, 0, 0,                                                     \
 247247         \
 248248         SBREG|TEMPREG,                                                  \
 249249         SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG,                    \
 250250         SBREG|TEMPREG,                                                  \
 251251         SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG,                    \
 252252         SBREG|TEMPREG, SBREG|TEMPREG,                                   \
 253253         SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG,     \
 254254         SBREG, SBREG, SBREG, SBREG,                                     \
 255255         SBREG, SBREG, SBREG,                                            \
 256256         SCREG, SCREG, SCREG, SCREG,                                     \
 257257         SCREG, SCREG, SCREG, SCREG,                                     \
 258258         SCREG, SCREG, SCREG,                                            \
 259259 
 260260 #define ROVERLAP \
 261261         { -1 },                         /* $zero */                     \
 262262         { -1 },                         /* $at */                       \
 263263         { V0V1, -1 },                   /* $v0 */                       \
 264264         { V0V1, -1 },                   /* $v1 */                       \
 265265         { A0A1, -1 },                   /* $a0 */                       \
 266266         { A0A1, A1A2, -1 },             /* $a1 */                       \
 267267         { A1A2, A2A3, -1 },             /* $a2 */                       \
 268268         { A2A3, A3T0, -1 },             /* $a3 */                       \
 269269         { A3T0, T0T1, -1 },             /* $t0 */                       \
 270270         { T0T1, T1T2, -1 },             /* $t1 */                       \
 271271         { T1T2, T2T3, -1 },             /* $t2 */                       \
 272272         { T2T3, T3T4, -1 },             /* $t3 */                       \
 273273         { T3T4, T4T5, -1 },             /* $t4 */                       \
 274274         { T4T5, T5T6, -1 },             /* $t5 */                       \
 275275         { T6T7, T7T8, -1 },             /* $t6 */                       \
 276276         { T7T8, T8T9, -1 },             /* $t7 */                       \
 277277         \
 278278         { S0S1, -1 },                   /* $s0 */                       \
 279279         { S0S1, S1S2, -1 },             /* $s1 */                       \
 280280         { S1S2, S2S3, -1 },             /* $s2 */                       \
 281281         { S2S3, S3S4, -1 },             /* $s3 */                       \
 282282         { S3S4, S4S5, -1 },             /* $s4 */                       \
 283283         { S4S5, S5S6, -1 },             /* $s5 */                       \
 284284         { S5S6, S6S7, -1 },             /* $s6 */                       \
 285285         { S6S7, -1 },                   /* $s7 */                       \
 286286         \
 287287         { T7T8, T8T9, -1 },             /* $t8 */                       \
 288288         { T8T9, -1 },                   /* $t9 */                       \
 289289         \
 290290         { -1 },                         /* $k0 */                       \
 291291         { -1 },                         /* $k1 */                       \
 292292         { -1 },                         /* $gp */                       \
 293293         { -1 },                         /* $sp */                       \
 294294         { -1 },                         /* $fp */                       \
 295295         { -1 },                         /* $ra */                       \
 296296         \
 297297         { V0, V1, -1 },                 /* $v0:$v1 */                   \
 298298         \
 299299         { A0, A1, A1A2, -1 },           /* $a0:$a1 */                   \
 300300         { A1, A2, A0A1, A2A3, -1 },     /* $a1:$a2 */                   \
 301301         { A2, A3, A1A2, A3T0, -1 },     /* $a2:$a3 */                   \
 302302         { A3, T0, A2A3, T0T1, -1 },     /* $a3:$t0 */                   \
 303303         { T0, T1, A3T0, T1T2, -1 },     /* $t0:$t1 */                   \
 304304         { T1, T2, T0T1, T2T3, -1 },     /* $t1:$t2 */                   \
 305305         { T2, T3, T1T2, T3T4, -1 },     /* $t2:$t3 */                   \
 306306         { T3, T4, T2T3, T4T5, -1 },     /* $t3:$t4 */                   \
 307307         { T4, T5, T3T4, T5T6, -1 },     /* $t4:$t5 */                   \
 308308         { T5, T6, T4T5, T6T7, -1 },     /* $t5:$t6 */                   \
 309309         { T6, T7, T5T6, T7T8, -1 },     /* $t6:$t7 */                   \
 310310         { T7, T8, T6T7, T8T9, -1 },     /* $t7:$t8 */                   \
 311311         { T8, T9, T7T8, -1 },           /* $t8:$t9 */                   \
 312312         \
 313313         { S0, S1, S1S2, -1 },           /* $s0:$s1 */                   \
 314314         { S1, S2, S0S1, S2S3, -1 },                                     \
 315315         { S2, S3, S1S2, S3S4, -1 },                                     \
 316316         { S3, S4, S2S3, S4S5, -1 },                                     \
 317317         { S4, S5, S3S4, S5S6, -1 },                                     \
 318318         { S5, S6, S4S5, S6S7, -1 },                                     \
 319319         { S6, S7, S5S6, -1 },                                           \
 320320         \
 321321         { -1 }, { -1 }, { -1 }, { -1 },                                 \
 322322         { -1 }, { -1 }, { -1 }, { -1 },                                 \
 323323         { -1 }, { -1 }, { -1 },                                         \
 324324 
 325325 #define GCLASS(x)       (x < 32 ? CLASSA : (x < 52 ? CLASSB : CLASSC))
 326326 #define PCLASS(p)       (1 << gclass((p)->n_type))
 327327 #define DECRA(x,y)      (((x) >> (y*6)) & 63)   /* decode encoded regs */
 328328 #define ENCRA(x,y)      ((x) << (6+y*6))        /* encode regs in int */
 329329 #define ENCRD(x)        (x)                     /* Encode dest reg in n_reg */
 330330 
 331331 int COLORMAP(int c, int *r);
 332332 
 333333 extern int bigendian;
 334334 extern int nargregs;
 335335 
 336336 #define SPCON           (MAXSPECIAL+1)  /* positive constant */
 337337 
 338338 #define TARGET_STDARGS
<>339 -#define TARGET_BUILTINS                                         \
 340 -        { "__builtin_stdarg_start", mips_builtin_stdarg_start, 2 },     \
 341 -        { "__builtin_va_arg", mips_builtin_va_arg, 2 },         \
 342 -        { "__builtin_va_end", mips_builtin_va_end, 1 },         \
 343 -        { "__builtin_va_copy", mips_builtin_va_copy, 2 },
  339+#define TARGET_BUILTINS                                                 \
  340+        { "__builtin_stdarg_start", mips_builtin_stdarg_start,         \
  341+                                                0, 2, 0, VOID },        \
  342+        { "__builtin_va_start", mips_builtin_stdarg_start,             \
  343+                                                0, 2, 0, VOID },        \
  344+        { "__builtin_va_arg", mips_builtin_va_arg, BTNORVAL|BTNOPROTO, \
  345+                                                        2, 0, 0 },      \
  346+        { "__builtin_va_end", mips_builtin_va_end, 0, 1, 0, VOID },    \
  347+        { "__builtin_va_copy", mips_builtin_va_copy, 0, 2, 0, VOID },
344348 
<> 349+#define NODE struct node
345350 struct node;
<_346 -struct node *mips_builtin_stdarg_start(struct node *f, struct node *a, unsigned int);
 347 -struct node *mips_builtin_va_arg(struct node *f, struct node *a, unsigned int);
 348 -struct node *mips_builtin_va_end(struct node *f, struct node *a, unsigned int);
 349 -struct node *mips_builtin_va_copy(struct node *f, struct node *a, unsigned int);
  351+struct bitable;
  352+NODE *mips_builtin_stdarg_start(const struct bitable *, NODE *a);
  353+NODE *mips_builtin_va_arg(const struct bitable *, NODE *a);
  354+NODE *mips_builtin_va_end(const struct bitable *, NODE *a);
  355+NODE *mips_builtin_va_copy(const struct bitable *, NODE *a);
  356+#undef NODE
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-10-31 21:44 +0100