From 5d5a09a5d0fd29ac2160780c2dd2a35b36ff206c Mon Sep 17 00:00:00 2001 From: sater Date: Tue, 16 Oct 1984 13:31:44 +0000 Subject: [PATCH] added code to generate code for ACK assembler. Works if ACK_ASS is defined. --- mach/pdp/cg/mach.c | 30 +++++++++++++++++++++++++++++- mach/pdp/cg/mach.h | 22 ++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/mach/pdp/cg/mach.c b/mach/pdp/cg/mach.c index dc478e499..faf167b67 100644 --- a/mach/pdp/cg/mach.c +++ b/mach/pdp/cg/mach.c @@ -49,11 +49,34 @@ con_mult(sz) word sz; { if (sz != 4) fatal("bad icon/ucon size"); +#ifdef ACK_ASS + fprintf(codefile,".long %s\n",str); +#else l = atol(str); fprintf(codefile,"\t%o;%o\n",(int)(l>>16),(int)l); +#endif } +/* + * The next function is difficult to do when not running on a PDP 11 or VAX + * The strategy followed is to assume the code generator is running on a PDP 11 + * unless the ACK_ASS define is on. + * In the last case floating point constants are simply not handled + */ + con_float() { +#ifdef ACK_ASS + static int been_here; + + if (argval != 4 && argval != 8) + fatal("bad fcon size"); + fprintf(codefile,".long\t"); + if (argval == 8) + fprintf(codefile,"F_DUM,"); + fprintf(codefile,"F_DUM\n"); + if ( !been_here++) + fprintf(stderr,"Warning : dummy float-constant(s)\n"); +#else double f; register short *p,i; @@ -67,6 +90,7 @@ con_float() { i = *p++; } fprintf(codefile,"\t%o;%o\n",i,*p++); +#endif } #ifdef REGVARS @@ -131,7 +155,7 @@ f_regsave() { regsave(regstr,off,size) char *regstr; long off; { - fprintf(codefile,"/ Local %ld into %s\n",off,regstr); + fprintf(codefile,"%c Local %ld into %s\n",COMMENTCHAR,off,regstr); /* commented away #ifndef REGPATCH fprintf(codefile,"mov %s,-(sp)\n",regstr); @@ -197,7 +221,11 @@ mes(type) word type; { return ; default: strarg(argt) ; +#ifdef ACK_ASS + fprintf(codefile,".define %s\n",argstr) ; +#else fprintf(codefile,".globl %s\n",argstr) ; +#endif break ; } } diff --git a/mach/pdp/cg/mach.h b/mach/pdp/cg/mach.h index 7bacb57b1..eae2d5790 100644 --- a/mach/pdp/cg/mach.h +++ b/mach/pdp/cg/mach.h @@ -1,12 +1,28 @@ /* $Header$ */ +/* The next define switches between codegeneration for an ACK assembler + * or for the standard UNIX V7 assembler. + * If on code is generated for the ACK assembler. + */ +/* #define ACK_ASS /* code for ACK assembler */ + +#ifdef ACK_ASS +#define COMMENTCHAR '!' +#define ex_ap(y) fprintf(codefile,".extern %s\n",y) +#else +#define COMMENTCHAR '/' #define ex_ap(y) fprintf(codefile,".globl %s\n",y) +#endif #define in_ap(y) /* nothing */ #define newplb(x) fprintf(codefile,"%s:\n",x) #define newilb(x) fprintf(codefile,"%s:\n",x) #define newdlb(x) fprintf(codefile,"%s:\n",x) +#ifdef ACK_ASS +#define newlbss(l,x) fprintf(codefile,"%s:.space 0%o\n",l,x); +#else #define newlbss(l,x) fprintf(codefile,"%s:.=.+0%o\n",l,x); +#endif #define cst_fmt "$0%o" #define off_fmt "0%o" @@ -16,9 +32,15 @@ #define hol_off "0%o+hol%d" +#ifdef ACK_ASS +#define con_cst(x) fprintf(codefile,".short 0%o\n",x) +#define con_ilb(x) fprintf(codefile,".short %s\n",x) +#define con_dlb(x) fprintf(codefile,".short %s\n",x) +#else #define con_cst(x) fprintf(codefile,"0%o\n",x) #define con_ilb(x) fprintf(codefile,"%s\n",x) #define con_dlb(x) fprintf(codefile,"%s\n",x) +#endif #define id_first '_' #define BSS_INIT 0 -- 2.34.1