|
|
1.1 ! root 1: /* ! 2: * n2/i386/getcod.c ! 3: * The routines in this file read 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 along. ! 6: * i386. ! 7: */ ! 8: ! 9: #ifdef vax ! 10: #include "INC$LIB:cc2.h" ! 11: #else ! 12: #include "cc2.h" ! 13: #endif ! 14: ! 15: /* ! 16: * Read in a code item. ! 17: * Return a pointer to a filled in 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 within a function body. ! 68: * It reads the size of the stack frame into the global cell 'framesize', ! 69: * which is used by 'genprolog' to put out the function prolog. ! 70: * It reads the used register field of the AUTOS item into 'usedregs'. ! 71: */ ! 72: getautos() ! 73: { ! 74: framesize = iget(); ! 75: usedregs = iget(); ! 76: } ! 77: ! 78: /* end of n2/i386/getcod.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.