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