|
|
1.1 root 1: /*
2: * h/i8086/cc1mch.h
3: * This header file contains
4: * machine specific macros, types and
5: * definitions that are only used by the
6: * code generator (cc1).
7: * SMALL and LARGE model Intel iAPX-86.
8: */
9:
10: typedef char COST; /* Cost of evaluation */
11: typedef char TYPE; /* Machine type */
12: typedef long FLAG; /* Flags */
13: typedef char REGNAME; /* Register name */
14: typedef int TYPESET; /* Set of TYPE */
15: typedef char PHYSREG; /* Physical register name */
16: typedef int PREGSET; /* Physical reg set */
17: typedef unsigned long PATFLAG; /* Pattern flags, at least 16 bits */
18: typedef int KIND; /* Register kind */
19: typedef int MASK; /* Field masks */
20: typedef char INDEX; /* Index type */
21:
22: #define DOWN 1 /* Grow stack downwards */
23: #define BITS 0 /* The n'th bit code is not needed */
24: #define LONGREL 1 /* The long relational code is needed */
25: #define SWREG AX /* Switch register */
26: #define FNUSED (BAX|BBX|BCX|BDX|BFPAC|BDS|BES) /* Clobbers all */
27: #define NOFREE (BSP|BBP|BCS|BSS) /* Always occupied registers */
28: #define MBLARG MFNARG /* Block argument context */
29: #define MBLREG ANYR /* Block argument register */
30: #define ICALLS 1 /* Free level on call */
31: #define DVALIS 0 /* Index into dval for DVAL sign */
32: #define DVALMS 0200 /* Bit to flip for DVAL sign */
33: #define NBPCH 8 /* # of bits in char (out.c) */
34:
35: #define upper(n) ((ival_t)((unsigned long)(n) >> 16))
36: #define lower(n) ((ival_t)(n))
37: #define isblkp(t) ((t)==LPTB || (t)==SPTB)
38: #if DECVAX
39: #define poolseg(op) ((op!=DCON) ? SLINK : SDATA)
40: #else
41: #define poolseg(op) ((notvariant(VRAM)||(op!=DCON)) ? SLINK : SDATA)
42: #endif
43:
44: #if !TINY
45: /*
46: * Debug printout macros.
47: * Explained in snap1.c
48: */
49: #define isnap(x) printf(" %d", (x))
50: #define lsnap(x) printf(" %ld", (x))
51: #define csnap(x) ((x)!=0?printf(" cost=%d", (x)):0)
52: #define fsnap(x) ((x)!=0?printf(" flag=%lx", (x)):0)
53: #define mdlsnap(x) snaptype((x), "Bad leaf")
54: #define mdosnap(x) snaptype((x), "Bad op")
55: #endif
56:
57: /*
58: * Tree flags.
59: * The 'FLAG' type must be big enough
60: * to hold all of these bits. After the machine
61: * specific flags are the machine independent ones,
62: * and then a number of handy combinations of the
63: * flags, which are used all over.
64: */
65: #define T_0 0x00000001L /* 0 */
66: #define T_1 0x00000002L /* 1 */
67: #define T_2 0x00000004L /* 2 */
68: #define T_BYTE 0x00000008L /* [-128 ... 127] */
69: #define T_ICN 0x00000010L /* ICON */
70: #define T_LCN 0x00000020L /* LCON */
71: #define T_UHS 0x00000040L /* LCON, 0xFFFF.... */
72: #define T_LHS 0x00000080L /* LCON, 0x....FFFF */
73: #define T_UHC 0x00000100L /* LCON, 0x0000.... */
74: #define T_LHC 0x00000200L /* LCON, 0x....0000 */
75: #define T_DCN 0x00000400L /* DCON */
76: #define T_ACS 0x00000800L /* ADDR, code segment */
77: #define T_ADS 0x00001000L /* ADDR, data segment */
78: #define T_RREG 0x00002000L /* REG, rvalue */
79: #define T_LREG 0x00004000L /* REG, lvalue */
80: #define T_SREG 0x00008000L /* REG, stack */
81: #define T_LEA 0x00010000L /* Looks like a LEA */
82: #define T_LSS 0x00020000L /* Looks like a LEA, off SS */
83: #define T_DIR 0x00040000L /* Direct */
84: #define T_OFS 0x00080000L /* Offset */
85:
86: #define T_TREG 0x80000000L /* Need a temporary register */
87: #define T_LV 0x40000000L /* Lvalue context */
88: #define T_MMX 0x20000000L /* Must match shape exactly */
89: #define T_INDIR 0x10000000L /* Fake indirect flag */
90:
91: #define T_NUM (T_ICN|T_LCN)
92: #define T_CON (T_NUM|T_ACS|T_ADS)
93: #define T_IMM (T_CON|T_DCN)
94: #define T_REG (T_RREG|T_LREG|T_SREG)
95: #define T_ADR (T_DIR|T_RREG|T_LREG|T_SREG)
96: #define T_LEAF (T_ADR|T_IMM|T_OFS|T_LEA|T_LSS)
97: #define T_EASY (T_DIR|T_IMM|T_OFS|T_LREG|T_RREG|T_SREG)
98: #define T_NLEAF (T_IMM|T_ADR)
99:
100: /*
101: * These type testing macros use a
102: * table that is hidden in file "table1.c". Although
103: * you might think they should be in the "PERTYPE"
104: * table (and you are right) they are not so that the
105: * code that is generated does not have a multiply
106: * in it.
107: */
108: #define islong(t) ((tinfo[t]&01) != 0)
109: #define isword(t) ((tinfo[t]&02) != 0)
110: #define isworl(t) ((tinfo[t]&03) != 0)
111: #define isuns(t) ((tinfo[t]&04) != 0)
112: #define isflt(t) ((tinfo[t]&010) != 0)
113: #define isint(t) ((tinfo[t]&020) != 0)
114: #define isbyte(t) ((tinfo[t]&040) != 0)
115: #define isworb(t) ((tinfo[t]&042) != 0)
116: #define issized(t) ((tinfo[t]&0100)!= 0)
117: #define ispoint(t) ((tinfo[t]&0200)!= 0)
118:
119: /*
120: * Machine-dependent pattern flags.
121: * These must not overlap with the pattern flags in cc1.h.
122: */
123: #define P80186 0x10000L /* 80186 */
124: #define P8087 0x20000L /* 8087 */
125: #define P80287 0x40000L /* 80287 */
126: #define MDPFLAGS 0x70000L /* Machine-dependent pattern flags */
127:
128: /*
129: * Register kinds.
130: * Used by the register allocator.
131: */
132: #define KB 01 /* Byte */
133: #define KW 02 /* Word */
134: #define KL 04 /* Long */
135: #define KD 010 /* Double */
136: #define KLP 020 /* Large pointer */
137: #define KSP 040 /* Small pointer */
138:
139: #define KWB (KW|KB) /* Word or byte */
140:
141: /*
142: * Macros for machine dependent stuff.
143: * out.c, pool.c.
144: */
145: #define GIDFMT (A_GID|A_DIR) /* Afield ival for GID output */
146: #define LIDFMT (A_LID|A_DIR) /* Afield ival for LID output */
147: #define CONFMT (A_OFFS|A_IMM) /* Afield ival for constant output */
148: #define mapssize(i) (i) /* Stack roundup */
149: /* Escape to map mch opcodes */
150: #define mapcode(c, tp) (c==ZLDES ? mapzldes(tp) : c)
151: #define mappfx(tp, opv, pfx, npfxp) cbotch("mappfx") /* unused */
152: #define gentos(x,y) /* No top of stack required */
153: #define genstar(x,y,z,zz) /* No star address required */
154: #define getstar(tp,nse,npfx,pfx) /* No star address required */
155: #if ONLYSMALL /* Supply pointer type for IEXPR */
156: #define iptrtype() SPTR
157: #else
158: #define iptrtype() (isvariant(VSMALL) ? SPTR : LPTR)
159: #endif
160:
161: /*
162: * Externals.
163: */
164: #if !YATC
165: extern char tinfo[];
166: extern PREGSET regbusy;
167: extern PREGSET maxbusy;
168: extern PREGSET curbusy;
169: extern PREGSET curxreg;
170: extern int blkflab;
171: #endif
172:
173: /* end of h/i8086/cc1mch.h */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.