Pristine Ack-5.5
[Ack-5.5.git] / modules / src / em_opt / em_opt.3
1 .TH EM_OPT 3 "$Revision: 2.5 $"
2 .ad
3 .SH NAME
4 emopt \- EM code peephole optimizer interface for compilers
5 .SH SYNOPSIS
6 .nf
7 .B #define PEEPHOLE
8 .B #include <em.h>
9 .PP
10 .B void O_init(wsize, psize)
11 .B arith wsize, psize;
12 .PP
13 .B int O_open(filename)
14 .B void O_close()
15 .B int O_busy()
16 .B char *filename;
17 .PP
18 .B void O_magic()
19 .PP
20 .B void O_df_dlb(l)
21 .B void O_df_dnam(s)
22 .B void O_df_ilb(l)
23 .B label l; char *s;
24 .PP
25 .B void O_pro(s, l)
26 .B void O_pro_narg(s)
27 .B void O_end(l)
28 .B void O_end_narg()
29 .B char *s; arith l;
30 .PP
31 .B void O_exa_dlb(l)
32 .B void O_exa_dnam(s)
33 .B void O_exp(s)
34 .B void O_ina_dlb(l)
35 .B void O_ina_dnam(s)
36 .B void O_inp(s)
37 .B char *s; label l;
38 .PP
39 .BI "void O_bss_" cstp ()
40 .BI "void O_hol_" cstp ()
41 .BI "void O_con_" cstp ()
42 .BI "void O_rom_" cstp ()
43 .PP
44 .B #include <em_mes.h>
45 .B void O_mes_begin(ms)
46 .BI "void O_" cstp ()
47 .B void O_mes_end()
48 .B int ms;
49 .PP
50 .B void O_exc(c1, c2)
51 .B arith c1, c2;
52 .PP
53 .BI "void O_" mnem ()
54 .BI "void O_" mnem _dlb()
55 .BI "void O_" mnem _dnam()
56 .BI "void O_" mnem _narg()
57 .PP
58 .B void O_insertpart(id)
59 .B int id;
60 .PP
61 .B void O_beginpart(id)
62 .B int id;
63 .PP
64 .B void O_endpart(id)
65 .B int id;
66 .fi
67 .SH DESCRIPTION
68 This package provides a procedural EM code peephole optimizer interface to be
69 used in compilers and other EM code producing programs. The interface
70 routines are identical to the EM_CODE(3) procedure interface except that all
71 names have been replaced by
72 .I O_xxx
73 It is possible to convert
74 a program that is currently using the EM_CODE interface
75 to use this module instead by defining
76 .I PEEPHOLE
77 before including
78 .I em.h.
79 This defines a series of macros to map all the
80 .I C_xxx
81 names to the corresponding
82 .I O_xxx
83 names. The module in turn calls
84 .I C_xxx
85 routines to output the optimized code. Hence it is possible to add peephole
86 optimization to any program that outputs EM code using the EM_CODE module.
87 .PP
88 Details of the
89 .I O_xxx
90 routines may be obtained by referring to the description
91 of the corresponding 
92 .I C_xxx
93 routine in EM_CODE(3).
94 .SH FILES
95 .nf
96 ~em/modules/h/em.h
97 ~em/modules/lib/libemopt.a
98 .fi
99 .SH MODULES
100 .nf
101 alloc(3), system(3), string(3), em_code(3)
102 .fi
103 .SH SEE ALSO
104 em_nopt(1) em_code(3), read_em(3), em_mes(3)
105 .SH DIAGNOSTICS
106 .I O_open
107 returns 1 if the open is successful and 0 if not.
108 .SH BUGS
109 It is not possible to indicate that the argument of
110 .B O_con_cst ()
111 must be seen as an unsigned value.
112 .SH AUTHOR
113 Bruce McKenzie <bruce@cosc.canterbury.ac.nz>