|
|
1.1 root 1: /*
2: * h/i386/cc1mch.h
3: * Machine specific macros, types and definitions
4: * used by the C compiler code generator (cc1).
5: * i386.
6: */
7:
8: /* Type definitions. */
9: typedef char COST; /* Cost of evaluation */
10: typedef char TYPE; /* Machine type */
11: typedef long FLAG; /* Flags */
12: typedef char REGNAME; /* Register name */
13: typedef int TYPESET; /* Set of TYPE */
14: typedef char PHYSREG; /* Physical register name */
15: typedef unsigned long PATFLAG; /* Pattern flags, at least 16 bits */
16: typedef int KIND; /* Register kind */
17: typedef long MASK; /* Field masks */
18: typedef char INDEX; /* Index type */
19:
20: /* Manifest constants. */
21: #define DOWN 1 /* Grow stack downwards */
22: #define BITS 0 /* n'th bit code is not needed */
23: #define LONGREL 0 /* Long relational code is not needed */
24: #define SWREG EAX /* Switch register */
25: #define FNUSED (BEAX|BECX|BEDX) /* Preserve EBX, EDI, ESI */
26: #define NOFREE (BESP|BEBP) /* Always occupied registers */
27: #define MBLARG MFNARG /* Block argument context */
28: #define MBLREG ANYR /* Block argument register */
29: #define ICALLS 1 /* Free level on call */
30: #define DVALIS 0 /* Index into dval for DVAL sign */
31: #define DVALMS 0200 /* Bit to flip for DVAL sign */
32: #define NBPCH 8 /* # of bits in char (out.c) */
33: #define NSWITCH 4 /* # of cases in switch coded as conditionals */
34:
35: /* Macros. */
36: #define isblkp(t) ((t)==PTB)
37: #if DECVAX
38: #define poolseg(op) ((op!=DCON) ? SLINK : SDATA)
39: #else
40: #define poolseg(op) SLINK
41: #endif
42:
43: #if !TINY
44: /*
45: * Debug printout macros.
46: * Explained in snap1.c
47: */
48: #define isnap(x) printf(" %d", (x))
49: #define lsnap(x) printf(" %ld", (x))
50: #define csnap(x) ((x)!=0?printf(" cost=%d", (x)):0)
51: #define fsnap(x) ((x)!=0?printf(" flag=%lx", (x)):0)
52: #define mdlsnap(x) snaptype((x), "Bad leaf")
53: #define mdosnap(x) snaptype((x), "Bad op")
54: #endif
55:
56: /*
57: * Tree flags.
58: * The 'FLAG' type must be big enough to hold all of these bits.
59: * After the machine specific flags are the machine independent ones,
60: * and then a number of handy combinations of the flags,
61: * which are used all over.
62: */
63: #define T_0 0x00000001L /* 0 */
64: #define T_1 0x00000002L /* 1 */
65: #define T_SHCNT 0x00000004L /* [0 ... 31] (shift count) */
66: #define T_SBYTE 0x00000008L /* [-128 ... 127] */
67: #define T_UBYTE 0x00000010L /* [0 ... 255] */
68: #define T_SWORD 0x00000020L /* [-32768 ... 32768] */
69: #define T_UWORD 0x00000040L /* [0 ... 65535] */
70: #define T_NUM 0x00000080L /* ICON or LCON */
71: #define T_DCN 0x00000100L /* DCON */
72: #define T_ADDR 0x00000200L /* ADDR */
73: #define T_REG 0x00000400L /* REG */
74: #define T_LEA 0x00000800L /* Looks like a LEA */
75: #define T_DIR 0x00001000L /* Direct */
76: #define T_OFS 0x00002000L /* Offset */
77:
78: /* The following are used to determine SIB addressibility. */
79: #define T_123 0x00004000L /* [1 2 3] */
80: #define T_234589 0x00008000L /* [2 3 4 5 8 9] */
81: #define T_SIBM 0x000F0000L /* SIB-addressible mask */
82: #define T_ADISP 0x00010000L /* SIB absolute displacement */
83: #define T_RDISP 0x00020000L /* SIB relocatable displacement */
84: #define T_BREG 0x00040000L /* SIB with base register */
85: #define T_IREG 0x00080000L /* SIB with (scaled) index reg */
86:
87: #define T_TREG 0x80000000L /* Need a temporary register */
88: #define T_LV 0x40000000L /* Lvalue context */
89: #define T_MMX 0x20000000L /* Must match shape exactly */
90: #define T_INDIR 0x10000000L /* Fake indirect flag */
91:
92: #define T_CON (T_NUM|T_ADDR)
93: #define T_IMM (T_CON|T_DCN)
94: #define T_ADR (T_DIR|T_REG)
95: #define T_NLEAF (T_DIR|T_REG|T_IMM)
96: #define T_EASY (T_DIR|T_REG|T_IMM|T_OFS)
97: #define T_LEAF (T_DIR|T_REG|T_IMM|T_OFS|T_LEA)
98:
99: /*
100: * These type testing macros use a
101: * table that is hidden in file "table1.c".
102: * Although you might think they should be in the "PERTYPE"
103: * table (and you are right), they are not so that the
104: * code that is generated does not have a multiply in it.
105: */
106: #define islong(t) ((tinfo[t]&01) != 0)
107: #define isword(t) ((tinfo[t]&02) != 0)
108: #define isworl(t) ((tinfo[t]&03) != 0)
109: #define isuns(t) ((tinfo[t]&04) != 0)
110: #define isflt(t) ((tinfo[t]&010) != 0)
111: #define isint(t) ((tinfo[t]&020) != 0)
112: #define isbyte(t) ((tinfo[t]&040) != 0)
113: #define isworb(t) ((tinfo[t]&042) != 0)
114: #define issized(t) ((tinfo[t]&0100)!= 0)
115: #define ispoint(t) ((tinfo[t]&0200)!= 0)
116:
117: /*
118: * Machine-dependent pattern flags.
119: * These must not overlap with the pattern flags in cc1.h.
120: */
121: #define PNDP 0x10000L /* 80x87 hardware fp */
122: #define PIEEE 0x20000L /* IEEE software fp */
123: #define PDECVAX 0x40000L /* DECVAX software fp */
124: #define PBYTE 0x80000L /* Requires EAX EBX ECX EDX */
125: #define MDPFLAGS 0xF0000L /* Machine-dependent pattern flags */
126:
127: /*
128: * Register kinds.
129: * Used by the register allocator.
130: */
131: #define KB 0x01 /* Byte */
132: #define KW 0x02 /* Word */
133: #define KL 0x04 /* Long (dword) */
134: #define KD 0x08 /* Double */
135: #define KP KL /* Pointer */
136:
137: #define KWL (KW|KL) /* Word or dword */
138: #define KBWL (KB|KW|KL) /* Byte, word or dword */
139:
140: /*
141: * Macros for machine dependent stuff.
142: * out.c, pool.c.
143: */
144: #define GIDFMT (A_GID|A_DIR) /* Afield ival for GID output */
145: #define LIDFMT (A_LID|A_DIR) /* Afield ival for LID output */
146: #define CONFMT (A_OFFS|A_IMM) /* Afield ival for constant output */
147: #define mapssize(i) (((i)+3)&~3) /* Stack roundup */
148: #define mapcode(c, tp) (c) /* Escape to map mch opcodes */
149: #define gentos(x,y) /* No top of stack required */
150: #define genstar(x,y,z,zz) /* No star address required */
151: #define iptrtype() PTR
152:
153: /*
154: * Externals.
155: */
156: #if !YATC
157: extern int blkflab; /* n1/i386/mtree2.c */
158: extern PREGSET regbusy; /* n1/i386/gen1.c */
159: extern char tinfo[]; /* n1/i386/table1.c */
160: #endif
161:
162: /* end of h/i386/cc1mch.h */
163:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.