EM_OPT(3)

NAME
emopt - EM code peephole optimizer interface for compilers

SYNOPSIS
#define PEEPHOLE
#include <em.h>

void O_init(wsize, psize)
arith wsize, psize;

int O_open(filename)
void O_close()
int O_busy()
char *filename;

void O_magic()

void O_df_dlb(l)
void O_df_dnam(s)
void O_df_ilb(l)
label l; char *s;

void O_pro(s, l)
void O_pro_narg(s)
void O_end(l)
void O_end_narg()
char *s; arith l;

void O_exa_dlb(l)
void O_exa_dnam(s)
void O_exp(s)
void O_ina_dlb(l)
void O_ina_dnam(s)
void O_inp(s)
char *s; label l;

void O_bss_cstp()
void O_hol_cstp()
void O_con_cstp()
void O_rom_cstp()

#include <em_mes.h>
void O_mes_begin(ms)
void O_cstp()
void O_mes_end()
int ms;

void O_exc(c1, c2)
arith c1, c2;

void O_mnem()
void O_mnem_dlb()
void O_mnem_dnam()
void O_mnem_narg()

void O_insertpart(id)
int id;

void O_beginpart(id)
int id;

void O_endpart(id)
int id;

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 O_xxx It is possible to convert a program that is currently using the EM_CODE interface to use this module instead by defining PEEPHOLE before including em.h. This defines a series of macros to map all the C_xxx names to the corresponding O_xxx names. The module in turn calls C_xxx routines to output the optimized code. Hence it is possible to add peephole optimization to any program that outputs EM code using the EM_CODE module.

Details of the O_xxx routines may be obtained by referring to the description of the corresponding C_xxx routine in EM_CODE(3).

FILES
~em/modules/h/em.h
~em/modules/lib/libemopt.a

MODULES
alloc(3), system(3), string(3), em_code(3)

SEE ALSO
em_nopt(1) em_code(3), read_em(3), em_mes(3)

DIAGNOSTICS
O_open returns 1 if the open is successful and 0 if not.

BUGS
It is not possible to indicate that the argument of O_con_cst () must be seen as an unsigned value.

AUTHOR
Bruce McKenzie <bruce@cosc.canterbury.ac.nz>