dfa.c dfa.c.new trans.h trans.h.new trans.c trans.c.new\
incalls.d incalls.r incalls.r.new pseudo.d
-all: em_nopt $(LIBOPT)
+all: em_nopt $(LIBOPT) em_opt.3
install: all
$(INSTALL) lib/$(LIBOPT)
+ $(INSTALL) man/em_opt.3
+ cp em_nopt.1 $(EMHOME)/man
cp em_nopt $(BINDIR)/em_nopt
-lint: lintparser lintnopt
-
cmp: all
$(COMPARE) lib/$(LIBOPT)
+ $(COMPARE) man/em_opt.3
-cmp em_nopt $(BINDIR)/em_nopt
pr:
opr:
make pr | opr
+lint: lintparser lintnopt
+
clean:
rm -f O_*.o
rm -f O_*.c
-rm /tmp/patts
touch dfadummy
+# How to build the lint library for the optimizer
+
+LLINT = nopt.c mkstrct.c aux.c dfa.c trans.c
+
+lintlib: dfadummy $(LLINT)
+ $(LINT) $(LINTFLAGS) $(LLINT) -Cemopt
+ mv llib-lemopt.ln $(EMHOME)/modules/lib
+
# How to build program to parse patterns table and build c files.
PARSERLIB = $(EMHOME)/lib/em_data.a\
--- /dev/null
+.TH EM_NOPT 6ACK "$Revision$"
+.ad
+.SH NAME
+em_nopt \- EM peephole optimizer
+.SH SYNOPSIS
+~em/lib/em_nopt [ inputfile [ outputfile ] ]
+.SH DESCRIPTION
+Em_nopt reads a compact EM-program, inputfile or standard input,
+and produces another compact EM program on outputfile or standard output
+that is functionally equivalent,
+but smaller.
+This program is a faster replacement for the program em_opt but does not
+perform some other functions that that program performed and were required
+before running a codegenerator. These operations are now performed by the
+front ends and the EM_CODE(3ACK) module. The old program is still required
+for front ends that do not use the new mechanisms or for making a library
+module.
+Usually this program need not be run as the front end will perform the
+equivalent optimizations using the library module em_opt(3).
+.SH "SEE ALSO"
+ack(1) em_opt(1) em_opt(3)
+.SH AUTHOR
+Bruce McKenzie <bruce@cantuar.UUCP>
--- /dev/null
+.TH EM_OPT 3ACK "$Revision$"
+.ad
+.SH NAME
+emopt \- EM code peephole optimizer interface for compilers
+.SH SYNOPSIS
+.nf
+.B #define PEEPHOLE
+.B #include <em.h>
+.PP
+.B O_init(wsize, psize)
+.B arith wsize, psize;
+.PP
+.B int O_open(filename)
+.B O_close()
+.B int O_busy()
+.B char *filename;
+.PP
+.B O_magic()
+.PP
+.B O_df_dlb(l)
+.B O_df_dnam(s)
+.B 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 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 char *s; label l;
+.PP
+.BI O_bss_ cstp ()
+.BI O_hol_ cstp ()
+.BI O_con_ cstp ()
+.BI O_rom_ cstp ()
+.PP
+.B #include <em_mes.h>
+.B O_mes_begin(ms)
+.BI O_ cstp ()
+.B O_mes_end()
+.B int ms;
+.PP
+.B O_exc(c1, c2)
+.B arith c1, c2;
+.PP
+.BI O_ mnem ()
+.BI O_ mnem _dlb()
+.BI O_ mnem _dnam()
+.BI O_ mnem _narg()
+.PP
+.B O_insertpart(id)
+.B int id;
+.PP
+.B O_beginpart(id)
+.B int id;
+.PP
+.B O_endpart(id)
+.B int id;
+.fi
+.SH DESCRIPTION
+This package provides a procedural EM code peephole optimizer interface to be
+used in compilers and other EM code producing programs. The interface
+routines are identical to the EM_CODE(3) procedure interface except that all
+names have been replaced by
+.I O_xxx
+. It is possible to convert
+a program that is currently using the EM_CODE interface by defining PEEPHOLE
+before including em.h which enables a series of macros to map all the
+.I C_xxx
+names to the corresponding
+.I O_xxx
+names. The module in turn calls
+.I C_xxx
+routines to output the optimized code. Hence it is possible to add peephole
+optimization to any program that outputs EM code usng the EM_CODE module.
+.PP
+Details of the
+.I O_xxx
+routines may be obtained by refering to the description
+of the corresponding
+.I C_xxx
+routine in EM_CODE(3).
+.SH FILES
+.nf
+~em/modules/h/em.h
+~em/modules/lib/libemopt.a
+.fi
+.SH MODULES
+.nf
+alloc(3), system(3), string(3)
+.fi
+.SH SEE ALSO
+em_nopt(1) em_code(3), read_em(3), em_mes(3)
+.SH DIAGNOSTICS
+.I O_open
+returns 1 if the open is successful and 0 if not.
+.SH BUGS
+It is not possible to indicate that the argument of
+.B O_con_cst ()
+must be seen as an unsigned value.
+.SH AUTHOR
+Bruce McKenzie <bruce@cantuar.UUCP>