1*5794Sroot /*static char sccsid[] = "@(#)c2.h 4.5 02/14/82";*/ 21507Sbill /* @(#)c2.h 1.19 80/08/26 13:39:07 */ 31494Sbill /* 41494Sbill * Header for object code improver 51494Sbill */ 61494Sbill 71494Sbill #define JBR 1 81494Sbill #define CBR 2 91494Sbill #define JMP 3 101494Sbill #define LABEL 4 111494Sbill #define DLABEL 5 121494Sbill #define EROU 7 131494Sbill #define JSW 9 141494Sbill #define MOV 10 151494Sbill #define CLR 11 161494Sbill #define INC 12 171494Sbill #define DEC 13 181494Sbill #define TST 14 191494Sbill #define PUSH 15 201494Sbill #define CVT 16 211494Sbill #define CMP 17 221494Sbill #define ADD 18 231494Sbill #define SUB 19 241494Sbill #define BIT 20 251494Sbill #define BIC 21 261494Sbill #define BIS 22 271494Sbill #define XOR 23 281494Sbill #define COM 24 291494Sbill #define NEG 25 301494Sbill #define MUL 26 311494Sbill #define DIV 27 321494Sbill #define ASH 28 331494Sbill #define EXTV 29 341494Sbill #define EXTZV 30 351494Sbill #define INSV 31 361494Sbill #define CALLS 32 371494Sbill #define RET 33 381494Sbill #define CASE 34 391494Sbill #define SOB 35 401494Sbill #define TEXT 36 411494Sbill #define DATA 37 421494Sbill #define BSS 38 431494Sbill #define ALIGN 39 441494Sbill #define END 40 451494Sbill #define MOVZ 41 461494Sbill #define WGEN 42 471494Sbill #define SOBGEQ 43 481494Sbill #define SOBGTR 44 491494Sbill #define AOBLEQ 45 501494Sbill #define AOBLSS 46 511494Sbill #define ACB 47 521494Sbill #define MOVA 48 531494Sbill #define PUSHA 49 541494Sbill #define LGEN 50 551494Sbill #define SET 51 561494Sbill #define MOVC3 52 571494Sbill #define RSB 53 581494Sbill #define JSB 54 591494Sbill #define MFPR 55 601494Sbill #define MTPR 56 611494Sbill #define PROBER 57 621494Sbill #define PROBEW 58 631507Sbill #define LCOMM 59 641507Sbill #define COMM 60 651494Sbill 661494Sbill #define JEQ 0 671494Sbill #define JNE 1 681494Sbill #define JLE 2 691494Sbill #define JGE 3 701494Sbill #define JLT 4 711494Sbill #define JGT 5 721494Sbill /* rearranged for unsigned branches so that jxxu = jxx + 6 */ 731494Sbill #define JLOS 8 741494Sbill #define JHIS 9 751494Sbill #define JLO 10 761494Sbill #define JHI 11 771494Sbill 781494Sbill #define JBC 12 791494Sbill #define JBS 13 801494Sbill #define JLBC 14 811494Sbill #define JLBS 15 821494Sbill #define JBCC 16 831494Sbill #define JBSC 17 841494Sbill #define JBCS 18 851494Sbill #define JBSS 19 861494Sbill 87*5794Sroot /* 88*5794Sroot * When the new opcodes were added, the relative 89*5794Sroot * ordering of the first 3 (those that are not float) 90*5794Sroot * had to be retained, so that other parts of the program 91*5794Sroot * were not broken. 92*5794Sroot * 93*5794Sroot * In addition, the distance between OP3 and OP2 must be preserved. 94*5794Sroot * The order of definitions above OP2 must not be changed. 95*5794Sroot * 96*5794Sroot * Note that these definitions DO NOT correspond to 97*5794Sroot * those definitions used in as, adb and sdb. 98*5794Sroot */ 991494Sbill #define BYTE 1 1001494Sbill #define WORD 2 1011494Sbill #define LONG 3 102*5794Sroot #define FFLOAT 4 103*5794Sroot #define DFLOAT 5 104*5794Sroot #define GFLOAT 6 105*5794Sroot #define HFLOAT 7 106*5794Sroot #define QUAD 8 107*5794Sroot #define OCTA 9 108*5794Sroot #define OP2 10 109*5794Sroot #define OP3 11 110*5794Sroot #define OPB 12 111*5794Sroot #define OPX 13 1121494Sbill 1131494Sbill #define T(a,b) (a|((b)<<8)) 1141494Sbill #define U(a,b) (a|((b)<<4)) 1151494Sbill 1162844Stoy #define C2_ASIZE 128 1172829Stoy 1181494Sbill struct optab { 1191494Sbill char opstring[7]; 1201494Sbill short opcode; 1211494Sbill } optab[]; 1221494Sbill 1231494Sbill struct node { 1241494Sbill char op; 1251494Sbill char subop; 1261494Sbill short refc; 1271494Sbill struct node *forw; 1281494Sbill struct node *back; 1291494Sbill struct node *ref; 1301494Sbill char *code; 1311494Sbill struct optab *pop; 1321507Sbill long labno; 1331494Sbill short seq; 1341494Sbill }; 1351494Sbill 1361494Sbill struct { 1371494Sbill short combop; 1381494Sbill }; 1391494Sbill 1401494Sbill char line[512]; 1411494Sbill struct node first; 1421494Sbill char *curlp; 1431494Sbill int nbrbr; 1441494Sbill int nsaddr; 1451494Sbill int redunm; 1461494Sbill int iaftbr; 1471494Sbill int njp1; 1481494Sbill int nrlab; 1491494Sbill int nxjump; 1501494Sbill int ncmot; 1511494Sbill int nrevbr; 1521494Sbill int loopiv; 1531494Sbill int nredunj; 1541494Sbill int nskip; 1551494Sbill int ncomj; 1561494Sbill int nsob; 1571494Sbill int nrtst; 1581494Sbill int nbj; 1591494Sbill int nfield; 1601494Sbill 1611494Sbill int nchange; 1621494Sbill int isn; 1631494Sbill int debug; 1641494Sbill char *lasta; 1651494Sbill char *lastr; 1661494Sbill char *firstr; 1671494Sbill char revbr[]; 1681494Sbill #define NREG 12 1691494Sbill char *regs[NREG+5]; /* 0-11, 4 for operands, 1 for running off end */ 1702829Stoy char conloc[C2_ASIZE]; 1712829Stoy char conval[C2_ASIZE]; 1722829Stoy char ccloc[C2_ASIZE]; 1731494Sbill 1741494Sbill #define RT1 12 1751494Sbill #define RT2 13 1761494Sbill #define RT3 14 1771494Sbill #define RT4 15 1781494Sbill #define LABHS 127 1791494Sbill 1801494Sbill struct { char lbyte; }; 1811494Sbill 1821494Sbill char *copy(); 1831494Sbill long getnum(); 1841494Sbill struct node *codemove(); 1851494Sbill struct node *insertl(); 1861494Sbill struct node *nonlab(); 187