1*5801Srrh /* 2*5801Srrh * Copyright (c) 1982 Regents of the University of California 3*5801Srrh */ 4*5801Srrh #ifndef lint 5*5801Srrh static char sccsid[] = "@(#)assizetab.c 4.1 02/14/82"; 6*5801Srrh #endif not lint 7*5801Srrh 8*5801Srrh #ifdef AS 9*5801Srrh #include <stdio.h> 10*5801Srrh #include "as.h" 11*5801Srrh #include "assyms.h" 12*5801Srrh 13*5801Srrh /* 14*5801Srrh * Convert loader reference types (plus PCREL) to bytes and lg bytes 15*5801Srrh */ 16*5801Srrh int reflen[] = { /* {LEN*+PCREL} ==> number of bytes */ 17*5801Srrh 0, 0, 18*5801Srrh 1, 1, /* LEN1, LEN1 + PCREL */ 19*5801Srrh 2, 2, /* LEN2, LEN2 + PCREL */ 20*5801Srrh 4, 4, /* LEN4, LEN2 + PCREL */ 21*5801Srrh 8, 8, /* LEN8, LEN2 + PCREL */ 22*5801Srrh 16, 16 /* LEN16, LEN16 + PCREL */ 23*5801Srrh }; 24*5801Srrh int lgreflen[] = { /* {LEN*+PCREL} ==> number of bytes */ 25*5801Srrh -1, -1, 26*5801Srrh 0, 0, /* LEN1, LEN1 + PCREL */ 27*5801Srrh 1, 1, /* LEN2, LEN2 + PCREL */ 28*5801Srrh 2, 2, /* LEN4, LEN2 + PCREL */ 29*5801Srrh 3, 3, /* LEN8, LEN2 + PCREL */ 30*5801Srrh 4, 4 /* LEN16, LEN16 + PCREL */ 31*5801Srrh }; 32*5801Srrh 33*5801Srrh /* 34*5801Srrh * Convert sizes to loader reference types and type flags 35*5801Srrh */ 36*5801Srrh /*0 1 2 3 4 5 6 7 8*/ 37*5801Srrh /* 38*5801Srrh * Convert {1,2,4,8} into {LEN1, LEN2, LEN4, LEN8} 39*5801Srrh */ 40*5801Srrh int len124[] = { 41*5801Srrh 0, LEN1, /* 0 */ 42*5801Srrh LEN2, 0, /* 2 */ 43*5801Srrh LEN4, 0, /* 4 */ 44*5801Srrh 0, 0, /* 6 */ 45*5801Srrh LEN8, 0, /* 8 */ 46*5801Srrh 0, 0, /* 10 */ 47*5801Srrh 0, 0, /* 12 */ 48*5801Srrh 0, 0, /* 14 */ 49*5801Srrh LEN16, 0 /* 16 */ 50*5801Srrh }; 51*5801Srrh /* 52*5801Srrh * Convert {1,2,4,8} into {bits to construct operands} 53*5801Srrh */ 54*5801Srrh char mod124[] = { 55*5801Srrh 0, 0x00, /* 0 */ 56*5801Srrh 0x20, 0, /* 2 */ 57*5801Srrh 0x40, 0, /* 4 */ 58*5801Srrh 0, 0, /* 6 */ 59*5801Srrh 0, 0, /* 8 */ 60*5801Srrh 0, 0, /* 10 */ 61*5801Srrh 0, 0, /* 12 */ 62*5801Srrh 0, 0, /* 14 */ 63*5801Srrh 0, 0 /* 16 */ 64*5801Srrh }; 65*5801Srrh /* 66*5801Srrh * {1,2,4,8} into {TYPB, TYPW, TYPL, TYPQ} 67*5801Srrh */ 68*5801Srrh int type_124[] = { 69*5801Srrh 0, TYPB, /* 0 */ 70*5801Srrh TYPW, 0, /* 2 */ 71*5801Srrh TYPL, 0, /* 4 */ 72*5801Srrh 0, 0, /* 6 */ 73*5801Srrh TYPQ, 0, /* 8 */ 74*5801Srrh 0, 0, /* 10 */ 75*5801Srrh 0, 0, /* 12 */ 76*5801Srrh 0, 0, /* 14 */ 77*5801Srrh TYPO, 0 /* 16 */ 78*5801Srrh }; 79*5801Srrh #endif AS 80*5801Srrh /* 81*5801Srrh * Convert TYP[BWLQOFDGH] into {1 if relocation not OK} 82*5801Srrh */ 83*5801Srrh int ty_NORELOC[] = { 84*5801Srrh 0, /* TYPB */ 85*5801Srrh 0, /* TYPW */ 86*5801Srrh 0, /* TYPL */ 87*5801Srrh 1, /* TYPQ */ 88*5801Srrh 1, /* TYPO */ 89*5801Srrh 1, /* TYPF */ 90*5801Srrh 1, /* TYPD */ 91*5801Srrh 1, /* TYPG */ 92*5801Srrh 1, /* TYPH */ 93*5801Srrh 1 /* TYPNONE */ 94*5801Srrh }; 95*5801Srrh /* 96*5801Srrh * Convert TYP[BWLQOFDGH] into {1 if a floating point number} 97*5801Srrh */ 98*5801Srrh int ty_float[] = { 99*5801Srrh 0, /* TYPB */ 100*5801Srrh 0, /* TYPW */ 101*5801Srrh 0, /* TYPL */ 102*5801Srrh 0, /* TYPQ */ 103*5801Srrh 0, /* TYPO */ 104*5801Srrh 1, /* TYPF */ 105*5801Srrh 1, /* TYPD */ 106*5801Srrh 1, /* TYPG */ 107*5801Srrh 1, /* TYPH */ 108*5801Srrh 0 /* TYPNONE */ 109*5801Srrh }; 110*5801Srrh #ifdef AS 111*5801Srrh /* 112*5801Srrh * Convert TYP[BWLQOFDGH] into {LEN1 ... LEN16} 113*5801Srrh */ 114*5801Srrh int ty_LEN[] = { 115*5801Srrh LEN1, /* TYPB */ 116*5801Srrh LEN2, /* TYPW */ 117*5801Srrh LEN4, /* TYPL */ 118*5801Srrh LEN8, /* TYPQ */ 119*5801Srrh LEN16, /* TYPO */ 120*5801Srrh LEN4, /* TYPF */ 121*5801Srrh LEN8, /* TYPD */ 122*5801Srrh LEN8, /* TYPG */ 123*5801Srrh LEN16, /* TYPH */ 124*5801Srrh 0 /* TYPNONE */ 125*5801Srrh }; 126*5801Srrh #endif AS 127*5801Srrh /* 128*5801Srrh * Convert TYP[BWLQOFDGH] into {1 ... 16} 129*5801Srrh */ 130*5801Srrh int ty_nbyte[] = { 131*5801Srrh 1, /* TYPB */ 132*5801Srrh 2, /* TYPW */ 133*5801Srrh 4, /* TYPL */ 134*5801Srrh 8, /* TYPQ */ 135*5801Srrh 16, /* TYPO */ 136*5801Srrh 4, /* TYPF */ 137*5801Srrh 8, /* TYPD */ 138*5801Srrh 8, /* TYPG */ 139*5801Srrh 16, /* TYPH */ 140*5801Srrh 0 /* TYPNONE */ 141*5801Srrh }; 142*5801Srrh /* 143*5801Srrh * Convert TYP[BWLQOFDGH] into lg{1 ... 16} 144*5801Srrh */ 145*5801Srrh int ty_nlg[] = { 146*5801Srrh 0, /* TYPB */ 147*5801Srrh 1, /* TYPW */ 148*5801Srrh 2, /* TYPL */ 149*5801Srrh 3, /* TYPQ */ 150*5801Srrh 4, /* TYPO */ 151*5801Srrh 2, /* TYPF */ 152*5801Srrh 3, /* TYPD */ 153*5801Srrh 3, /* TYPG */ 154*5801Srrh 4, /* TYPH */ 155*5801Srrh -1 /* TYPNONE */ 156*5801Srrh }; 157*5801Srrh /* 158*5801Srrh * Convert TYP[BWLQOFDGH] into strings 159*5801Srrh */ 160*5801Srrh char *ty_string[] = { 161*5801Srrh "byte", /* TYPB */ 162*5801Srrh "word", /* TYPW */ 163*5801Srrh "long", /* TYPL */ 164*5801Srrh "quad", /* TYPQ */ 165*5801Srrh "octa", /* TYPO */ 166*5801Srrh "f_float", /* TYPF */ 167*5801Srrh "d_float", /* TYPD */ 168*5801Srrh "g_float", /* TYPG */ 169*5801Srrh "h_float", /* TYPH */ 170*5801Srrh "unpackd", /* TYPUNPACKED */ 171*5801Srrh "??snark??" /* TYPNONE */ 172*5801Srrh }; 173