|
|
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) ((notvariant(VRAM)||(op!=DCON)) ? SLINK : SDATA)
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: #define T_TREG 0x80000000L /* Need a temporary register */
79: #define T_LV 0x40000000L /* Lvalue context */
80: #define T_MMX 0x20000000L /* Must match shape exactly */
81: #define T_INDIR 0x10000000L /* Fake indirect flag */
82:
83: #define T_CON (T_NUM|T_ADDR)
84: #define T_IMM (T_CON|T_DCN)
85: #define T_ADR (T_DIR|T_REG)
86: #define T_NLEAF (T_DIR|T_REG|T_IMM)
87: #define T_EASY (T_DIR|T_REG|T_IMM|T_OFS)
88: #define T_LEAF (T_DIR|T_REG|T_IMM|T_OFS|T_LEA)
89:
90: /*
91: * These type testing macros use a
92: * table that is hidden in file "table1.c".
93: * Although you might think they should be in the "PERTYPE"
94: * table (and you are right), they are not so that the
95: * code that is generated does not have a multiply in it.
96: */
97: #define islong(t) ((tinfo[t]&01) != 0)
98: #define isword(t) ((tinfo[t]&02) != 0)
99: #define isworl(t) ((tinfo[t]&03) != 0)
100: #define isuns(t) ((tinfo[t]&04) != 0)
101: #define isflt(t) ((tinfo[t]&010) != 0)
102: #define isint(t) ((tinfo[t]&020) != 0)
103: #define isbyte(t) ((tinfo[t]&040) != 0)
104: #define isworb(t) ((tinfo[t]&042) != 0)
105: #define issized(t) ((tinfo[t]&0100)!= 0)
106: #define ispoint(t) ((tinfo[t]&0200)!= 0)
107:
108: /*
109: * Machine-dependent pattern flags.
110: * These must not overlap with the pattern flags in cc1.h.
111: */
112: #define PNDP 0x10000L /* 80x87 hardware fp */
113: #define PIEEE 0x20000L /* IEEE software fp */
114: #define PDECVAX 0x40000L /* DECVAX software fp */
115: #define PBYTE 0x80000L /* Requires EAX EBX ECX EDX */
116: #define MDPFLAGS 0xF0000L /* Machine-dependent pattern flags */
117:
118: /*
119: * Register kinds.
120: * Used by the register allocator.
121: */
122: #define KB 0x01 /* Byte */
123: #define KW 0x02 /* Word */
124: #define KL 0x04 /* Long (dword) */
125: #define KD 0x08 /* Double */
126: #define KP KL /* Pointer */
127:
128: #define KWL (KW|KL) /* Word or dword */
129: #define KBWL (KB|KW|KL) /* Byte, word or dword */
130:
131: /*
132: * Macros for machine dependent stuff.
133: * out.c, pool.c.
134: */
135: #define GIDFMT (A_GID|A_DIR) /* Afield ival for GID output */
136: #define LIDFMT (A_LID|A_DIR) /* Afield ival for LID output */
137: #define CONFMT (A_OFFS|A_IMM) /* Afield ival for constant output */
138: #define mapssize(i) (((i)+3)&~3) /* Stack roundup */
139: #define mapcode(c, tp) (c) /* Escape to map mch opcodes */
140: #define gentos(x,y) /* No top of stack required */
141: #define genstar(x,y,z,zz) /* No star address required */
142: #define getstar(tp,nse,npfx,pfx) /* No star address required */
143: #define iptrtype() PTR
144:
145: /*
146: * Externals.
147: */
148: #if !YATC
149: extern int blkflab; /* n1/i386/mtree2.c */
150: extern PREGSET regbusy; /* n1/i386/gen1.c */
151: extern char tinfo[]; /* n1/i386/table1.c */
152: #endif
153:
154: /* end of h/i386/cc1mch.h */
155:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.