.SH SYNOPSIS
~em/lib/em_nopt [ inputfile [ outputfile ] ]
.SH DESCRIPTION
-Em_nopt reads a compact EM-program, inputfile or standard input,
+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.
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
+It is possible to convert
+a program that is currently using the EM_CODE interface
+to use this module instead by defining
+.I PEEPHOLE
+before including
+.I em.h.
+This defines 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.
+optimization to any program that outputs EM code using the EM_CODE module.
.PP
Details of the
.I O_xxx
-routines may be obtained by refering to the description
+routines may be obtained by referring to the description
of the corresponding
.I C_xxx
routine in EM_CODE(3).
.fi
.SH MODULES
.nf
-alloc(3), system(3), string(3)
+alloc(3), system(3), string(3), em_code(3)
.fi
.SH SEE ALSO
em_nopt(1) em_code(3), read_em(3), em_mes(3)
#include <em.h>
#include <em_comp.h>
#include <system.h>
-#include <idf_pkg.spec>
#include <emO_code.h>
-#define OTHER 255
+#define OTHER 0
+#define op_lab sp_fpseu
+
+typedef struct e_instr *p_instr;
#define FLUSHDFA() if(OO_state) {\
*OO_nxtpatt++ = OO_OTHER; OO_dfa(OTHER);\
} else if(OO_noutput) OO_flush();
#define GETINSTR() (OO_nxtifree>OO_freeiqueue)?*(--OO_nxtifree):\
- ((p_instr)Malloc(sizeof(struct e_instr)))
-
-#define op_lab sp_ilb1
-
-typedef struct e_instr *p_instr;
+ ((p_instr)Malloc(sizeof(struct e_instr)))
extern p_instr *OO_freeiqueue;
extern p_instr *OO_nxtifree;
ldc 1 mlu 2*w :
loc 1 sbi w : dec
loc loe mli w : loe $2 loc $1 mli w
+loc loe mlu w : loe $2 loc $1 mlu w
loc loe adi w loc : loe $2 loc $1 adi w loc $4
loc loe adi w inc : loe $2 loc $1 adi w inc
loc loe adi w dec : loe $2 loc $1 adi w dec
loc lol mli w : lol $2 loc $1 mli w
+loc lol mlu w : lol $2 loc $1 mlu w
loc lol adi w loc : lol $2 loc $1 adi w loc $4
loc lol adi w inc : lol $2 loc $1 adi w dec
loc lol adi w dec : lol $2 loc $1 adi w dec
ldc lde mli 2*w : lde $2 ldc $1 mli 2*w
+ldc lde mlu 2*w : lde $2 ldc $1 mlu 2*w
ldc lde adi 2*w : lde $2 ldc $1 adi 2*w
ldc ldl mli 2*w : ldl $2 ldc $1 mli 2*w
+ldc ldl mlu 2*w : ldl $2 ldc $1 mlu 2*w
ldc ldl adi 2*w : ldl $2 ldc $1 adi 2*w
loc 2 mli w : loc 1 sli w
loc 4 mli w : loc 2 sli w
loi 1 loc 1 loc w cii loc w loc w ciu loc 255 and w: loi 1
cmp teq : cms p teq
cmp tne : cms p tne
+cmp zeq : cms p zeq $2
+cmp zne : cms p zne $2
cmu defined teq : cms $1 teq
cmu defined tne : cms $1 tne
cms w zeq : beq $2
inc dup w ste dec : dup w inc ste $3
inc dup w stl dec : dup w inc stl $3
#endif
+bra lab $1 : lab $2
zeq bra lab $1 : zne $2 lab $1
zge bra lab $1: zlt $2 lab $1
zgt bra lab $1 : zle $2 lab $1
lol $1+3*w loc $3 ior w lol $1+2*w loc $4 ior w lol $1+w loc $5 ior w lol $1 loc $6 ior w
loc dup 2 stl loc dup 2 stl :
loc $1 stl $3 loc $4 stl $6 loc $1 loc $4
-/*LLP LLP adp SLP $2 sti ? (!notreg($2) || $5!=p): */
-/* LLP $1 sti $5 LLP $2 adp $3 SLP $4 */
+lol lol adp stl $2 sti != p ? p==w : lol $1 sti $5 lol $2 adp $3 stl $4
+ldl ldl adp sdl $2 sti != p ? p==2*w : ldl $1 sti $5 ldl $2 adp $3 sdl $4
loe loe adp ste $2 sti !=p ? p==w : loe $1 sti $5 loe $2 adp $3 ste $4
lde lde adp sde $2 sti !=p ? p==2*w : lde $1 sti $5 lde $2 adp $3 sde $4
#ifndef INT