diff --git a/mach/proto/cg/codegen.c b/mach/proto/cg/codegen.c index 4da1fe085..8923db38f 100644 --- a/mach/proto/cg/codegen.c +++ b/mach/proto/cg/codegen.c @@ -462,7 +462,7 @@ if (Debug > 1) fprintf(stderr, "cost after coercions: %u\n", t); do { npos=exactmatch=0; for(rpp=reglist[propno];rp= *rpp; rpp++) - if (getrefcount(rp-machregs, FALSE)==0) { + if (getrefcount((int)(rp-machregs), FALSE)==0) { pos[npos++] = rp-machregs; if (eqtoken(&rp->r_contents,&token)) exactmatch++; diff --git a/mach/proto/cg/move.c b/mach/proto/cg/move.c index 8d8cb7073..e67069e0f 100644 --- a/mach/proto/cg/move.c +++ b/mach/proto/cg/move.c @@ -57,7 +57,7 @@ move(tp1,tp2,ply,toplevel,maxcost) token_p tp1,tp2; unsigned maxcost; { for (i=0;it_type[i] == EV_REG && clash(rp->r_contents.t_att[i].ar,tp2->t_att[0].ar)) { - erasereg(rp-machregs); + erasereg((int)(rp-machregs)); break; } } diff --git a/mach/proto/cg/reg.c b/mach/proto/cg/reg.c index a0443c7da..f93ddd1b9 100644 --- a/mach/proto/cg/reg.c +++ b/mach/proto/cg/reg.c @@ -78,7 +78,7 @@ erasereg(regno) { rp->r_contents.t_token = 0; for (i=0;ir_contents.t_att[i].aw = 0; - awayreg(rp-machregs); + awayreg((int)(rp-machregs)); } #endif } @@ -94,13 +94,13 @@ awayreg(regno) { for (rp=machregs;rpr_contents.t_token == -1) { if (rp->r_contents.t_att[0].ar == regno) - erasereg(rp-machregs); + erasereg((int)(rp-machregs)); } else if (rp->r_contents.t_token > 0) { tdp= & tokens[rp->r_contents.t_token]; for (i=0;it_type[i] == EV_REG && rp->r_contents.t_att[i].ar == regno) { - erasereg(rp-machregs); + erasereg((int)(rp-machregs)); break; } } diff --git a/mach/proto/cg/subr.c b/mach/proto/cg/subr.c index 27b10dc20..f86ae82c3 100644 --- a/mach/proto/cg/subr.c +++ b/mach/proto/cg/subr.c @@ -432,7 +432,7 @@ unsigned stackupto(limit,ply,toplevel) token_p limit; { if (cp->c1_prop>=0) { for (rpp=reglist[cp->c1_prop]; (rp = *rpp)!=0 && - getrefcount(rp-machregs, TRUE)!=0; + getrefcount((int)(rp-machregs), TRUE)!=0; rpp++) ; if (rp==0) diff --git a/modules/src/em_code/C_out.c b/modules/src/em_code/C_out.c index 976d9c07e..e2f692dd6 100644 --- a/modules/src/em_code/C_out.c +++ b/modules/src/em_code/C_out.c @@ -12,6 +12,7 @@ static arg(); static pseudo(); extern char em_flag[]; +char C_error; #define flags(pp) (em_flag[(pp)->em_opcode - sp_fmnem] & EM_PAR) @@ -26,6 +27,7 @@ C_alloc() arith C_holsize, C_bsssize; int C_holinit, C_bssinit; +int C_out(p) register struct e_instr *p; { @@ -75,8 +77,11 @@ C_out(p) DFDNAM(p->em_dnam); NL(); break; - + default: + C_error = "Illegal EM line"; + return 0; } + return 1; } static diff --git a/modules/src/em_code/em.c b/modules/src/em_code/em.c index cad00d1dd..8f3303809 100644 --- a/modules/src/em_code/em.c +++ b/modules/src/em_code/em.c @@ -70,7 +70,7 @@ C_flush() { return; } #endif - if (C_opp != obuf && sys_write(C_ofp, obuf, C_opp - obuf) == 0) { + if (C_opp != obuf && sys_write(C_ofp, obuf, (int)(C_opp - obuf)) == 0) { C_ofp = 0; C_failed(); } diff --git a/modules/src/em_code/em_code.3X b/modules/src/em_code/em_code.3X index 2ab2ddd53..71f76c487 100644 --- a/modules/src/em_code/em_code.3X +++ b/modules/src/em_code/em_code.3X @@ -66,6 +66,13 @@ emcode \- EM code interface for compilers .B int C_getid() .PP .B char *C_tmpdir; +.PP +.B #include +.PP +.B int C_out(p) +.B struct e_instr *p; +.PP +.B char *C_error; .fi .SH DESCRIPTION This package provides a procedural EM code interface to be used in @@ -437,6 +444,14 @@ The user can change this by just changing .I C_tmpdir before calling .IR C_open. +.PP +.I C_out +accepts a structure as delivered by the +.I read_em +module, and produces code for it. It returns 1 if it succeeds, 0 if it fails +for some reason. The reason can then be found in \fIC_error\fP. The +.I C_out +routine replaces the EM_mkcalls routine. .SH FILES .nf ~em/modules/h/em.h diff --git a/util/led/main.c b/util/led/main.c index 684c44eac..d64dad7d1 100644 --- a/util/led/main.c +++ b/util/led/main.c @@ -70,7 +70,7 @@ do_statistics() while (m <= &mems[NMEMS-1]) { fprintf(stderr, "mem %d: full %lx, free %lx\n", - m - mems, + (int)(m - mems), (long) m->mem_full, (long) m->mem_left); m++;