Pristine Ack-5.5
[Ack-5.5.git] / modules / src / em_opt / nopt.h
1 /* $Id: nopt.h,v 2.12 1994/06/24 11:14:19 ceriel Exp $ */
2 #include <stdio.h>
3 #include <em_spec.h>
4 #include <em_mnem.h>
5 #include <em_pseu.h>
6 #include <em_flag.h>
7 #include <em_ptyp.h>
8 #include <em_mes.h>
9 #include <alloc.h>
10 #include <em.h>
11 #include <em_comp.h>
12 #include <system.h>
13 #include <emO_code.h>
14 #include <ansi.h>
15
16 #define MAXBUFFER       200
17 #define MAXSTRING       1000
18
19 #define OTHER   0
20 #define op_lab  sp_fpseu
21
22 typedef struct e_instr *p_instr;
23
24 struct dfa {
25         short   check;
26         short   next;
27 };
28
29 struct dodefault {
30         short   numout;
31         short   next;
32 };
33
34 extern p_instr  OO_buffer;
35 extern p_instr  OO_patternqueue;
36 extern p_instr  OO_nxtpatt;
37 extern p_instr  OO_endbackup;
38 extern p_instr  OO_nxtrepl;
39
40 p_instr OO_halfflush();
41
42 # define GETNXTPATT() (OO_nxtpatt>=&OO_buffer[MAXBUFFER]?OO_halfflush():OO_nxtpatt++)
43 # define GETNXTREPL() (OO_nxtrepl++)
44
45 # define FLUSHDFA()     (GETNXTPATT())->em_opcode=OTHER;\
46                         if (OO_state) OO_dfa(OTHER); else OO_flush()
47
48 extern int      OO_state;
49 extern arith    OO_WSIZE;       /* wordlength */
50 extern arith    OO_DWSIZE;      /* 2*wordlength */
51 extern arith    OO_PSIZE;       /* pointer length */
52 #ifdef STATS
53 extern int      OO_wrstats;                     /* statistics output */
54 #endif
55
56 #define CST(p)          (p.em_cst)
57 #define PNAM(p)         (p.em_pnam)
58 #define LAB(p)          (p.em_ilb)
59 #define DEFILB(p)       (p.em_ilb)
60 #define DEFINED(p)      (p.em_argtype)
61
62 _PROTOTYPE(void EM_mkop, (p_instr, int));
63 _PROTOTYPE(void EM_mknarg, (p_instr, int));
64 _PROTOTYPE(void EM_mkilb, (p_instr, int, label));
65 _PROTOTYPE(void EM_mknof, (p_instr, int, label, arith));
66 _PROTOTYPE(void EM_mksof, (p_instr, int, char *, arith));
67 _PROTOTYPE(void EM_mkcst, (p_instr, int, arith));
68 _PROTOTYPE(void EM_mkpro, (p_instr, int, char *));
69 _PROTOTYPE(void EM_mkdefilb, (p_instr, int, label));
70 _PROTOTYPE(void EM_Nop, (int));
71 _PROTOTYPE(void EM_Nnarg, (int));
72 _PROTOTYPE(void EM_Nilb, (int, label));
73 _PROTOTYPE(void EM_Nnof, (int, label, arith));
74 _PROTOTYPE(void EM_Nsof, (int, char *, arith));
75 _PROTOTYPE(void EM_Ncst, (int, arith));
76 _PROTOTYPE(void EM_Npro, (int, char *));
77 _PROTOTYPE(void EM_Ndefilb, (int, label));
78 _PROTOTYPE(void EM_Rop, (int));
79 _PROTOTYPE(void EM_Rnarg, (int));
80 _PROTOTYPE(void EM_Rilb, (int, label));
81 _PROTOTYPE(void EM_Rnof, (int, label, arith));
82 _PROTOTYPE(void EM_Rsof, (int, char *, arith));
83 _PROTOTYPE(void EM_Rcst, (int, arith));
84 _PROTOTYPE(void EM_Rpro, (int, char *));
85 _PROTOTYPE(void EM_Rdefilb, (int, label));
86
87 _PROTOTYPE(arith OO_rotate, (arith, arith));
88 _PROTOTYPE(int OO_signsame, (arith, arith));
89 _PROTOTYPE(int OO_sfit, (arith, arith));
90 _PROTOTYPE(int OO_ufit, (arith, arith));
91 _PROTOTYPE(int OO_extsame, (p_instr, p_instr));
92 _PROTOTYPE(int OO_namsame, (p_instr, p_instr));
93 _PROTOTYPE(arith OO_offset, (p_instr));
94
95 _PROTOTYPE(char *OO_freestr, (char *));
96 _PROTOTYPE(void OO_dfa, (int));
97 _PROTOTYPE(void OO_flush, (void));
98 _PROTOTYPE(p_instr OO_halfflush, (void));
99 _PROTOTYPE(void OO_mkext, (p_instr, int, p_instr, arith));
100 _PROTOTYPE(void OO_mkrepl, (int, int, int));
101
102 #ifdef DEBUG
103 _PROTOTYPE(void dumpstate, (char *));
104 _PROTOTYPE(void prtinst, (p_instr));
105 #endif