VAX-11/780 - SPECIFIC ROUTINES
int maxregvar
= MAXREGVAR
;
int regnum
[] = { 11, 10, 9, 8, 7, 6 } ;
static int regmask
[] = { 0, 0x800, 0xc00, 0xe00, 0xf00, 0xf80, 0xfc0 };
/* then put in constants in octal */
{ 037777677777, 037777777777 },
fprintf(asmfile
, "L%d:\t.space\t4\n", proflab
);
p2pi("\tmovab\tL%d,r0", proflab
);
p2pi("\tsubl2\t$LF%d,sp", procno
);
* move argument slot arg1 (relative to ap)
* to slot arg2 (relative to ARGREG)
p2pij("\tmovl\t%d(ap),%d(fp)", arg1
+ARGOFFSET
, arg2
+argloc
);
fprintf(fp
, "L%d:\n", k
);
fprintf(fp
, "\t%s\t%ld\n", (type
==TYSHORT
? ".word" : ".long"), n
);
fprintf(fp
, "\t.long\tL%ld\n", a
);
fprintf(fp
, "\t%s\t0f%e\n", (type
==TYREAL
? ".float" : ".double"), x
);
/* non-portable cheat to preserve bit patterns */
union { double xd
; long int xl
[2]; } cheat
;
fprintf(fp
, "\t.long\t0x%X\n", cheat
.xl
[0]);
fprintf(fp
, "\t.long\t0x%X,0x%X\n", cheat
.xl
[0], cheat
.xl
[1]);
praddr(fp
, stg
, varno
, offset
)
fprintf(fp
, "\t.long\t0\n");
fprintf(fp
, "\t.long\t%s", memname(stg
,varno
));
fprintf(fp
, "+%ld", offset
);
fprintf(asmfile
, "\t.align\t%d\n", lg
);
vaxgoto(index
, nlab
, labs
)
struct Labelblock
*labs
[];
p2pi("\tcasel\tr0,$1,$%d", nlab
-1);
p2pi("L%d:", arrlab
= newlabel() );
for(i
= 0; i
< nlab
; ++i
)
p2pij("\t.word\tL%d-L%d", labs
[i
]->labelno
, arrlab
);
putforce(p
->headblock
.vtype
, p
);
if( ISINT(p
->headblock
.vtype
) )
p2pi("\tjlss\tL%d", neg
);
p2pi("\tjeql\tL%d", zer
);
sprintf(s
, "_%s", varstr(XL
, extsymtab
[mem
].extname
) );
sprintf(s
, "q.%d", mem
+eqvstart
);
fprintf(asmfile
, "\t.lcomm\t%s,%ld\n", s
, len
);
fprintf(asmfile
, "\t.globl\t_%s\n", name
);
fprintf(asmfile
, "\t.comm\t_%s,%ld\n", name
, leng
);
register struct Dimblock
*dp
;
if(procclass
== CLMAIN
) {
p2ps("_%s:", varstr(XL
, ep
->entryname
->extname
));
p2pi("\t.word\tLWM%d", procno
);
fprintf(asmfile
, "\t.set\tLWM%d,0x%x\n",
procno
, regmask
[highregvar
]);
if(ep
->entryname
== NULL
)
p2pi("\t.word\tLWM%d", procno
);
fprintf(asmfile
, "\t.set\tLWM%d,0x%x\n",
procno
, regmask
[highregvar
]);
p2ps("_%s:", varstr(XL
, ep
->entryname
->extname
));
p2pi("\t.word\tLWM%d", procno
);
argloc
= argvec
->memoffset
->constblock
.const.ci
+ SZINT
;
/* first slot holds count */
mvarg(TYADDR
, 0, chslot
);
mvarg(TYLENG
, SZADDR
, chlgslot
);
argslot
= SZADDR
+ SZLENG
;
else if( ISCOMPLEX(proctype
) )
mvarg(TYADDR
, 0, cxslot
);
for(p
= ep
->arglist
; p
; p
=p
->nextp
)
mvarg(TYADDR
, argslot
, q
->vardesc
.varno
);
for(p
= ep
->arglist
; p
; p
= p
->nextp
)
if(q
->vtype
==TYCHAR
&& q
->vclass
!=CLPROC
)
if(q
->vleng
&& ! ISCONST(q
->vleng
) )
q
->vleng
->addrblock
.memno
);
p2pi("\taddl3\t$%d,fp,ap", argloc
-ARGOFFSET
);
p2pi("\tmovl\t$%d,(ap)\n", lastargslot
/SZADDR
);
for(p
= ep
->arglist
; p
; p
= p
->nextp
)
for(i
= 0 ; i
< dp
->ndim
; ++i
)
puteq( fixtype(cpexpr(dp
->dims
[i
].dimsize
)),
fixtype(cpexpr(dp
->dims
[i
].dimexpr
)));
size
= typesize
[ q
->vtype
];
size
*= q
->vleng
->constblock
.const.ci
;
/* on VAX, get more efficient subscripting if subscripts
have zero-base, so fudge the argument pointers for arrays.
Not done if array bounds are being checked.
puteq( cpexpr(fixtype(dp
->baseoffset
)),
cpexpr(fixtype(dp
->basexpr
)));
tp
= (expptr
) ICON(size
);
tp
= (expptr
) cpexpr(q
->vleng
);
fixtype( mkexpr(OPSTAR
, tp
,
cpexpr(dp
->baseoffset
)) ));
p2pi("\tsubl2\tr0,%d(ap)",
p
->datap
->nameblock
.vardesc
.varno
+
else if(dp
->baseoffset
->constblock
.const.ci
!= 0)
sprintf(buff
, "\tsubl2\t$%ld,%d(ap)",
dp
->baseoffset
->constblock
.const.ci
* size
,
p
->datap
->nameblock
.vardesc
.varno
+
putforce(TYINT
, mkexpr(OPSTAR
, cpexpr(dp
->baseoffset
),
sprintf(buff
, "\tsubl2\tr0,%d(ap)",
p
->datap
->nameblock
.vardesc
.varno
+
puteq( cpexpr(typeaddr
), mkaddcon(ep
->typelabel
) );
/* replace to avoid long jump problem
p2pi("\tjmp\tL%d", ep
->entrylabel
);
p2triple(P2LBRACKET
, ARGREG
-highregvar
, procno
);
p2word( (long) (BITSPERCHAR
*autoleng
) );
char *stabdline(code
, type
)
sprintf(buff
, "\t.stabd\t0%o,0,0%o\n", code
, type
);
prstab(s
, code
, type
, loc
)
fprintf(asmfile
, stabline(s
,code
,type
,loc
) );
char *stabline(s
, code
, type
, loc
)
static char buff
[50] = "\t.stab\t\t";
buff
[6] = 'n'; /* .stabn line */
buff
[6] = 's'; /* .stabs line */
while(*s
!='\0' && *s
!=' ' && i
<8)
while( *s
!='\0' && *s
!=' ' && i
<8 )
sprintf(t
, "0%o,0,0%o,%s\n", code
, type
, (loc
? loc
: "0") );
prstab( varstr(VL
,np
->varname
), N_LENG
, 0, convic(leng
) );
type
|= 060; /* .stab code for array */
else if(p
->vclass
== CLPROC
)
type
|= 040; /* .stab code for function */
type
|= (020 << shift
); /* code for pointer-to */
prstab(varstr(VL
,np
->varname
), N_SSYM
,
stabtype(np
), convic(np
->voffset
) );