 /* $Header:assizetab.c 12.0$ */
 /* $ACIS:assizetab.c 12.0$ */
 /* $Source: /ibm/acis/usr/src/bin/as_ca/RCS/assizetab.c,v $ */
#ifndef lint
static char rcsid[] = "$Header:assizetab.c 12.0$";
#endif
/* $Source: /ibm/acis/usr/src/bin/as_ca/RCS/assizetab.c,v $ */
/*
 *	Copyright (c) 1982 Regents of the University of California
 */
#ifndef lint
static char sccsid[] = "@(#)assizetab.c 4.4 11/11/82";
#endif not lint

#ifdef AS
#include <stdio.h>
#include "as.h"
#include "assyms.h"

/*
 *	Convert loader reference types (plus PCREL) to bytes and lg bytes
 */
int	reflen[] = { 	/* {LEN*+PCREL} ==> number of bytes */
	0,	0,
	1,	1,	/* LEN1,	LEN1 + PCREL */
	2,	2,	/* LEN2,	LEN2 + PCREL */
	4,	4,	/* LEN4,	LEN2 + PCREL */
	8,	8,	/* LEN8,	LEN2 + PCREL */
	16,	16	/* LEN16,	LEN16 + PCREL */
};	
int	lgreflen[] = { 	/* {LEN*+PCREL} ==> number of bytes */
	-1,	-1,
	0,	0,	/* LEN1,	LEN1 + PCREL */
	1,	1,	/* LEN2,	LEN2 + PCREL */
	2,	2,	/* LEN4,	LEN2 + PCREL */
	3,	3,	/* LEN8,	LEN2 + PCREL */
	4,	4	/* LEN16,	LEN16 + PCREL */
};	

/*
 *	Convert sizes to loader reference types and type flags
 */
/*0	1	2	3	4	5	6	7	8*/
/*
 *	Convert {1,2,4,8} into {LEN1, LEN2, LEN4, LEN8}
 */
int	len124[] = {
	0,	LEN1,	/* 0 */
	LEN2,	0,	/* 2 */
	LEN4,	0,	/* 4 */
	0,	0,	/* 6 */
	LEN8,	0,	/* 8 */
	0,	0,	/* 10 */
	0,	0,	/* 12 */
	0,	0,	/* 14 */
	LEN16,	0	/* 16 */
};
/*
 *	Convert {1,2,4,8} into {bits to construct operands}
 */
char	mod124[] = {
	0,	0x00,	/* 0 */
	0x20,	0,	/* 2 */
	0x40,	0,	/* 4 */
	0,	0,	/* 6 */
	0,	0,	/* 8 */
	0,	0,	/* 10 */
	0,	0,	/* 12 */
	0,	0,	/* 14 */
	0,	0	/* 16 */
};
/*
 *	{1,2,4,8} into {TYPB, TYPS, TYPL, TYPU}
 */
int	type_124[] = {
	0,	TYPB,	/* 0 */
	TYPS,	0,	/* 2 */
	TYPL,	0,	/* 4 */
	0,	0,	/* 6 */
	TYPU,	0,	/* 8 */
	0,	0,	/* 10 */
	0,	0,	/* 12 */
	0,	0,	/* 14 */
	0,	0	/* 16 */
};
#endif AS
/*
 *	Convert TYP[NBSLUVYZFDH] into {1 if relocation not OK}
 */
int	ty_NORELOC[] = {
	1,	/* TYPN */
	0,	/* TYPB */
	0,	/* TYPS */
	0,	/* TYPL */
	0,	/* TYPU */
	0,	/* TYPV */
	1,	/* TYPY */
	0,	/* TYPZ */
	1,	/* TYPF */
	1,	/* TYPD */
	1,	/* TYPH */
	1,	/* TYPUNPACKED */
	1	/* TYPNONE */
};
#ifndef ADB
/*
 *	Convert TYP[NBSLUVYZFDH] into {1 if a floating point number}
 */
int	ty_float[] = {
	0,	/* TYPN */
	0,	/* TYPB */
	0,	/* TYPS */
	0,	/* TYPL */
	0,	/* TYPU */
	0,	/* TYPV */
	0,	/* TYPY */
	0,	/* TYPZ */
	1,	/* TYPF */
	1,	/* TYPD */
	1, 	/* TYPH */
	1,	/* TYPUNPACKED */
	0	/* TYPNONE */
};
#endif
#ifdef AS
/*
 *	Convert TYP[NBSLUVYZFDH] into {LEN1 ... LEN16}
 */
int	ty_LEN[] = {	/* can't find that this is used any place */
	LEN1,	/* TYPN */
	LEN1,	/* TYPB */
	LEN2,	/* TYPS */
	LEN4,	/* TYPL */
	LEN8,	/* TYPU */
	LEN1,	/* TYPV */
	LEN1,	/* TYPY */
	LEN1,	/* TYPZ */
	LEN4,	/* TYPF */
	LEN8,	/* TYPD */
	LEN16,	/* TYPH */
	0,	/* TYPUNPACKED */
	0	/* TYPNONE */
};
#endif AS
/*
 *	Convert TYP[NBSLUVYZFDH] into {1 ... 16}
 */
int	ty_nbyte[] = {
	1,	/* TYPN */
	1,	/* TYPB */
	2,	/* TYPS */
	4,	/* TYPL */
	8,	/* TYPU */
	2,	/* TYPV */
	1,	/* TYPY */
	3,	/* TYPZ */
	4,	/* TYPF */
	8,	/* TYPD */
       16,	/* TYPH */
	0,	/* TYPUNPACKED */
	0	/* TYPNONE */
};
#ifndef ADB
/*
 *	Convert TYP[NBSLUVYZFDH] into lg{1 ... 16}
 */
int	ty_nlg[] = {
	0,	/* TYPN */
	0,	/* TYPB */
	1,	/* TYPS */
	2,	/* TYPL */
	0,	/* TYPU */
	3,	/* TYPV */
	0,	/* TYPY */
	2,	/* TYPZ */
	0,	/* TYPF */
	0,	/* TYPD */
	0,	/* TYPH */
	-1,	/* TYPUNPACKED */
	-1	/* TYPNONE */
};
/*
 *	Convert TYP[NBSLUVYZFDH] into strings
 */
char	*ty_string[] = {
	"nibble",	/* TYPN */
	"byte",		/* TYPB */
	"short",	/* TYPS */
	"long",		/* TYPL */
	"dbllong",	/* TYPU */
	"splitIMMED",	/* TYPV */
	"var4bitln",	/* TYPY */
	"pcrel3bytes",	/* TYPZ */
	"float",	/* TYPF */
	"double",	/* TYPD */
	"h_float",	/* TYPH */
	"unpacked",	/* TYPUNPACKED */
	"??snark??"	/* TYPNONE */
};
#endif
