Annotation of researchv9/cmd/sun/pcc/machdep.h, revision 1.1.1.1

1.1       root        1: /*     @(#)machdep.h 1.1 86/02/03 SMI  */
                      2: 
                      3: /*
                      4:  * Copyright (c) 1985 by Sun Microsystems, Inc.
                      5:  */
                      6: 
                      7: #ifdef VAX
                      8: 
                      9: /*     VAX-11 Registers */
                     10: 
                     11:        /* scratch registers */
                     12: # define R0 0
                     13: # define R1 1
                     14: # define R2 2
                     15: # define R3 3
                     16: # define R4 4
                     17: # define R5 5
                     18: 
                     19:        /* register variables */
                     20: # define R6 6
                     21: # define R7 7
                     22: # define R8 8
                     23: # define R9 9
                     24: # define R10 10
                     25: # define R11 11
                     26: 
                     27:        /* special purpose */
                     28: # define AP 12         /* argument pointer */
                     29: # define FP 13         /* frame pointer */
                     30: # define SP 14 /* stack pointer */
                     31: # define PC 15 /* program counter */
                     32: 
                     33:        /* floating registers */
                     34: 
                     35:        /* there are no floating point registers on the VAX */
                     36: 
                     37: #else
                     38: 
                     39:        /* 68000 registers */
                     40:        /* D0-D1/A0-A1/FP0-FP1 are scratch */
                     41:        /* D2-D7/A2-A5/FP2-FP7 are available for variable allocation */
                     42:        /* A6 and A7 are special purpose */
                     43: 
                     44:        /* data registers */
                     45: # define D0 0
                     46: # define D1 1
                     47: # define D2 2
                     48: # define D3 3
                     49: # define D4 4
                     50: # define D5 5
                     51: # define D6 6
                     52: # define D7 7
                     53:        /* address registers */
                     54: # define A0 8
                     55: # define A1 9
                     56: # define A2 10
                     57: # define A3 11
                     58: # define A4 12
                     59: # define A5 13
                     60: # define A6 14
                     61: # define SP 15
                     62:        /* floating registers */
                     63: # define FP0 16
                     64: # define FP1 17
                     65: # define FP2 18
                     66: # define FP3 19
                     67: # define FP4 20
                     68: # define FP5 21
                     69: # define FP6 22
                     70: # define FP7 23
                     71: 
                     72: #endif
                     73: 
                     74: /* register cookie for stack pointer */
                     75: 
                     76: #ifdef VAX 
                     77: # define  STKREG FP
                     78: # define  ARGREG AP
                     79: #else 
                     80: # define  STKREG A6
                     81: # define  ARGREG A6
                     82: #endif 
                     83: 
                     84: /*     maximum and minimum register variables */
                     85: 
                     86: #ifdef VAX 
                     87: # define MAXRVAR R11
                     88: # define MINRVAR R6
                     89: #else
                     90: # define MIN_DVAR D2
                     91: # define MAX_DVAR D7
                     92: # define MIN_AVAR A2
                     93: # define MAX_AVAR A5
                     94: # define MIN_FVAR FP2
                     95: # define MAX_FVAR FP7
                     96: #endif
                     97: 
                     98: /*
                     99:  * macros for register variable bookkeeping.  This logically involves
                    100:  * three counters (one for each register bank) but the "machine
                    101:  * independent part" of the compiler explicitly deals with a single
                    102:  * counter.  So we have the following silliness:
                    103:  */
                    104: 
                    105: #ifndef VAX
                    106: 
                    107: #define NEXTD(r) ((r)&0xf)
                    108: #define NEXTA(r) ((((r)>>4)&0xf)+A0)
                    109: #define NEXTF(r) ((((r)>>8)&0xf)+FP0)
                    110: 
                    111: #ifdef FORT
                    112: /* register reserved by iropt for copy of __skybase */
                    113: #define SKYBASE(r) (((r)>>12)&0xf)
                    114: #endif FORT
                    115: 
                    116: #define SETD(r,x) ((r)&=0xfffffff0, (r)|=((x)&0xf))
                    117: #define SETA(r,x) ((r)&=0xffffff0f, (r)|=(((x)-A0)&0xf)<<4)
                    118: #define SETF(r,x) ((r)&=0xfffff0ff, (r)|=(((x)-FP0)&0xf)<<8)
                    119: 
                    120: /*
                    121:  * REGVARMASK represents the set of registers available for
                    122:  * variable allocation, starting at A7 on the left and counting
                    123:  * down to D0.  The register variable set is <d2-d7,a2-a7>.
                    124:  */
                    125: 
                    126: #define REGVARMASK 0x3cfc
                    127: 
                    128: /*
                    129:  * FREGVARMASK represents the set of registers available for
                    130:  * floating point variable allocation, starting at FP0 on the
                    131:  * left and counting up to FP7. The reg variable set is <fp2-fp7>.
                    132:  */
                    133: 
                    134: #define FREGVARMASK 0x3f
                    135: 
                    136: /*
                    137:  * mark a register as used
                    138:  */
                    139: extern int usedregs;
                    140: extern int usedfpregs;
                    141: 
                    142: #define markused(r) {\
                    143:        if ((r) >= FP0)\
                    144:                usedfpregs |= (0x80>>((r)-FP0));\
                    145:        else\
                    146:                usedregs |= (1<<(r));\
                    147: }
                    148: 
                    149: #endif
                    150: 
                    151: #ifdef VAX
                    152: #   define makecc(val,i)  lastcon = (lastcon<<8)|((val<<24)>>24);  
                    153: #else 
                    154: #   define makecc(val,i)       lastcon = i ? (val<<8)|lastcon : val
                    155: #   define MULTIFLOAT
                    156: #   ifdef FORT
                    157: #       define FLOATMATH 2
                    158: #   else
                    159: #       define FLOATMATH floatmath
                    160:        extern int floatmath;
                    161: #   endif
                    162: #endif
                    163: 
                    164: #ifdef VAX 
                    165: # define  ARGINIT 32 
                    166: # define  AUTOINIT 0 
                    167: #else 
                    168: # define  ARGINIT 64 
                    169: # define  AUTOINIT 0
                    170: #endif 
                    171: 
                    172: # define  SZCHAR 8
                    173: # define  SZINT 32
                    174: # define  SZFLOAT 32
                    175: # define  SZDOUBLE 64
                    176: # define  SZEXTENDED 96
                    177: # define  SZLONG 32
                    178: # define  SZSHORT 16
                    179: # define SZPOINT 32
                    180: # define ALCHAR 8
                    181: #ifdef VAX 
                    182: # define ALINT 32
                    183: # define ALFLOAT 32
                    184: # define ALDOUBLE 32
                    185: # define ALEXTENDED 32
                    186: # define ALLONG 32
                    187: # define ALSHORT 16
                    188: # define ALPOINT 32
                    189: # define ALSTRUCT 8
                    190: # define  ALSTACK 32 
                    191: #else 
                    192: # define ALINT 16
                    193: # define ALFLOAT 16
                    194: # define ALDOUBLE 16
                    195: # define ALEXTENDED 32
                    196: # define ALLONG 16
                    197: # define ALSHORT 16
                    198: # define ALPOINT 16
                    199: # define ALSTRUCT 16
                    200: # define  ALSTACK 16
                    201: #endif 
                    202: 
                    203: /*     size in which constants are converted */
                    204: /*     should be long if feasable */
                    205: 
                    206: # define CONSZ long
                    207: #ifdef VAX
                    208: # define CONFMT "%ld"
                    209: #else
                    210: # define CONFMT "0x%lx"
                    211: #endif
                    212: 
                    213: /*     size in which offsets are kept
                    214: /*     should be large enough to cover address space in bits
                    215: */
                    216: 
                    217: # define OFFSZ long
                    218: 
                    219: /*     character set macro */
                    220: 
                    221: # define  CCTRANS(x) x
                    222: 
                    223:        /* various standard pieces of code are used */
                    224: # define LABFMT "L%d"
                    225: 
                    226: /* show stack grows negatively */
                    227: #define BACKAUTO
                    228: #define BACKTEMP
                    229: 
                    230: /* show field hardware support on VAX */
                    231: /* pretend hardware support on 68000  */
                    232: #define FIELDOPS 
                    233: 
                    234: #ifdef VAX
                    235: /* bytes are numbered from right to left */
                    236: #define RTOLBYTES
                    237: #else
                    238: /* bit fields are never sign-extended */
                    239: #define UFIELDS
                    240: #endif
                    241: 
                    242: /* we want prtree included */
                    243: # define STDPRTREE
                    244: # ifndef FORT
                    245: # define ONEPASS
                    246: # endif
                    247: 
                    248: # define ENUMSIZE(high,low) INT
                    249: 
                    250: /* su numbers are ints */
                    251: 
                    252: 
                    253: # define ADDROREG
                    254: # define FIXDEF(p) outstab(p)
                    255: # define FIXARG(p) fixarg(p)
                    256: 
                    257: # define STACKPROBE    /* in code.c */
                    258: # define STABBING
                    259: # define LCOMM
                    260: # define ASSTRINGS
                    261: # define FLEXNAMES
                    262: # define FIXSTRUCT outstruct
                    263: 
                    264: /* Machines with multiple register banks have a hard time representing
                    265:  * a one-component cost function for code generation. What we really
                    266:  * need is a cost vector, with one dimension for each resource (register type).
                    267:  * This approximates that.
                    268:  */
                    269: #ifdef VAX
                    270:     typedef int SUTYPE;
                    271: #else
                    272:     typedef struct sunum{
                    273:        char d, /* data registers */
                    274:             a, /* address registers */
                    275:             f, /* float registers */
                    276:             x; /* not used yet */
                    277:     } SUTYPE;
                    278: #endif
                    279: 
                    280: #ifndef VAX
                    281: extern int use68020;   /* for code generation options */
                    282: extern int use68881;   /* code generation and register allocation */
                    283: #endif VAX

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.