|
|
1.1 root 1: /*
2: * The routines in this file
3: * read in code from the intermediate file.
4: * It is almost machine independent but it has been
5: * broken out just in case a strange machine creeps
6: * along.
7: */
8: #ifdef vax
9: #include "INC$LIB:cc2.h"
10: #else
11: #include "cc2.h"
12: #endif
13:
14: /*
15: * Read in a code item.
16: * Return a pointer to a filled in
17: * INS node.
18: */
19: INS *
20: getcode()
21: {
22: register INS *ip;
23: register OPINFO *opp;
24: register int i;
25: register int opcode;
26:
27: opcode = bget();
28: opp = &opinfo[opcode];
29: if (opp->op_style == OF_LPTR) {
30: if (iget() != (A_LID|A_DIR))
31: cbotch("lptr");
32: ip = newi(sizeof(INS));
33: ip->i_type = LLLINK;
34: ip->i_fp = NULL;
35: ip->i_bp = NULL;
36: ip->i_labno = iget();
37: ip->i_sp = NULL;
38: ip->i_ip = NULL;
39: return (ip);
40: }
41: if ((opp->op_flag&OP_JUMP) != 0) {
42: if (iget() != (A_LID|A_DIR))
43: cbotch("jump");
44: ip = newi(sizeof(INS));
45: ip->i_type = JUMP;
46: ip->i_long = 0;
47: ip->i_rel = opcode;
48: ip->i_fp = NULL;
49: ip->i_bp = NULL;
50: ip->i_labno = iget();
51: ip->i_sp = NULL;
52: ip->i_ip = NULL;
53: return (ip);
54: }
55: ip = newn(opp->op_naddr);
56: ip->i_type = CODE;
57: ip->i_fp = NULL;
58: ip->i_bp = NULL;
59: for (i=0; i<opp->op_naddr; ++i)
60: getfield(opcode, &ip->i_af[i]);
61: ip->i_op = opcode;
62: ip->i_naddr = opp->op_naddr;
63: return (ip);
64: }
65:
66: /*
67: * This routine reads in an AUTOS item
68: * that appears in a function body. All it does is
69: * read the size of the stack frame into the global cell
70: * `framesize', which is used by `genprolog' to put out
71: * the function prolog. The register field of the AUTOS
72: * item (the second ival_t) is thrown away.
73: */
74: getautos()
75: {
76: framesize = iget();
77: iget();
78: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.