1 /* Id: macdefs.h,v 1.5 2011/06/05 10:19:24 ragge Exp */ 2 /* $NetBSD: macdefs.h,v 1.1.1.3 2011/09/01 12:46:41 plunky Exp $ */ 3 /* 4 * Copyright (c) 2006 Anders Magnusson (ragge@ludd.luth.se). 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 /* 29 * Machine-dependent defines for Data General Nova. 30 */ 31 32 /* 33 * Convert (multi-)character constant to integer. 34 */ 35 #define makecc(val,i) lastcon = (lastcon<<8)|(val); 36 37 #define ARGINIT 16 /* adjusted in MD code */ 38 #define AUTOINIT 16 /* adjusted in MD code */ 39 40 /* 41 * Storage space requirements 42 */ 43 #define SZCHAR 8 44 #define SZINT 16 45 #define SZFLOAT 32 46 #define SZDOUBLE 64 47 #define SZLDOUBLE 64 48 #define SZLONG 32 49 #define SZSHORT 16 50 #define SZLONGLONG 32 51 #define SZPOINT(t) 16 /* Actually 15 */ 52 53 /* 54 * Alignment constraints 55 */ 56 #define ALCHAR 8 57 #define ALINT 16 58 #define ALFLOAT 16 59 #define ALDOUBLE 16 60 #define ALLDOUBLE 16 61 #define ALLONG 16 62 #define ALLONGLONG 16 63 #define ALSHORT 16 64 #define ALPOINT 16 65 #define ALSTRUCT 16 66 #define ALSTACK 16 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 MIN_SHORT 78 #define MAX_INT MAX_SHORT 79 #define MAX_UNSIGNED MAX_USHORT 80 #define MIN_LONG 0x80000000L 81 #define MAX_LONG 0x7fffffffL 82 #define MAX_ULONG 0xffffffffUL 83 #define MIN_LONGLONG MIN_LONG 84 #define MAX_LONGLONG MAX_LONG 85 #define MAX_ULONGLONG MAX_ULONG 86 87 /* Default char is unsigned */ 88 #define CHAR_UNSIGNED 89 #define WORD_ADDRESSED 90 91 /* 92 * Use large-enough types. 93 */ 94 typedef long CONSZ; 95 typedef unsigned long U_CONSZ; 96 typedef long OFFSZ; 97 98 #define CONFMT "%ld" /* format for printing constants */ 99 #define LABFMT ".L%d" /* format for printing labels */ 100 #define STABLBL ".LL%d" /* format for stab (debugging) labels */ 101 #ifdef FORTRAN 102 #define XL 8 103 #define FLABELFMT "%s:\n" 104 #define USETEXT ".text" 105 #define USECONST ".data\t0" /* XXX - fix */ 106 #define USEBSS ".data\t1" /* XXX - fix */ 107 #define USEINIT ".data\t2" /* XXX - fix */ 108 #define MAXREGVAR 3 /* XXX - fix */ 109 #define BLANKCOMMON "_BLNK_" 110 #define MSKIREG (M(TYSHORT)|M(TYLONG)) 111 #define TYIREG TYLONG 112 #define FSZLENG FSZLONG 113 #define FUDGEOFFSET 1 114 #define AUTOREG EBP 115 #define ARGREG EBP 116 #define ARGOFFSET 4 117 #endif 118 119 #define BACKAUTO /* stack grows negatively for automatics */ 120 #define BACKTEMP /* stack grows negatively for temporaries */ 121 122 #undef FIELDOPS /* no bit-field instructions */ 123 #define TARGET_ENDIAN TARGET_LE 124 125 /* Definitions mostly used in pass2 */ 126 127 #define BYTEOFF(x) ((x)&01) 128 #define wdal(k) (BYTEOFF(k)==0) 129 #define BITOOR(x) (x) /* bit offset to oreg offset XXX die! */ 130 131 #define STOARG(p) 132 #define STOFARG(p) 133 #define STOSTARG(p) 134 #define genfcall(a,b) gencall(a,b) 135 136 #define szty(t) (((t) == DOUBLE || (t) == LDOUBLE) ? 4 : \ 137 ((t) == LONGLONG || (t) == ULONGLONG || \ 138 (t) == LONG || (t) == ULONG) ? 2 : 1) 139 140 /* 141 * The Nova has three register classes. Note that the space used in 142 * zero page is considered registers. 143 * Register 28 and 29 are FP and SP. 144 * 145 * The classes used on Nova are: 146 * A - AC0-AC3 (as non-index registers) : reg 0-3 147 * B - AC2-AC3 (as index registers) : reg 2-3 148 * C - address 50-77 in memory : reg 4-27 149 */ 150 #define MAXREGS 30 /* 0-29 */ 151 152 #define RSTATUS \ 153 SAREG|TEMPREG, SAREG|TEMPREG, SAREG|SBREG|TEMPREG, SAREG|SBREG|TEMPREG,\ 154 SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, \ 155 SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, \ 156 SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, \ 157 SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, \ 158 SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, \ 159 SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, \ 160 0, 0 161 162 #define ROVERLAP \ 163 { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \ 164 { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \ 165 { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \ 166 { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, 167 168 169 /* Return a register class based on the type of the node */ 170 /* all types in all classes */ 171 #define PCLASS(p) (SAREG|SBREG|SCREG) 172 173 #define NUMCLASS 4 /* highest number of reg classes used */ 174 /* XXX - must be 4 */ 175 176 int COLORMAP(int c, int *r); 177 #define GCLASS(x) (x < 4 ? CLASSA : CLASSC) 178 #define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */ 179 #define ENCRD(x) (x) /* Encode dest reg in n_reg */ 180 #define ENCRA1(x) ((x) << 6) /* A1 */ 181 #define ENCRA2(x) ((x) << 12) /* A2 */ 182 #define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */ 183 #define RETREG(x) (0) /* ? Sanity */ 184 185 /* XXX - to die */ 186 #define FPREG 28 /* frame pointer */ 187 #define STKREG 29 /* stack pointer */ 188