Added prototyping stuff

This commit is contained in:
ceriel 1993-11-10 11:14:28 +00:00
parent abf052244b
commit 11d4fdf6e0
47 changed files with 529 additions and 143 deletions

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_com(str)
char *str;
{

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_ego(hint, offs, siz, regno)
int hint, regno;
arith offs, siz;

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_emx(wsiz, psiz)
arith wsiz, psiz;
{

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_err()
{
C_mes_begin(ms_err);

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_flt()
{
C_mes_begin(ms_flt);

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_gto()
{
C_mes_begin(ms_gto);

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_opt()
{
C_mes_begin(ms_opt);

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_par(nparams)
arith nparams;
{

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_reg(offs, siz, class, prior)
arith offs, siz;
int class, prior;

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_src(nlines, filnam)
int nlines;
char *filnam;

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_stb_cst(s, e1, e2, e3)
char *s;
int e1, e2;
@ -19,6 +20,7 @@ C_ms_stb_cst(s, e1, e2, e3)
C_mes_end();
}
void
C_ms_stb_dlb(s, e1, e2, l, off)
char *s;
int e1, e2;
@ -33,6 +35,7 @@ C_ms_stb_dlb(s, e1, e2, l, off)
C_mes_end();
}
void
C_ms_stb_dnam(s, e1, e2, l, off)
char *s;
int e1, e2;
@ -47,6 +50,7 @@ C_ms_stb_dnam(s, e1, e2, l, off)
C_mes_end();
}
void
C_ms_stb_ilb(s, e1, e2, l)
char *s;
int e1, e2;
@ -60,6 +64,7 @@ C_ms_stb_ilb(s, e1, e2, l)
C_mes_end();
}
void
C_ms_stb_pnam(s, e1, e2, p)
char *s;
int e1, e2;

View file

@ -6,6 +6,7 @@
#include <em.h>
#include <em_mes.h>
void
C_ms_std(s, e1, l)
char *s;
int e1;

View file

@ -6,65 +6,67 @@ em_mes \- EM-message generating routines
.nf
.B #include <em.h>
.PP
.B C_ms_err()
.B void C_ms_err()
.PP
.B C_ms_opt()
.B void C_ms_opt()
.PP
.B C_ms_emx(wsiz, psiz)
.B void C_ms_emx(wsiz, psiz)
.B arith wsiz, psiz;
.PP
.B #include <em_reg.h>
.B C_ms_reg(offs, siz, class, prior)
.B void C_ms_reg(offs, siz, class, prior)
.B arith offs, siz;
.B int class, prior;
.PP
.B C_ms_src(nlines, filnam)
.B void C_ms_src(nlines, filnam)
.B int nlines;
.B char *filnam;
.PP
.B C_ms_flt()
.B void C_ms_flt()
.PP
.B C_ms_com(str)
.B void C_ms_com(str)
.B char *str;
.PP
.B C_ms_par(nparams)
.B void C_ms_par(nparams)
.B arith nparams;
.PP
.B #include <em_ego.h>
.B C_ms_ego(hint, offs, siz, regno)
.B void C_ms_ego(hint, offs, siz, regno)
.B int hint, regno;
.B arith offs, siz;
.PP
.B C_ms_gto()
.B void C_ms_gto()
.PP
.B C_ms_stb_cst(s, e1, e2, e3)
.B void C_ms_stb_cst(s, e1, e2, e3)
.B char *s;
.B int e1, e2;
.B arith e3;
.PP
.B C_ms_stb_dlb(s, e1, e2, l, off)
.B void C_ms_stb_dlb(s, e1, e2, l, off)
.B char *s;
.B int e1, e2;
.B label l;
.B arith off;
.PP
.B C_ms_stb_dnam(s, e1, e2, l, off)
.B void C_ms_stb_dnam(s, e1, e2, l, off)
.B char *s;
.B int e1, e2;
.B char *l;
.B arith off;
.PP
.B C_ms_stb_ilb(s, e1, e2, l)
.B void C_ms_stb_ilb(s, e1, e2, l)
.B char *s;
.B int e1, e2;
.B label l;
.PP
.B C_ms_stb_pnam(s, e1, e2, p)
.B void C_ms_stb_pnam(s, e1, e2, p)
.B char *s;
.B int e1, e2;
.B char *p;
.PP
.B C_ms_lin(l)
.B void C_ms_std(s, e1, l)
.B char *s;
.B int e1;
.B int l;
.fi
.SH DESCRIPTION
@ -157,7 +159,7 @@ can be invoked to indicate that a procedure uses a non-local goto.
The
.B C_ms_stb
and
.B C_ms_lin
.B C_ms_std
routines produce a message that a back-end can use for (debugger) symbol table
entries.
.SH FILES
@ -173,8 +175,7 @@ em_code(3)
em_code(3), read_em(3)
.SH DIAGNOSTICS
None of the functions return a value.
.SH BUGS
The
.SH REMARKS
There is no
.BR C_ms_ext ()
routine has not yet been implemented, since this message uses
a variable number of arguments.
routine, since this message uses a variable number of arguments.

View file

@ -45,13 +45,13 @@ libem_mesCE.$(LIBSUF):
rm -f *.$(SUF)
install: all
-mkdir $(MOD_DIR)/lib
cp libem_mes.$(LIBSUF) $(MOD_DIR)/lib/libem_mes.$(LIBSUF)
cp libem_mesCE.$(LIBSUF) $(MOD_DIR)/lib/libem_mesCE.$(LIBSUF)
cp libem_mesO.$(LIBSUF) $(MOD_DIR)/lib/libem_mesO.$(LIBSUF)
$(RANLIB) $(MOD_DIR)/lib/libem_mes.$(LIBSUF)
$(RANLIB) $(MOD_DIR)/lib/libem_mesCE.$(LIBSUF)
$(RANLIB) $(MOD_DIR)/lib/libem_mesO.$(LIBSUF)
cp $(SRC_DIR)/em_mes.3 $(MOD_DIR)/man/em_mes.3
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/em_mes.3 $(TARGET_HOME) ; \
fi
@ -60,7 +60,6 @@ cmp: all
-cmp libem_mes.$(LIBSUF) $(MOD_DIR)/lib/libem_mes.$(LIBSUF)
-cmp libem_mesCE.$(LIBSUF) $(MOD_DIR)/lib/libem_mesCE.$(LIBSUF)
-cmp libem_mesO.$(LIBSUF) $(MOD_DIR)/lib/libem_mesO.$(LIBSUF)
-cmp $(SRC_DIR)/em_mes.3 $(MOD_DIR)/man/em_mes.3
pr:
@pr $(SRC_DIR)/proto.make $(SRC)

View file

@ -16,3 +16,4 @@ parser.h
patterns
pseudo.r
syntax.l
em_codeO.h

View file

@ -16,12 +16,14 @@ OO_rotate(w,amount)
return(((w<<amount)&highmask) | ((w >> (8*OO_WSIZE-amount))&lowmask));
}
int
OO_signsame(a,b)
arith a, b;
{
return( (a ^ b) >= 0);
}
int
OO_sfit(val,nbits)
arith val, nbits;
{
@ -29,12 +31,14 @@ OO_sfit(val,nbits)
return(((val&mask) == 0) | (val&mask)==mask);
}
int
OO_ufit(val, nbits)
arith val, nbits;
{
return((val&(~((1L << (nbits - 1)) - 1))) == 0);
}
int
OO_extsame(a1,a2)
register p_instr a1, a2;
{
@ -57,6 +61,7 @@ OO_extsame(a1,a2)
}
}
int
OO_namsame(a1,a2)
register p_instr a1, a2;
{

View file

@ -0,0 +1,270 @@
#define C_insertpart O_insertpart
#define C_beginpart O_beginpart
#define C_endpart O_endpart
#define C_aar O_aar
#define C_aar_narg O_aar_narg
#define C_adf O_adf
#define C_adf_narg O_adf_narg
#define C_adi O_adi
#define C_adi_narg O_adi_narg
#define C_adp O_adp
#define C_ads O_ads
#define C_ads_narg O_ads_narg
#define C_adu O_adu
#define C_adu_narg O_adu_narg
#define C_and O_and
#define C_and_narg O_and_narg
#define C_asp O_asp
#define C_ass O_ass
#define C_ass_narg O_ass_narg
#define C_beq O_beq
#define C_bge O_bge
#define C_bgt O_bgt
#define C_ble O_ble
#define C_blm O_blm
#define C_bls O_bls
#define C_bls_narg O_bls_narg
#define C_blt O_blt
#define C_bne O_bne
#define C_bra O_bra
#define C_bss_cst O_bss_cst
#define C_bss_fcon O_bss_fcon
#define C_bss_pnam O_bss_pnam
#define C_bss_ucon O_bss_ucon
#define C_cai O_cai
#define C_cal O_cal
#define C_cff O_cff
#define C_cfi O_cfi
#define C_cfu O_cfu
#define C_cif O_cif
#define C_cii O_cii
#define C_ciu O_ciu
#define C_close O_close
#define C_cmf O_cmf
#define C_cmf_narg O_cmf_narg
#define C_cmi O_cmi
#define C_cmi_narg O_cmi_narg
#define C_cmp O_cmp
#define C_cms O_cms
#define C_cms_narg O_cms_narg
#define C_cmu O_cmu
#define C_cmu_narg O_cmu_narg
#define C_com O_com
#define C_com_narg O_com_narg
#define C_con_cst O_con_cst
#define C_con_fcon O_con_fcon
#define C_con_pnam O_con_pnam
#define C_con_scon O_con_scon
#define C_con_ucon O_con_ucon
#define C_csa O_csa
#define C_csa_narg O_csa_narg
#define C_csb O_csb
#define C_csb_narg O_csb_narg
#define C_cst O_cst
#define C_cuf O_cuf
#define C_cui O_cui
#define C_cuu O_cuu
#define C_dch O_dch
#define C_dec O_dec
#define C_dee O_dee
#define C_del O_del
#define C_df_dlb O_df_dlb
#define C_df_dnam O_df_dnam
#define C_df_ilb O_df_ilb
#define C_dlb O_dlb
#define C_dnam O_dnam
#define C_dup O_dup
#define C_dus O_dus
#define C_dus_narg O_dus_narg
#define C_dvf O_dvf
#define C_dvf_narg O_dvf_narg
#define C_dvi O_dvi
#define C_dvi_narg O_dvi_narg
#define C_dvu O_dvu
#define C_dvu_narg O_dvu_narg
#define C_end O_end
#define C_end_narg O_end_narg
#define C_exc O_exc
#define C_exg O_exg
#define C_exg_narg O_exg_narg
#define C_exp O_exp
#define C_fcon O_fcon
#define C_fef O_fef
#define C_fef_narg O_fef_narg
#define C_fif O_fif
#define C_fif_narg O_fif_narg
#define C_fil O_fil
#define C_gto O_gto
#define C_hol_cst O_hol_cst
#define C_hol_fcon O_hol_fcon
#define C_hol_pnam O_hol_pnam
#define C_hol_ucon O_hol_ucon
#define C_icon O_icon
#define C_ilb O_ilb
#define C_inc O_inc
#define C_ine O_ine
#define C_init O_init
#define C_inl O_inl
#define C_inn O_inn
#define C_inn_narg O_inn_narg
#define C_inp O_inp
#define C_ior O_ior
#define C_ior_narg O_ior_narg
#define C_lae O_lae
#define C_lal O_lal
#define C_lar O_lar
#define C_lar_narg O_lar_narg
#define C_ldc O_ldc
#define C_lde O_lde
#define C_ldf O_ldf
#define C_ldl O_ldl
#define C_lfr O_lfr
#define C_lil O_lil
#define C_lim O_lim
#define C_lin O_lin
#define C_lni O_lni
#define C_loc O_loc
#define C_loe O_loe
#define C_lof O_lof
#define C_loi O_loi
#define C_lol O_lol
#define C_lor O_lor
#define C_los O_los
#define C_los_narg O_los_narg
#define C_lpb O_lpb
#define C_lpi O_lpi
#define C_lxa O_lxa
#define C_lxl O_lxl
#define C_magic O_magic
#define C_mes_begin O_mes_begin
#define C_mes_end O_mes_end
#define C_mlf O_mlf
#define C_mlf_narg O_mlf_narg
#define C_mli O_mli
#define C_mli_narg O_mli_narg
#define C_mlu O_mlu
#define C_mlu_narg O_mlu_narg
#define C_mon O_mon
#define C_ngf O_ngf
#define C_ngf_narg O_ngf_narg
#define C_ngi O_ngi
#define C_ngi_narg O_ngi_narg
#define C_nop O_nop
#define C_open O_open
#define C_pnam O_pnam
#define C_pro O_pro
#define C_pro_narg O_pro_narg
#define C_rck O_rck
#define C_rck_narg O_rck_narg
#define C_ret O_ret
#define C_rmi O_rmi
#define C_rmi_narg O_rmi_narg
#define C_rmu O_rmu
#define C_rmu_narg O_rmu_narg
#define C_rol O_rol
#define C_rol_narg O_rol_narg
#define C_rom_cst O_rom_cst
#define C_rom_fcon O_rom_fcon
#define C_rom_pnam O_rom_pnam
#define C_rom_scon O_rom_scon
#define C_rom_ucon O_rom_ucon
#define C_ror O_ror
#define C_ror_narg O_ror_narg
#define C_rtt O_rtt
#define C_sar O_sar
#define C_sar_narg O_sar_narg
#define C_sbf O_sbf
#define C_sbf_narg O_sbf_narg
#define C_sbi O_sbi
#define C_sbi_narg O_sbi_narg
#define C_sbs O_sbs
#define C_sbs_narg O_sbs_narg
#define C_sbu O_sbu
#define C_sbu_narg O_sbu_narg
#define C_scon O_scon
#define C_sde O_sde
#define C_sdf O_sdf
#define C_sdl O_sdl
#define C_set O_set
#define C_set_narg O_set_narg
#define C_sig O_sig
#define C_sil O_sil
#define C_sim O_sim
#define C_sli O_sli
#define C_sli_narg O_sli_narg
#define C_slu O_slu
#define C_slu_narg O_slu_narg
#define C_sri O_sri
#define C_sri_narg O_sri_narg
#define C_sru O_sru
#define C_sru_narg O_sru_narg
#define C_ste O_ste
#define C_stf O_stf
#define C_sti O_sti
#define C_stl O_stl
#define C_str O_str
#define C_sts O_sts
#define C_sts_narg O_sts_narg
#define C_teq O_teq
#define C_tge O_tge
#define C_tgt O_tgt
#define C_tle O_tle
#define C_tlt O_tlt
#define C_tne O_tne
#define C_trp O_trp
#define C_ucon O_ucon
#define C_xor O_xor
#define C_xor_narg O_xor_narg
#define C_zeq O_zeq
#define C_zer O_zer
#define C_zer_narg O_zer_narg
#define C_zge O_zge
#define C_zgt O_zgt
#define C_zle O_zle
#define C_zlt O_zlt
#define C_zne O_zne
#define C_zre O_zre
#define C_zrf O_zrf
#define C_zrf_narg O_zrf_narg
#define C_zrl O_zrl
#define C_hol_ilb O_hol_ilb
#define C_bss_dnam O_bss_dnam
#define C_bss_dlb O_bss_dlb
#define C_bss_icon O_bss_icon
#define C_bss_ilb O_bss_ilb
#define C_con_dnam O_con_dnam
#define C_con_dlb O_con_dlb
#define C_con_icon O_con_icon
#define C_con_ilb O_con_ilb
#define C_gto_dnam O_gto_dnam
#define C_lae_dnam O_lae_dnam
#define C_gto_dlb O_gto_dlb
#define C_ine_dnam O_ine_dnam
#define C_ine_dlb O_ine_dlb
#define C_rom_dnam O_rom_dnam
#define C_rom_dlb O_rom_dlb
#define C_ina_dnam O_ina_dnam
#define C_ina_dlb O_ina_dlb
#define C_rom_icon O_rom_icon
#define C_rom_ilb O_rom_ilb
#define C_ste_dnam O_ste_dnam
#define C_lae_dlb O_lae_dlb
#define C_ste_dlb O_ste_dlb
#define C_fil_dnam O_fil_dnam
#define C_fil_dlb O_fil_dlb
#define C_lde_dnam O_lde_dnam
#define C_lde_dlb O_lde_dlb
#define C_loe_dnam O_loe_dnam
#define C_loe_dlb O_loe_dlb
#define C_exa_dnam O_exa_dnam
#define C_exa_dlb O_exa_dlb
#define C_dee_dnam O_dee_dnam
#define C_sde_dnam O_sde_dnam
#define C_dee_dlb O_dee_dlb
#define C_sde_dlb O_sde_dlb
#define C_zre_dnam O_zre_dnam
#define C_zre_dlb O_zre_dlb
#define C_hol_dnam O_hol_dnam
#define C_hol_dlb O_hol_dlb
#define C_hol_icon O_hol_icon

View file

@ -7,61 +7,61 @@ emopt \- EM code peephole optimizer interface for compilers
.B #define PEEPHOLE
.B #include <em.h>
.PP
.B O_init(wsize, psize)
.B void O_init(wsize, psize)
.B arith wsize, psize;
.PP
.B int O_open(filename)
.B O_close()
.B void O_close()
.B int O_busy()
.B char *filename;
.PP
.B O_magic()
.B void O_magic()
.PP
.B O_df_dlb(l)
.B O_df_dnam(s)
.B O_df_ilb(l)
.B void O_df_dlb(l)
.B void O_df_dnam(s)
.B void O_df_ilb(l)
.B label l; char *s;
.PP
.B O_pro(s, l)
.B O_pro_narg(s)
.B O_end(l)
.B O_end_narg()
.B void O_pro(s, l)
.B void O_pro_narg(s)
.B void O_end(l)
.B void O_end_narg()
.B char *s; arith l;
.PP
.B O_exa_dlb(l)
.B O_exa_dnam(s)
.B O_exp(s)
.B O_ina_dlb(l)
.B O_ina_dnam(s)
.B O_inp(s)
.B void O_exa_dlb(l)
.B void O_exa_dnam(s)
.B void O_exp(s)
.B void O_ina_dlb(l)
.B void O_ina_dnam(s)
.B void O_inp(s)
.B char *s; label l;
.PP
.BI O_bss_ cstp ()
.BI O_hol_ cstp ()
.BI O_con_ cstp ()
.BI O_rom_ cstp ()
.BI "void O_bss_" cstp ()
.BI "void O_hol_" cstp ()
.BI "void O_con_" cstp ()
.BI "void O_rom_" cstp ()
.PP
.B #include <em_mes.h>
.B O_mes_begin(ms)
.BI O_ cstp ()
.B O_mes_end()
.B void O_mes_begin(ms)
.BI "void O_" cstp ()
.B void O_mes_end()
.B int ms;
.PP
.B O_exc(c1, c2)
.B void O_exc(c1, c2)
.B arith c1, c2;
.PP
.BI O_ mnem ()
.BI O_ mnem _dlb()
.BI O_ mnem _dnam()
.BI O_ mnem _narg()
.BI "void O_" mnem ()
.BI "void O_" mnem _dlb()
.BI "void O_" mnem _dnam()
.BI "void O_" mnem _narg()
.PP
.B O_insertpart(id)
.B void O_insertpart(id)
.B int id;
.PP
.B O_beginpart(id)
.B void O_beginpart(id)
.B int id;
.PP
.B O_endpart(id)
.B void O_endpart(id)
.B int id;
.fi
.SH DESCRIPTION

View file

@ -6,6 +6,9 @@ static char rcsidp3[] = "$Header$";
#define UPDATEWORST(backups) if(backups>mostbackups) mostbackups = backups;
PRIVATE int leftmatch();
PRIVATE int rightmatch();
findworst(patt,repl)
struct mnems patt,repl;
{

View file

@ -13,6 +13,8 @@ static char rcsidp2[] = "$Header$";
extern char em_flag[];
extern char em_mnem[][4];
PRIVATE idinit();
initlex()
{
register int i,j;

View file

@ -2,6 +2,7 @@ BEGIN {
FS = "|";
seenproc = 0;
CC="${CMD}"
if (prototypes == "") prototypes = "prototypes"
}
/^%/ {}
/^$/ {}
@ -18,7 +19,8 @@ BEGIN {
nam = $1
printf "cat > O_%s.c << '--EOF--'\n",$1
print "#include \"nopt.h\""
printf "O_%s(",$1
printf "void O_%s(",$1
prototype = "_PROTOTYPE(void O_" $1 ", ("
nparms = split($2,parms,":");
for(p=1;p<nparms;p++) {
if(p!=1) {
@ -28,16 +30,23 @@ BEGIN {
printf a[1]
}
printf ")\n"
if(nparms) {
if(nparms > 1) {
prototype = prototype parms[1]
printf "\t%s",parms[1]
}
else {
prototype = prototype "void"
}
for(p=1;p<nparms;p++) {
split(parms[p+1],a," ")
prototype = prototype " " a[1]
printf " %s;\n",a[1]
if(a[2]) {
prototype = prototype ", " a[2] a[3] a[4]
printf "\t%s%s%s",a[2],a[3],a[4]
}
}
print prototype "));" >> prototypes
if($3) {
printf "{\n\t%s\n",$3
}

View file

@ -4,6 +4,7 @@ static char rcsid3[] = "$Header$";
#include "nopt.h"
void
EM_mkop(p,opcode)
register p_instr p;
int opcode;
@ -13,6 +14,7 @@ EM_mkop(p,opcode)
p->em_argtype = 0;
}
void
EM_mknarg(p,opcode)
register p_instr p;
int opcode;
@ -23,6 +25,7 @@ EM_mknarg(p,opcode)
p->em_cst = 0;
}
void
EM_mkilb(p,opcode,lab)
register p_instr p;
int opcode;
@ -34,6 +37,7 @@ EM_mkilb(p,opcode,lab)
p->em_ilb = lab;
}
void
EM_mknof(p,opcode,lab,off)
register p_instr p;
int opcode;
@ -47,6 +51,7 @@ EM_mknof(p,opcode,lab,off)
p->em_off = off;
}
void
EM_mksof(p,opcode,name,off)
register p_instr p;
int opcode;
@ -60,6 +65,7 @@ EM_mksof(p,opcode,name,off)
p->em_off = off;
}
void
EM_mkcst(p,opcode,cst)
register p_instr p;
int opcode;
@ -71,6 +77,7 @@ EM_mkcst(p,opcode,cst)
p->em_cst = cst;
}
void
EM_mkpro(p,opcode,pnam)
register p_instr p;
int opcode;
@ -82,6 +89,7 @@ EM_mkpro(p,opcode,pnam)
p->em_pnam = OO_freestr(pnam);
}
void
EM_mkdefilb(p,opcode,deflb)
register p_instr p;
int opcode;
@ -93,6 +101,7 @@ EM_mkdefilb(p,opcode,deflb)
p->em_ilb = deflb;
}
void
EM_Nop(opcode)
int opcode;
{
@ -102,6 +111,7 @@ EM_Nop(opcode)
p->em_argtype = 0;
}
void
EM_Nnarg(opcode)
int opcode;
{
@ -112,6 +122,7 @@ EM_Nnarg(opcode)
p->em_cst = 0;
}
void
EM_Nilb(opcode,lab)
int opcode;
label lab;
@ -123,6 +134,7 @@ EM_Nilb(opcode,lab)
p->em_ilb = lab;
}
void
EM_Nnof(opcode,lab,off)
int opcode;
label lab;
@ -136,6 +148,7 @@ EM_Nnof(opcode,lab,off)
p->em_off = off;
}
void
EM_Nsof(opcode,name,off)
int opcode;
char *name;
@ -149,6 +162,7 @@ EM_Nsof(opcode,name,off)
p->em_off = off;
}
void
EM_Ncst(opcode,cst)
int opcode;
arith cst;
@ -160,6 +174,7 @@ EM_Ncst(opcode,cst)
p->em_cst = cst;
}
void
EM_Npro(opcode,pnam)
int opcode;
char *pnam;
@ -171,6 +186,7 @@ EM_Npro(opcode,pnam)
p->em_pnam = OO_freestr(pnam);
}
void
EM_Ndefilb(opcode,deflb)
int opcode;
label deflb;
@ -182,6 +198,7 @@ EM_Ndefilb(opcode,deflb)
p->em_ilb = deflb;
}
void
EM_Rop(opcode)
int opcode;
{
@ -191,6 +208,7 @@ EM_Rop(opcode)
p->em_argtype = 0;
}
void
EM_Rnarg(opcode)
int opcode;
{
@ -201,6 +219,7 @@ EM_Rnarg(opcode)
p->em_cst = 0;
}
void
EM_Rilb(opcode,lab)
int opcode;
label lab;
@ -212,6 +231,7 @@ EM_Rilb(opcode,lab)
p->em_ilb = lab;
}
void
EM_Rnof(opcode,lab,off)
int opcode;
label lab;
@ -225,6 +245,7 @@ EM_Rnof(opcode,lab,off)
p->em_off = off;
}
void
EM_Rsof(opcode,name,off)
int opcode;
char *name;
@ -238,6 +259,7 @@ EM_Rsof(opcode,name,off)
p->em_off = off;
}
void
EM_Rcst(opcode,cst)
int opcode;
arith cst;
@ -249,6 +271,7 @@ EM_Rcst(opcode,cst)
p->em_cst = cst;
}
void
EM_Rpro(opcode,pnam)
int opcode;
char *pnam;
@ -260,6 +283,7 @@ EM_Rpro(opcode,pnam)
p->em_pnam = OO_freestr(pnam);
}
void
EM_Rdefilb(opcode,deflb)
int opcode;
label deflb;

View file

@ -46,6 +46,9 @@ int OO_wrstats = 1; /* pattern statistics output */
**************************/
#define BTSCPY(pp,qq,i,p,q,n) for(pp=(p),qq=(q),i=(n);i--;*pp++ = *qq++)
PRIVATE void allocmem();
void
O_init(wsize,psize)
arith wsize, psize;
{
@ -56,6 +59,7 @@ O_init(wsize,psize)
OO_PSIZE = psize;
}
int
O_open(fname)
char *fname;
{
@ -63,16 +67,19 @@ O_open(fname)
return(C_open(fname));
}
void
O_magic()
{
C_magic();
}
void
O_close()
{
C_close();
}
void
OO_dfa(last)
register int last;
{
@ -100,7 +107,7 @@ OO_dfa(last)
}
}
PRIVATE
PRIVATE void
fatal(s,a)
char *s;
int a;
@ -111,7 +118,7 @@ fatal(s,a)
sys_stop(S_EXIT);
}
PRIVATE
PRIVATE void
allocmem()
{
/* Allocate memory for queues on heap */
@ -151,6 +158,7 @@ OO_freestr(str)
return(res);
}
void
OO_flush()
{
/*
@ -197,6 +205,7 @@ OO_halfflush()
return (OO_nxtpatt++);
}
void
OO_mkext(p,opcode,arg,off)
register p_instr p;
int opcode;
@ -218,6 +227,7 @@ OO_mkext(p,opcode,arg,off)
}
}
void
OO_mkrepl(lrepl,diff,numbkup)
int lrepl,diff,numbkup;
{
@ -264,6 +274,7 @@ OO_mkrepl(lrepl,diff,numbkup)
}
#ifdef DEBUG
void
dumpstate(mess)
char *mess;
{
@ -283,6 +294,7 @@ dumpstate(mess)
fprintf(stderr,"\n");
}
void
prtinst(p)
p_instr p;
{

View file

@ -11,6 +11,7 @@
#include <em_comp.h>
#include <system.h>
#include <emO_code.h>
#include <ansi.h>
#define MAXBUFFER 200
#define MAXSTRING 1000
@ -52,13 +53,53 @@ extern arith OO_PSIZE; /* pointer length */
extern int OO_wrstats; /* statistics output */
#endif
extern char *OO_freestr();
extern arith OO_rotate();
extern arith OO_offset();
#define CST(p) (p.em_cst)
#define PNAM(p) (p.em_pnam)
#define LAB(p) (p.em_ilb)
#define DEFILB(p) (p.em_ilb)
#define DEFINED(p) (p.em_argtype)
_PROTOTYPE(void EM_mkop, (p_instr, int));
_PROTOTYPE(void EM_mknarg, (p_instr, int));
_PROTOTYPE(void EM_mkilb, (p_instr, int, label));
_PROTOTYPE(void EM_mknof, (p_instr, int, label, arith));
_PROTOTYPE(void EM_mksof, (p_instr, int, char *, arith));
_PROTOTYPE(void EM_mkcst, (p_instr, int, arith));
_PROTOTYPE(void EM_mkpro, (p_instr, int, char *));
_PROTOTYPE(void EM_mkdefilb, (p_instr, int, label));
_PROTOTYPE(void EM_Nop, (int));
_PROTOTYPE(void EM_Nnarg, (int));
_PROTOTYPE(void EM_Nilb, (int, label));
_PROTOTYPE(void EM_Nnof, (int, label, arith));
_PROTOTYPE(void EM_Nsof, (int, char *, arith));
_PROTOTYPE(void EM_Ncst, (int, arith));
_PROTOTYPE(void EM_Npro, (int, char *));
_PROTOTYPE(void EM_Ndefilb, (int, label));
_PROTOTYPE(void EM_Rop, (int));
_PROTOTYPE(void EM_Rnarg, (int));
_PROTOTYPE(void EM_Rilb, (int, label));
_PROTOTYPE(void EM_Rnof, (int, label, arith));
_PROTOTYPE(void EM_Rsof, (int, char *, arith));
_PROTOTYPE(void EM_Rcst, (int, arith));
_PROTOTYPE(void EM_Rpro, (int, char *));
_PROTOTYPE(void EM_Rdefilb, (int, label));
_PROTOTYPE(arith OO_rotate, (arith, arith));
_PROTOTYPE(int OO_signsame, (arith, arith));
_PROTOTYPE(int OO_sfit, (arith, arith));
_PROTOTYPE(int OO_ufit, (arith, arith));
_PROTOTYPE(int OO_extsame, (p_instr, p_instr));
_PROTOTYPE(int OO_namsame, (p_instr, p_instr));
_PROTOTYPE(arith OO_offset, (p_instr));
_PROTOTYPE(char *OO_freestr, (char *));
_PROTOTYPE(void OO_dfa, (int));
_PROTOTYPE(void OO_flush, (void));
_PROTOTYPE(p_instr OO_halfflush, (void));
_PROTOTYPE(void OO_mkext, (p_instr, int, p_instr, arith));
_PROTOTYPE(void OO_mkrepl, (int, int, int));
#ifdef DEBUG
_PROTOTYPE(void dumpstate, (char *));
_PROTOTYPE(void prtinst, (p_instr));
#endif

View file

@ -7,6 +7,19 @@ static char rcsidp5[] = "$Header$";
FILE *ofile;
PRIVATE openofile();
PRIVATE installofile();
PRIVATE UNLINK();
PRIVATE RENAME();
PRIVATE outdfa();
PRIVATE outmnems();
PRIVATE outdotrans();
PRIVATE outoneaction();
PRIVATE outrepl();
PRIVATE outexp();
PRIVATE outext();
PRIVATE outop();
outputnopt()
{
openofile("dfa.c");

View file

@ -33,7 +33,7 @@ LIBCEOPT = libCEopt.$(LIBSUF)
.SUFFIXES: .d .r
.r.d: ; CMD=$(CMD); export CMD; awk -f $(SRC_DIR)/makefuns.awk $*.r | sh -x
.r.d: ; CMD=$(CMD); export CMD; awk -f $(SRC_DIR)/makefuns.awk prototypes=/dev/null $*.r | sh -x
touch $@
.SUFFIXES: .$(SUF)
@ -57,15 +57,17 @@ GENFILES = Lpars.h Lpars.c parserdummy parser.c syntax.c \
dfa.c dfa.c.new trans.c trans.c.new\
incalls.d incalls.r incalls.r.new pseudo.d pseudo.r
all: em_nopt $(LIBOPT) $(LIBCEOPT)
all: em_nopt $(LIBOPT) $(LIBCEOPT) prototypes
install: all
-mkdir $(MOD_DIR)/lib
-mkdir $(MOD_DIR)/h
cp $(LIBOPT) $(MOD_DIR)/lib/$(LIBOPT)
$(RANLIB) $(MOD_DIR)/lib/$(LIBOPT)
cp $(LIBCEOPT) $(MOD_DIR)/lib/$(LIBCEOPT)
$(RANLIB) $(MOD_DIR)/lib/$(LIBCEOPT)
cp $(SRC_DIR)/em_opt.3 $(MOD_DIR)/man/em_opt.3
cp em_nopt $(TARGET_HOME)/lib.bin/em_nopt
cp prototypes $(MOD_DIR)/h/em_codeO.h
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/em_opt.3 $(TARGET_HOME) ; \
mk_manpage $(SRC_DIR)/em_nopt.6 $(TARGET_HOME) ; \
@ -75,7 +77,8 @@ cmp: all
-cmp $(LIBOPT) $(MOD_DIR)/lib/$(LIBOPT)
-cmp $(LIBCEOPT) $(MOD_DIR)/lib/$(LIBCEOPT)
-cmp em_nopt $(TARGET_HOME)/lib.bin/em_nopt
-cmp $(SRC_DIR)/em_opt.3 $(MOD_DIR)/man/em_opt.3
-cmp prototypes $(MOD_DIR)/h/em_codeO.h
pr:
@pr $(SRCS)
@ -88,7 +91,7 @@ lint: lintparser lintnopt
clean:
rm -f O_*.$(SUF)
rm -f O_*.c
rm -f $(NOFILES) main.$(SUF) $(POFILES)
rm -f $(NOFILES) main.$(SUF) $(POFILES) prototypes
rm -f $(GENFILES) parser em_nopt $(LIBOPT) $(LIBCEOPT)
# How to build stand alone version of the optimizer
@ -132,6 +135,11 @@ $(LIBCEOPT): incalls.r
-mv $(LIBOPT).saved $(LIBOPT)
rm -f O_*.$(SUF) $(NOFILES)
prototypes: pseudo.r incalls.r
cp $(SRC_DIR)/em_codeO.h prototypes
echo >> prototypes
awk -f $(SRC_DIR)/makefuns.awk pseudo.r incalls.r > /dev/null
incalls.r: $(SRC_DIR)/patterns parser
-$(UTIL_HOME)/lib.bin/cpp $(SRC_DIR)/patterns | $(HOWMUCH) >/tmp/patts
parser </tmp/patts

View file

@ -5,7 +5,7 @@
/* $Header$ */
# include "flt_misc.h"
#include "flt_misc.h"
int
flt_b64_add(e1,e2)

View file

@ -7,9 +7,7 @@
#include "flt_misc.h"
#if __STDC__ > 0
void
#endif
flt_b64_sft(e,n)
register struct flt_mantissa *e;
register int n;

View file

@ -7,9 +7,7 @@
#include "flt_misc.h"
#if __STDC__ > 0
void
#endif
flt_add(e1,e2,e3)
register flt_arith *e1,*e2,*e3;
{
@ -77,9 +75,7 @@ flt_add(e1,e2,e3)
flt_chk(e3);
}
#if __STDC__ > 0
void
#endif
flt_sub(e1,e2,e3)
flt_arith *e1,*e2,*e3;
{

View file

@ -8,9 +8,7 @@
#include "flt_misc.h"
#include <em_arith.h>
#if __STDC__ > 0
void
#endif
flt_arith2flt(n, e, uns)
register arith n;
register flt_arith *e;

View file

@ -28,32 +28,32 @@ extern int flt_status;
#define FLT_STRLEN 32
.PP
.B flt_add(e1, e2, e3)
.B void flt_add(e1, e2, e3)
.B flt_arith *e1, *e2, *e3;
.PP
.B flt_mul(e1, e2, e3)
.B void flt_mul(e1, e2, e3)
.B flt_arith *e1, *e2, *e3;
.PP
.B flt_sub(e1, e2, e3)
.B void flt_sub(e1, e2, e3)
.B flt_arith *e1, *e2, *e3;
.PP
.B flt_div(e1, e2, e3)
.B void flt_div(e1, e2, e3)
.B flt_arith *e1, *e2, *e3;
.PP
.B flt_umin(e)
.B void flt_umin(e)
.B flt_arith *e;
.PP
.B flt_modf(e1, intpart, fractpart)
.B void flt_modf(e1, intpart, fractpart)
.B flt_arith *e1, *intpart, *fractpart;
.PP
.B int flt_cmp(e1, e2)
.B flt_arith *e1, *e2;
.PP
.B flt_str2flt(s, e)
.B void flt_str2flt(s, e)
.B char *s;
.B flt_arith *e;
.PP
.B flt_flt2str(e, buf, bufsize)
.B void flt_flt2str(e, buf, bufsize)
.B flt_arith *e;
.B char *buf;
.B int bufsize;
@ -61,7 +61,7 @@ extern int flt_status;
.B int flt_status;
.PP
.B #include <em_arith.h>
.B flt_arith2flt(n, e, uns)
.B void flt_arith2flt(n, e, uns)
.B arith n;
.B flt_arith *e;
.B int uns;
@ -70,7 +70,7 @@ extern int flt_status;
.B flt_arith *e;
.B int uns;
.PP
.B flt_b64_sft(m, n)
.B void flt_b64_sft(m, n)
.B struct flt_mantissa *m;
.B int n;
.SH DESCRIPTION

View file

@ -7,6 +7,8 @@
#ifndef __FLT_INCLUDED__
#define __FLT_INCLUDED__
#include "ansi.h"
#ifndef arith
#define arith long
#endif
@ -31,20 +33,17 @@ extern int flt_status;
#define FLT_STRLEN 32 /* max length of result of flt_flt2str() */
#if __STDC__ > 0
void flt_add(flt_arith *, flt_arith *, flt_arith *);
void flt_sub(flt_arith *, flt_arith *, flt_arith *);
void flt_mul(flt_arith *, flt_arith *, flt_arith *);
void flt_div(flt_arith *, flt_arith *, flt_arith *);
void flt_modf(flt_arith *, flt_arith *, flt_arith *);
int flt_cmp(flt_arith *, flt_arith *);
void flt_str2flt(char *, flt_arith *);
void flt_flt2str(flt_arith *, char *, int);
void flt_arith2flt(arith, flt_arith *, int);
arith flt_flt2arith(flt_arith *, int);
void flt_b64_sft(struct flt_mantissa *, int);
void flt_umin(flt_arith *);
#else
arith flt_flt2arith();
#endif
_PROTOTYPE(void flt_add, (flt_arith *, flt_arith *, flt_arith *));
_PROTOTYPE(void flt_sub, (flt_arith *, flt_arith *, flt_arith *));
_PROTOTYPE(void flt_mul, (flt_arith *, flt_arith *, flt_arith *));
_PROTOTYPE(void flt_div, (flt_arith *, flt_arith *, flt_arith *));
_PROTOTYPE(void flt_modf, (flt_arith *, flt_arith *, flt_arith *));
_PROTOTYPE(int flt_cmp, (flt_arith *, flt_arith *));
_PROTOTYPE(void flt_str2flt, (char *, flt_arith *));
_PROTOTYPE(void flt_flt2str, (flt_arith *, char *, int));
_PROTOTYPE(void flt_arith2flt, (arith, flt_arith *, int));
_PROTOTYPE(arith flt_flt2arith, (flt_arith *, int));
_PROTOTYPE(void flt_b64_sft, (struct flt_mantissa *, int));
_PROTOTYPE(void flt_umin, (flt_arith *));
#endif /* __FLT_INCLUDED__ */

View file

@ -8,9 +8,8 @@
#include "flt_misc.h"
int flt_status = 0;
#if __STDC__ > 0
void
#endif
flt_chk(e)
register flt_arith *e;
{

View file

@ -5,7 +5,7 @@
/* $Header$ */
#include "flt_misc.h"
#include "flt_misc.h"
int
flt_cmp(e1, e2)

View file

@ -6,9 +6,8 @@
/* $Header$ */
#include "flt_misc.h"
#if __STDC__ > 0
void
#endif
flt_div(e1,e2,e3)
register flt_arith *e1,*e2,*e3;
{

View file

@ -21,10 +21,8 @@
#define flt_b64_add _flt_64add
#define flt_split _flt_split
#if __STDC__ > 0
int ucmp(long, long);
void flt_nrm(flt_arith *);
void flt_chk(flt_arith *);
int flt_b64_add(struct flt_mantissa *, struct flt_mantissa *);
void flt_split(flt_arith *, unsigned short *);
#endif
_PROTOTYPE(int ucmp, (long, long));
_PROTOTYPE(void flt_nrm, (flt_arith *));
_PROTOTYPE(void flt_chk, (flt_arith *));
_PROTOTYPE(int flt_b64_add, (struct flt_mantissa *, struct flt_mantissa *));
_PROTOTYPE(void flt_split, (flt_arith *, unsigned short *));

View file

@ -6,9 +6,8 @@
/* $Header$ */
#include "flt_misc.h"
#if __STDC__ > 0
void
#endif
flt_modf(e, ipart, fpart)
register flt_arith *e, *ipart, *fpart;
{

View file

@ -6,9 +6,8 @@
/* $Header$ */
#include "flt_misc.h"
#if __STDC__ > 0
void
#endif
flt_mul(e1,e2,e3)
register flt_arith *e1,*e2,*e3;
{

View file

@ -6,9 +6,8 @@
/* $Header$ */
#include "flt_misc.h"
#if __STDC__ > 0
void
#endif
flt_nrm(e)
register flt_arith *e;
{

View file

@ -217,9 +217,8 @@ add_exponent(e, exp)
if (!status) status = flt_status;
flt_status = status;
}
#if __STDC__ > 0
void
#endif
flt_str2flt(s, e)
register char *s;
register flt_arith *e;
@ -420,9 +419,8 @@ flt_ecvt(e, decpt, sign)
}
return buf;
}
#if __STDC__ > 0
void
#endif
flt_flt2str(e, buf, bufsize)
flt_arith *e;
char *buf;

View file

@ -6,9 +6,8 @@
/* $Header$ */
#include "flt_misc.h"
#if __STDC__ > 0
void
#endif
flt_umin(e)
flt_arith *e;
{

View file

@ -43,10 +43,11 @@ $(LIBFLT): $(OBJ)
$(RANLIB) $(LIBFLT)
install: all
-mkdir $(MOD_DIR)/lib
-mkdir $(MOD_DIR)/h
cp $(LIBFLT) $(MOD_DIR)/lib/$(LIBFLT)
$(RANLIB) $(MOD_DIR)/lib/$(LIBFLT)
cp $(SRC_DIR)/flt_arith.h $(MOD_DIR)/h/flt_arith.h
cp $(SRC_DIR)/flt_arith.3 $(MOD_DIR)/man/flt_arith.3
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/flt_arith.3 $(TARGET_HOME) ; \
fi
@ -54,7 +55,6 @@ install: all
cmp: all
-cmp $(LIBFLT) $(MOD_DIR)/lib/$(LIBFLT)
-cmp $(SRC_DIR)/flt_arith.h $(MOD_DIR)/h/flt_arith.h
-cmp $(SRC_DIR)/flt_arith.3 $(MOD_DIR)/man/flt_arith.3
pr:
@pr $(SRC_DIR)/proto.make $(SRC)

View file

@ -1,9 +1,8 @@
/* $Header$ */
#include "flt_misc.h"
#if __STDC__ > 0
void
#endif
flt_split(e, p)
register flt_arith *e;
register unsigned short *p;

View file

@ -4,7 +4,7 @@
init_idf, str2idf, findidf\ \-\ a namelist module
.SH SYNOPSIS
.PP
.B init_idf()
.B void init_idf()
.PP
.B struct idf *str2idf(tag, cpy)
.br

View file

@ -17,9 +17,12 @@ static struct idf *IDF_hashtable[IDF_HASHSIZE];
(variable, selector, structure tag, etc.).
*/
#if __STDC__
static struct idf *IDF_new(char *, int, int);
#endif
_PROTOTYPE(static struct idf *IDF_new, (char *, int, int));
void
init_idf()
{
}
static struct idf *
IDF_new(tg, size, cpy)
@ -64,6 +67,7 @@ IDF_new(tg, size, cpy)
}
#ifdef IDF_DEBUG
void
hash_stat()
{
register int i;
@ -87,6 +91,7 @@ hash_stat()
print("End hash table tally\n");
}
void
idfappfun(fun, opt)
int (*fun)();
int opt;

View file

@ -1,6 +1,8 @@
/* $Header$ */
/* IDENTIFIER DESCRIPTOR */
#include <ansi.h>
/* This a generic package for maintaining a name list */
/* Instantiation parameters, supplied by #define, are :
@ -23,9 +25,9 @@ struct idf {
/* init_idf()
Initializes the namelist. Empty for now.
Initializes the namelist.
*/
#define init_idf()
_PROTOTYPE(void init_idf, (void));
/* struct idf * str2idf(tg, cp)
char *tg;
@ -38,10 +40,6 @@ struct idf {
If cp < 0, the string is not entered, but only looked for.
*/
#if __STDC__ > 0
struct idf *str2idf(char *, int);
#else
extern struct idf * str2idf();
#endif
_PROTOTYPE(struct idf *str2idf, (char *, int));
#define findidf(tg) str2idf(tg, -1)

View file

@ -8,9 +8,9 @@ MOD_DIR = $(TARGET_HOME)/modules
all:
install: all
-mkdir $(MOD_DIR)/pkg
cp $(SRC_DIR)/idf_pkg.body $(MOD_DIR)/pkg/idf_pkg.body
cp $(SRC_DIR)/idf_pkg.spec $(MOD_DIR)/pkg/idf_pkg.spec
cp $(SRC_DIR)/idf.3 $(MOD_DIR)/man/idf.3
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/idf.3 $(TARGET_HOME) ; \
fi
@ -18,7 +18,6 @@ install: all
cmp: all
-cmp $(SRC_DIR)/idf_pkg.body $(MOD_DIR)/pkg/idf_pkg.body
-cmp $(SRC_DIR)/idf_pkg.spec $(MOD_DIR)/pkg/idf_pkg.spec
-cmp $(SRC_DIR)/idf.3 $(MOD_DIR)/man/idf.3
pr:
@pr $(SRC_DIR)/proto.make $(SRC_DIR)/idf_pkg.spec $(SRC_DIR)/idf_pkg.body