|
|
1.1 root 1: #include "mfile2.h"
2: #include "setjmp.h"
3: extern jmp_buf back;
4: extern char *regnames[], *frameptr, *argptr;
5: #define REGMASK 0x3f
6: #define REGVAR 6
7: /* these would be 3 and 3 respectively on the mac32, 3f and 6 on the vax */
8: /* registers 0..REGVAR-1 are scratch */
9: typedef struct {
10: unsigned char ans;
11: unsigned char regmask;
12: unsigned short flag;
13: } ret;
14: #define CC 1
15: #define VALUE 2
16: #define TOSTACK 4
17: #define ASADDR 8
18: #define SCRATCH 16
19: #define ICON0 32
20: #define ICON1 64
21: #define ISREG 128
22: #define DESTISLEFT 256
23: #define CANINDIR 512
24: #define FAILX 1024
25: #define INDEX 2048
26: #define FAIL0 4096
27: #define FAIL (FAILX|FAIL0)
28: #define USED 8192
29: #define NOGOOD (FAIL|USED)
30: #define AUTO (16384) /* ans is auto incr/decr */
31: #define FSTASG 0x8000 /* to Stasg, for Stasg */
32: /* as param; as return
33: * CC just need the condition codes; condition codes are valid
34: * VALUE need the value (for incr/decr. as opposed to just the side effect)
35: * TOSTACK put the result on the stack
36: * ASADDR as an address, for various weird environments (calls, extzv, ...)
37: * SCRATCH ; the result is in a scratch place
38: * ICON0 ; the result is the constant 0
39: * ICON1 ; the result is the constant 1
40: * ISREG ; the result is in a register
41: * DESTISLEFT put the result in the left operand (asg ops)
42: * CANINDIR ; the result can be indirected through
43: * FAIL ; there is no result, for we ran out of registers
44: * INDEX ; some size-dependent addressing mode was used, so watch it
45: * FAIL0 ; we ran out of register 0
46: * USED plan to use result; don't re-use, as in 3+(*p++=*q++), register p, q
47: /* ASADDR is never used with a dest, and is always VALUE|ASADDR */
48: ret doit(), allocreg(), specialreg(), indir(), tostack(), indirit(), simpler(),
49: alloctmp(), checksize(), addrsimp();
50:
51: #define LEFT 1
52: #define RIGHT 2
53: char *genjmp(), *genjbc();
54: #define BUF 256
55: extern char bufs[][BUF];
56: extern char *buf, *bufend;
57: extern char prbuf[];
58: char *prptr;
59: #define done(s, n, rm) s.ans = (buf - bufs[0])/BUF; buf += BUF; s.flag = n; s.regmask = rm; if(buf >= bufend) overr(); return(s)
60: #define str(s) bufs[s.ans]
61:
62: enum op { Andeq = 1, And, Cmp, Comop, Decr, Diveq, Div, Xoreq, Xor,
63: Incr, Lseq, Ls, Minuseq, Minus, Modeq, Mod, Muleq, Mul, Oreq,
64: Or, Pluseq, Plus, Rseq, Rs, Asg, Cm, Call, Stcall, Stasg, Compl,
65: Conv, Genbr, Genlab, Genubr, Star, Addr, Ucall, Uminus, Ustcall,
66: Init, Funarg, Fld, Starg, Auto, Reg, Name, Param, Icon, Snode,
67: Qnode, Rnode};
68: enum type { Tpoint, Tchar, Tuchar, Tshort, Tushort, Tint, Tuint, Tlong,
69: Tulong, Tfloat, Tdouble, Tstruct, Tvoid};
70: typedef struct node {
71: enum op op;
72: enum type type;
73: struct node *left, *right;
74: char *name;
75: int lval, rval, label, lop;
76: int stsize, argsize;
77: } mnod;
78:
79: mnod myt[];
80: mnod *copytree(), *gimmenode();
81: extern int ntree, regvar, Pflag, bbcount;
82: #define debugpr(s) /*printf(s), prtree(svq), putchar('\n')*/
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.