annotate mc-codegen.c @ 99:53899975154c

*** empty log message ***
author kono
date Fri, 14 Mar 2003 21:33:03 +0900
parents 07c2554e1cfa
children 3cf2f8c120b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1 /* Micro-C Generic Code Generatation Part */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
2 /* $Id$ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
3
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
4 #define EXTERN extern
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
5 #include "mc.h"
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
6 #include "mc-codegen.h"
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
7 #include "mc-code.h"
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
8
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
9 int creg; /* current register */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
10 int reg_sp; /* REGister Stack-Pointer */
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
11 int reg_stack[MAX_MAX]; /* 実際のレジスタの領域 */
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
12
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
13 /* floating point registers */
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
14
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
15 int freg; /* current floating point register */
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
16 int freg_sp; /* floating point REGister Stack-Pointer */
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
17 int freg_stack[MAX_MAX]; /* 実際のレジスタの領域 */
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
18
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
19 int use; /* generated value will be used */
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
20
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
21 /*
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
22 creg currrent virtual register
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
23 regs[] virtual register usage
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
24 regv[] value in virtual register flag
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
25 freg current floating point register
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
26 fregv calue in floating point register
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
27 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
28
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
29 void remove0(int *parent,int e) ;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
30 void remove0_all(int *parent,int e) ;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
31 int is_same_type(int e1,int e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
32 void jump(int e1, int env);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
33 void machinop(int e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
34 void sassign(int e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
35 void assign(int e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
36 void assop(int e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
37 int g_expr0(int e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
38
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
39 int
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
40 gexpr(int e1,int use0)
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
41 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
42 if (chk) return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
43 gexpr_init();
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
44 use = use0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
45 #if 0
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
46 if(lineno==2862) {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
47 return g_expr0(e1); /*break here*/
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
48 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
49 #endif
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
50 return g_expr0(e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
51 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
52
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
53 int
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
54 g_expr_u(int e1)
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
55 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
56 int t;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
57 int suse = use; use=0;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
58 t=g_expr0(e1);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
59 use=suse;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
60 return t;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
61 }
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
62
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
63 int
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
64 g_expr(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
65 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
66 int t;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
67 int suse = use; use=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
68 t=g_expr0(e1);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
69 use=suse;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
70 return t;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
71 }
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
72
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
73 int
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
74 g_expr0(int e1)
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
75 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
76 int e2,e3,t;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
77 NMTBL *n;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
78
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
79 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
80 switch (car(e1)){
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
81 case GVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
82 code_gvar(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
83 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
84 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
85 case RGVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
86 code_rgvar(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
87 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
88 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
89 case CRGVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
90 code_crgvar(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
91 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
92 return CHAR;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
93 case LVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
94 code_lvar(lvar(e2));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
95 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
96 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
97 case REGISTER:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
98 /* this is of course redundant... */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
99 /* or why not creg=e2? */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
100 code_register(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
101 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
102 return INT;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
103 case DREGISTER:
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
104 /* this is of course redundant... */
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
105 /* or why not creg=e2? */
97
6d42fcac07af *** empty log message ***
kono
parents: 95
diff changeset
106 code_fregister(e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
107 fregv[freg]=1;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
108 return DOUBLE;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
109 case RLVAR:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
110 code_rlvar(lvar(e2),creg);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
111 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
112 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
113 case CRLVAR:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
114 code_crlvar(lvar(e2),creg);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
115 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
116 return CHAR;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
117 case FRLVAR:
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
118 code_drlvar(lvar(e2),0);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
119 fregv[freg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
120 return FLOAT;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
121 case FRGVAR:
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
122 code_drgvar(e1,0);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
123 fregv[freg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
124 return FLOAT;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
125 case DRLVAR:
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
126 code_drlvar(lvar(e2),1);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
127 fregv[freg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
128 return DOUBLE;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
129 case DRGVAR:
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
130 code_drgvar(e1,1);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
131 fregv[freg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
132 return DOUBLE;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
133 case FNAME:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
134 code_fname(((NMTBL *)(e2))->nm);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
135 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
136 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
137 case CONST: /* 代入する値が0でも特別な処理はしない */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
138 code_const(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
139 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
140 return INT;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
141 case DCONST:
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
142 code_dconst(e1);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
143 fregv[freg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
144 return DOUBLE;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
145 case STRING:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
146 string(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
147 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
148 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
149 case FUNCTION:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
150 t = function(e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
151 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
152 return t;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
153 case CODE:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
154 jump(e2,caddr(e1));
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
155 return VOID;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
156 case INDIRECT:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
157 return g_expr0(e2);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
158 case RINDIRECT: case CRINDIRECT:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
159 case DRINDIRECT: case FRINDIRECT:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
160 return rindirect(e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
161 case ADDRESS:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
162 return g_expr0(e2);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
163 case MINUS: /* レジスタに対し、neglを実行すれば実現可能 */
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
164 g_expr0(e2); code_neg();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
165 return INT;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
166 case DMINUS:
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
167 g_expr0(e2); code_dneg();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
168 return DOUBLE;
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
169 case I2D:
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
170 g_expr0(e2); code_i2d();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
171 return DOUBLE;
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
172 case D2I:
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
173 g_expr0(e2); code_d2i();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
174 return INT;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
175 case U2D:
3789aef7331d minor fix
kono
parents: 84
diff changeset
176 g_expr0(e2); code_u2d();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
177 return DOUBLE;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
178 case D2U:
3789aef7331d minor fix
kono
parents: 84
diff changeset
179 g_expr0(e2); code_d2u();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
180 return UNSIGNED;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
181 case BNOT: /* ~ */
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
182 g_expr0(e2); code_not();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
183 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
184 case LNOT: /* ! */
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
185 g_expr0(e2); code_lnot();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
186 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
187 case PREINC:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
188 code_preinc(e1,e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
189 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
190 case POSTINC:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
191 code_postinc(e1,e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
192 return INT;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
193 case DPREINC:
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
194 code_dpreinc(e1,e2,1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
195 return DOUBLE;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
196 case DPOSTINC:
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
197 code_dpostinc(e1,e2,1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
198 return DOUBLE;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
199 case FPREINC:
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
200 code_dpreinc(e1,e2,0);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
201 return FLOAT;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
202 case FPOSTINC:
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
203 code_dpostinc(e1,e2,0);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
204 return FLOAT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
205 case CPOSTINC:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
206 /* char *p; *p++ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
207 code_cpostinc(e1,e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
208 return CHAR;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
209 case CPREINC:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
210 code_cpreinc(e1,e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
211 return CHAR;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
212 case CPOSTDEC:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
213 code_cpostdec(e1,e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
214 return CHAR;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
215 case CPREDEC:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
216 code_cpredec(e1,e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
217 return CHAR;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
218 case MUL: case UMUL:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
219 case DIV: case UDIV:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
220 case MOD: case UMOD:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
221 case LSHIFT: case ULSHIFT: case RSHIFT: case URSHIFT:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
222 case ADD: case SUB: case BAND: case EOR: case BOR: case CMP:
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
223 machinop(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
224 return INT;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
225 case DMUL: case DDIV:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
226 case DADD: case DSUB:
91
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 89
diff changeset
227 case DCMP: case DCMPGE:
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
228 dmachinop(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
229 return DOUBLE;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
230 case COND:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
231 e2=fwdlabel();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
232 b_expr(cadr(e1),0,e2,0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
233 code_set_fixed_creg(0);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
234 g_expr0(caddr(e1));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
235 code_set_fixed_creg(1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
236 jmp(e3=fwdlabel());
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
237 fwddef(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
238 code_set_fixed_creg(0);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
239 t = g_expr0(cadddr(e1));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
240 code_set_fixed_creg(1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
241 fwddef(e3);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
242 return t;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
243 case SASS:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
244 sassign(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
245 return RSTRUCT;
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
246 case ASS: case CASS:
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
247 assign(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
248 return INT;
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
249 case FASS: case DASS: case LASS:
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
250 dassign(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
251 return DOUBLE;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
252 case ASSOP: case CASSOP:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
253 assop(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
254 return INT;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
255 case DASSOP: case FASSOP:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
256 dassop(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
257 return DOUBLE;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
258 case RSTRUCT:
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
259 g_expr0(e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
260 return RSTRUCT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
261 case COMMA:
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
262 g_expr_u(e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
263 return g_expr0(caddr(e1));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
264 case RETURN:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
265 n = (NMTBL *)e2;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
266 if (retcont==0)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
267 retcont=fwdlabel();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
268 code_return(creg);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
269 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
270 return VOID;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
271 case ENVIRONMENT:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
272 code_environment(creg);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
273 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
274 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
275 default:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
276 code_bool(e1); /* type? */
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
277 regv[creg]=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
278 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
279 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
280 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
281
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
282 #define dual_ops(op) \
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
283 (op==GT|| op==UGT|| op==GE|| op==UGE|| op==LT|| \
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
284 op==ULT|| op==LE|| op==ULE|| \
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
285 op==DOP+GT|| op==DOP+GE|| op==DOP+LT|| op==DOP+LE || \
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
286 op==EQ|| op==NEQ|| op==DOP+EQ|| op==DOP+NEQ)
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
287
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
288 int
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
289 rop_dual(op)
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
290 {
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
291 if (op==GT) return LT;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
292 if (op==UGT) return ULT;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
293 if (op==GE) return LE;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
294 if (op==UGE) return ULE;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
295 if (op==LT) return GT;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
296 if (op==ULT) return UGT;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
297 if (op==LE) return GE;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
298 if (op==ULE) return UGE;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
299 if (op==DOP+GT) return DOP+LT;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
300 if (op==DOP+GE) return DOP+LE;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
301 if (op==DOP+LT) return DOP+GT;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
302 if (op==DOP+LE) return DOP+GE;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
303 return op;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
304 }
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
305
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
306 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
307 bexpr(int e1, char cond, int l1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
308 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
309 int op = car(e1);
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
310 if (chk) return;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
311 gexpr_init();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
312 if (dual_ops(op) && (car(caddr(e1))==CONST||(car(caddr(e1))==DCONST)))
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
313 b_expr(list3(rop_dual(op),caddr(e1),cadr(e1)),cond,l1,0);
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
314 else
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
315 b_expr(e1,cond,l1,0);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
316 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
317
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
318 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
319 b_expr(int e1, char cond, int l1,int err)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
320 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
321 int e2,l2,t;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
322 e2=cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
323 switch(car(e1)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
324 case LNOT:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
325 b_expr(e2,!cond,l1,0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
326 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
327 case GT:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
328 rexpr(e1,l1,code_gt(cond),INT);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
329 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
330 case UGT:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
331 rexpr(e1,l1,code_ugt(cond),UNSIGNED);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
332 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
333 case GE:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
334 rexpr(e1,l1,code_ge(cond),INT);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
335 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
336 case UGE:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
337 rexpr(e1,l1,code_uge(cond),UNSIGNED);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
338 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
339 case LT:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
340 rexpr(e1,l1,code_ge(!cond),INT);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
341 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
342 case ULT:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
343 rexpr(e1,l1,code_uge(!cond),UNSIGNED);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
344 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
345 case LE:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
346 rexpr(e1,l1,code_gt(!cond),INT);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
347 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
348 case ULE:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
349 rexpr(e1,l1,code_ugt(!cond),UNSIGNED);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
350 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
351 case EQ:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
352 rexpr(e1,l1,code_eq(cond),INT);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
353 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
354 case NEQ:
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
355 rexpr(e1,l1,code_eq(!cond),INT);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
356 return;
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
357
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
358 case DOP+GT:
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
359 drexpr(cadr(e1),caddr(e1),l1,DOP+GT);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
360 return;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
361 case DOP+GE:
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
362 drexpr(cadr(e1),caddr(e1),l1,DOP+GE);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
363 return;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
364 case DOP+LT:
84
1a723130a2c7 condtional
kono
parents: 83
diff changeset
365 drexpr(caddr(e1),cadr(e1),l1,DOP+GT);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
366 return;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
367 case DOP+LE:
84
1a723130a2c7 condtional
kono
parents: 83
diff changeset
368 drexpr(caddr(e1),cadr(e1),l1,DOP+GE);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
369 return;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
370 case DOP+EQ:
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
371 drexpr(cadr(e1),caddr(e1),l1,DOP+EQ);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
372 return;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
373 case DOP+NEQ:
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
374 drexpr(cadr(e1),caddr(e1),l1,DOP+NEQ);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
375 return;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
376
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
377 case LAND:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
378 b_expr(e2,0,cond?(l2=fwdlabel()):l1,0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
379 b_expr(caddr(e1),cond,l1,0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
380 if(cond) fwddef(l2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
381 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
382 case LOR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
383 b_expr(e2,1,cond?l1:(l2=fwdlabel()),0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
384 b_expr(caddr(e1),cond,l1,0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
385 if(!cond) fwddef(l2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
386 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
387 case CRGVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
388 code_cmp_crgvar(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
389 jcond(l1,cond);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
390 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
391 case CRLVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
392 code_cmp_crlvar(lvar(e2));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
393 jcond(l1,cond);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
394 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
395 case RGVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
396 code_cmp_rgvar(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
397 jcond(l1,cond);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
398 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
399 case RLVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
400 code_cmp_rlvar(lvar(e2));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
401 jcond(l1,cond);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
402 return;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
403 case DRLVAR:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
404 code_cmp_drlvar(lvar(e2));
f94ca1168520 float first try...
kono
parents: 80
diff changeset
405 jcond(l1,cond);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
406 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
407 case DRGVAR:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
408 code_cmp_drgvar(lvar(e2));
f94ca1168520 float first try...
kono
parents: 80
diff changeset
409 jcond(l1,cond);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
410 return;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
411 case REGISTER:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
412 code_cmp_register(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
413 jcond(l1,cond);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
414 return;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
415 case DREGISTER:
97
6d42fcac07af *** empty log message ***
kono
parents: 95
diff changeset
416 code_cmp_fregister(e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
417 jcond(l1,cond);
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
418 return;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
419 case CONST:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
420 if((cond&&e2)||(!cond&&!e2)) jmp(l1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
421 return;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
422 case DCONST:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
423 if((dcadr(e2)!=0.0)^cond) jmp(l1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
424 return;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
425 default:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
426 if(err) {
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
427 error(-1); return; /* recursive g_expr/b_expr */
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
428 }
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
429 t=g_expr(e1);
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
430 if(t==FLOAT||t==DOUBLE)
97
6d42fcac07af *** empty log message ***
kono
parents: 95
diff changeset
431 code_cmp_fregister(freg);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
432 else
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
433 code_cmp_register(creg);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
434 jcond(l1,cond);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
435 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
436 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
437 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
438
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
439
89
917947ffeb7c power pc version
kono
parents: 88
diff changeset
440 void
917947ffeb7c power pc version
kono
parents: 88
diff changeset
441 arg_register(NMTBL *fnptr)
917947ffeb7c power pc version
kono
parents: 88
diff changeset
442 {
917947ffeb7c power pc version
kono
parents: 88
diff changeset
443 code_arg_register(fnptr->dsp);
917947ffeb7c power pc version
kono
parents: 88
diff changeset
444 }
917947ffeb7c power pc version
kono
parents: 88
diff changeset
445
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
446 /* goto arguments list */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
447 /* target list4(list2(tag,disp),cdr,ty,source_expr) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
448 /* source expr=listn(tag,...) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
449 /* source (after) list2(tag,disp) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
450 /* source list list3(e,cdr,sz) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
451
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
452 #define DEBUG_PARALLEL_ASSIGN 1
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
453
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
454 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
455 overrap(int t,int sz,int source)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
456 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
457 int s,s0,s1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
458 int t0=cadr(t);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
459 int t1=t0+sz;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
460 for(;source;source=cadr(source)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
461 s=car(source); s0=cadr(s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
462 if(car(s)==REGISTER && car(t)==REGISTER) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
463 if(s0==t0) return s;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
464 } else if (is_same_type(s,t)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
465 s1=s0+caddr(source);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
466 #if DEBUG_PARALLEL_ASSIGN>1
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
467 printf("# ovedrrap source %d t0 %d t1 %d\n",car(car(t)),t0,t1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
468 printf("# ovedrrap target %d s0 %d s1 %d\n",car(car(source)),s0,s1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
469 printf("# ovedrrap equal = %d\n",((t0<=s0&&s0<t1)||(t0<s1&&s1<=t1)));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
470 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
471 if((t0<=s0&&s0<t1)||(t0<s1&&s1<=t1)) return s;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
472 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
473 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
474 return 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
475 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
476
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
477 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
478 remove_target(int *target,int t,int *use)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
479 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
480 int use0=*use;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
481 while(use0) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
482 if (car(use0)==t) {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
483 if (car(caddr(use0))==REGISTER)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
484 free_register(cadr(caddr(use0)));
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
485 else if (car(caddr(use0))==DREGISTER)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
486 free_fregister(cadr(caddr(use0)));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
487 break;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
488 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
489 use0 = cadr(use0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
490 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
491 remove0(target,t);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
492 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
493
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
494 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
495 save_target(int t,int s,int *target,int *use,int sz,int ty)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
496 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
497 int e1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
498 /*新しいレジスタ(or スタック)を取得する*/
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
499 if (sz==size_of_int && (e1=get_register())!=-1) {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
500 e1=list2(REGISTER,e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
501 *use=list3(t,*use,e1);
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
502 g_expr_u(assign_expr0(e1,s,ty,ty));
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
503 *target = append4(*target,t,ty,e1);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
504 } else if (sz==size_of_double && (e1=get_fregister())!=-1) {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
505 e1=list2(DREGISTER,e1);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
506 *use=list3(t,*use,e1);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
507 g_expr_u(assign_expr0(e1,s,ty,ty));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
508 *target = append4(*target,t,ty,e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
509 } else {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
510 g_expr_u(assign_expr0((e1=list2(LVAR,new_lvar(sz))),s,ty,ty));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
511 *target = append4(*target,t,ty,e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
512 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
513 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
514
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
515 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
516 circular_dependency(int t,int s,int *target,int *source)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
517 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
518 int target0=*target;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
519 int t1,sz,ty,s1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
520 while(target0) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
521 if (cadddr(target0)==s) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
522 t1=car(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
523 s=cadddr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
524 sz=size(ty=caddr(target0));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
525 if(t==t1) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
526 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
527 printf("# circular dependency %d ty %d+%d sz %d\n",car(t1),ty,cadr(t1),sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
528 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
529 return 1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
530 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
531 if ((s1=overrap(t1,sz,*source))) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
532 /* another overrap start over */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
533 return circular_dependency(t,s1,target,source);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
534 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
535 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
536 target0=cadr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
537 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
538 return 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
539 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
540
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
541 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
542 parallel_assign(int *target,int *source,int *processing,int *use)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
543 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
544 int t,s,sz,ty,target0,s1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
545 while(*target) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
546 target0=*target;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
547 while(target0) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
548 t=car(target0); s=cadddr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
549 sz=size(ty=caddr(target0));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
550 if(car(t)==car(s) && cadr(t)==cadr(s)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
551 /*書き込み先が自分自身*/
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
552 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
553 printf("# remove same %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
554 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
555 remove_target(target,t,use);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
556 /* 破壊されては困るので、source listからは除かない */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
557 } else if (!(s1=overrap(t,sz,*source))) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
558 /* 重なってないので安心して書き込める */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
559 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
560 printf("# normal assign %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
561 #endif
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
562 g_expr_u(assign_expr0(t,s,ty,ty));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
563 remove_target(target,t,use); remove0(source,s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
564 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
565 if(circular_dependency(t,s1,target,source)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
566 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
567 printf("# saving %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
568 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
569 remove_target(target,t,use); remove0(source,s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
570 save_target(t,s,target,use,sz,ty);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
571 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
572 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
573 target0=cadr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
574 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
575 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
576 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
577
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
578 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
579 remove0(int *parent,int e)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
580 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
581 int list;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
582 while ((list=*parent)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
583 if (car(list)==e) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
584 *parent= cadr(list); return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
585 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
586 parent=&cadr(list);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
587 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
588 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
589 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
590
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
591 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
592 remove0_all(int *parent,int e)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
593 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
594 int list;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
595 while ((list=*parent)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
596 if (car(list)==e) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
597 *parent= cadr(list);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
598 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
599 parent=&cadr(list);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
600 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
601 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
602 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
603
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
604 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
605 is_simple(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
606 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
607 return (
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
608 e1==CONST || e1==FNAME || e1==LVAR || e1==REGISTER ||e1==DREGISTER ||
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
609 e1==GVAR || e1==RGVAR || e1==RLVAR || e1==CRLVAR || e1==CRGVAR ||
f94ca1168520 float first try...
kono
parents: 80
diff changeset
610 e1==DRLVAR || e1==FRLVAR
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
611 );
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
612 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
613
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
614 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
615 is_same_type(int e1,int e2)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
616 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
617 int ce1=car(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
618 int ce2=car(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
619 return (
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
620 (ce1==LVAR && (ce2==RLVAR||ce2==CRLVAR||ce2==FRLVAR||ce2==DRLVAR))
f94ca1168520 float first try...
kono
parents: 80
diff changeset
621 || (ce2==LVAR && (ce1==RLVAR||ce1==CRLVAR||ce1==FRLVAR||ce1==DRLVAR))
f94ca1168520 float first try...
kono
parents: 80
diff changeset
622 || (ce1==GVAR && (ce2==RGVAR||ce2==CRGVAR||ce2==FRGVAR||ce2==DRGVAR))
f94ca1168520 float first try...
kono
parents: 80
diff changeset
623 || (ce2==GVAR && (ce1==RGVAR||ce1==CRGVAR||ce1==FRGVAR||ce1==DRGVAR))
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
624 );
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
625 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
626
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
627 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
628 is_memory(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
629 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
630 int ce1=car(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
631 return (
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
632 ce1==LVAR ||ce1==RLVAR||ce1==CRLVAR || ce1==DRLVAR ||
f94ca1168520 float first try...
kono
parents: 80
diff changeset
633 ce1==GVAR ||ce1==RGVAR||ce1==CRGVAR || ce1==DRGVAR ||
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
634 ce1==REGISTER|| ce1==DREGISTER
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
635 );
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
636 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
637
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
638 int
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
639 is_code(NMTBL *fnptr)
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
640 {
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
641 int type = fnptr->ty;
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
642 return type==CODE|| (type>0 && car(type)==CODE);
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
643 }
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
644
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
645 int
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
646 is_function(NMTBL *fnptr)
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
647 {
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
648 int type = fnptr->ty;
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
649 return type==FUNCTION || (type>0 && car(type)==FUNCTION);
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
650 }
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
651
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
652
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
653 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
654 jump(int e1, int env)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
655 {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
656 int e2,e3,e4,sz,arg_size,ty,regs,fregs;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
657 int t0,s0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
658 NMTBL *code0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
659 int target = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
660 int source = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
661 int processing = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
662 int use = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
663
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
664 /* まず、サイズを計算しながら、決まった形に落す。 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
665
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
666 arg_size = 0; regs = 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
667 fregs = 0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
668 for (e3 = reverse0(caddr(e1)); e3; e3 = cadr(e3)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
669 e2 = car(e3); sz = size(ty=caddr(e3));
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
670 if (scalar(ty) && regs < max_input_register_var&&sz==size_of_int) {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
671 target=list4(list2(REGISTER,get_input_register_var(regs++)),
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
672 target,ty,e2);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
673 } else if ((ty==DOUBLE||ty==FLOAT) && fregs < max_input_fregister_var) {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
674 target=list4(list2(DREGISTER,get_input_fregister_var(fregs++)),
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
675 target,ty,e2);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
676 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
677 target=list4(list2(LVAR,0), target,ty,e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
678 arg_size += sz;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
679 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
680 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
681 printf("# target %d ty %d+%d sz %d\n",car(car(target)),ty,cadr(car(target)),sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
682 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
683 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
684
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
685 /* disp を飛び先似合わせて修正 */
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
686 if (is_code(fnptr)) {
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
687 if (-arg_size<disp) disp = -arg_size;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
688 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
689 if (disp_offset-arg_size<disp) disp = disp_offset-arg_size;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
690 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
691
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
692 /* 複雑な式を前もって計算しておく */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
693 /* 必要なら局所変数を用いる。 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
694 /* 局所変数へのオフセットを覚えておく */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
695
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
696 for (e2 = target; e2; e2 = cadr(e2)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
697 t0=car(e2); s0=cadddr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
698 sz=size(ty=caddr(e2));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
699 if(car(t0)==LVAR) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
700 /* ここで、書込先アドレスを決める */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
701 cadr(t0)=-arg_size;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
702 arg_size-=sz;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
703 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
704 if (!is_simple(car(s0))) {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
705 g_expr_u(assign_expr0((e4=list2(LVAR,new_lvar(sz))),s0,ty,ty));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
706 cadddr(e2)=e4;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
707 s0=e4;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
708 } else if (is_same_type(t0,s0)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
709 if(cadr(t0)==cadr(s0)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
710 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
711 printf("# remove same memory %d ty %d+%d sz %d\n",car(t0),ty,cadr(t0),sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
712 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
713 /* we should check size also (but currently useless */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
714 remove0(&target,t0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
715 /* still we have source to avoid overwrite */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
716 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
717 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
718 if(is_memory(s0)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
719 source=list3(s0,source,sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
720 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
721 printf("# source %d ty %d+%d sz %d\n",car(car(source)),ty,cadr(car(source)),sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
722 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
723 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
724 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
725
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
726 /* compute jump address */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
727 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
728 if (car(e2) == FNAME) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
729 code0=(NMTBL *)cadr(e2);
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
730 if (!is_code(code0)) {
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
731 error(TYERR); return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
732 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
733 } else { /* indirect */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
734 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
735 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
736 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
737 if (env) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
738 g_expr(env);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
739 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
740 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
741
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
742 /* 並列代入を実行 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
743
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
744 parallel_assign(&target,&source,&processing,&use);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
745 while (use) {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
746 if (car(caddr(use))==REGISTER)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
747 free_register(cadr(caddr(use)));
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
748 else if (car(caddr(use))==DREGISTER)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
749 free_fregister(cadr(caddr(use)));
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
750 use=cadr(use);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
751 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
752 if(target) error(-1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
753
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
754 if (env) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
755 /* change the frame pointer */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
756 e3 = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
757 code_frame_pointer(e3);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
758 emit_pop_free(e3);
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
759 } else if (is_function(fnptr)) {
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
760 code_fix_frame_pointer(disp_offset);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
761 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
762
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
763 if (car(e2) == FNAME) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
764 code_jmp(code0->nm);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
765 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
766 e2 = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
767 code_indirect_jmp(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
768 emit_pop_free(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
769 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
770 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
771
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
772 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
773 machinop(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
774 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
775 int e2,e3,op;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
776
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
777 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
778 op = car(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
779 e3 = caddr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
780 g_expr(e3);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
781 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
782 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
783 tosop(car(e1),(e2=pop_register()));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
784 emit_pop_free(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
785 regv[creg]=1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
786 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
787 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
788
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
789 void
f94ca1168520 float first try...
kono
parents: 80
diff changeset
790 dmachinop(int e1)
f94ca1168520 float first try...
kono
parents: 80
diff changeset
791 {
f94ca1168520 float first try...
kono
parents: 80
diff changeset
792 int e2,e3,op;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
793
f94ca1168520 float first try...
kono
parents: 80
diff changeset
794 e2 = cadr(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
795 op = car(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
796 e3 = caddr(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
797 g_expr(e3);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
798 emit_dpush();
f94ca1168520 float first try...
kono
parents: 80
diff changeset
799 g_expr(e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
800 dtosop(car(e1),(e2=emit_dpop(1)));
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
801 emit_dpop_free(e2);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
802 fregv[freg]=1;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
803 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
804 }
f94ca1168520 float first try...
kono
parents: 80
diff changeset
805
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
806
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
807 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
808 sassign(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
809 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
810 int e2,e3,e4,sz,xreg,det;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
811
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
812 /* structure assignment */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
813 e2 = cadr(e1); /* pointer variable to the struct */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
814 e3 = cadr(e2); /* offset of the variable (distination) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
815 e4 = caddr(e1); /* right value (source) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
816 sz = cadddr(e1); /* size of struct or union */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
817 g_expr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
818 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
819 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
820 xreg = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
821 /* 一般的にはコピーのオーバラップの状況は実行時にしかわからない */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
822 /* しかし、わかる場合もある */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
823 if (car(e4)==RSTRUCT) e4=cadr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
824 if (is_same_type(e2,e4)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
825 if(cadr(e2)<cadr(e4)) sz=-sz;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
826 det=1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
827 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
828 det = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
829 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
830 emit_copy(xreg,creg,sz,0,1,det);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
831 emit_pop_free(xreg);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
832 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
833 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
834
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
835 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
836 assign(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
837 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
838 int e2,e3,e4,byte;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
839
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
840 byte=(car(e1) == CASS);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
841 /* e2=e4 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
842 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
843 e3 = cadr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
844 e4 = caddr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
845 switch(car(e2)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
846 case GVAR: /* i=3 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
847 g_expr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
848 code_assign_gvar(e2,byte);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
849 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
850 case LVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
851 g_expr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
852 code_assign_lvar(lvar(cadr(e2)),byte);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
853 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
854 case REGISTER:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
855 g_expr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
856 if (creg!=cadr(e2))
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
857 code_assign_register(cadr(e2),byte);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
858 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
859 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
860 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
861 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
862 g_expr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
863 e2 = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
864 code_assign(e2,byte);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
865 emit_pop_free(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
866 regv[creg]=1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
867 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
868 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
869
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
870 void
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
871 dassign(int e1)
f94ca1168520 float first try...
kono
parents: 80
diff changeset
872 {
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
873 int e2,e3,e4,d;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
874
f94ca1168520 float first try...
kono
parents: 80
diff changeset
875 /* e2=e4 */
f94ca1168520 float first try...
kono
parents: 80
diff changeset
876 e2 = cadr(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
877 e3 = cadr(e2);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
878 e4 = caddr(e1);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
879 d = (car(e1)==LASS)?2:(car(e1)==DASS)?1:0;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
880 switch(car(e2)) {
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
881 case GVAR:
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
882 g_expr(e4);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
883 code_dassign_gvar(e2,d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
884 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
885 case LVAR:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
886 g_expr(e4);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
887 code_dassign_lvar(lvar(cadr(e2)),d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
888 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
889 }
f94ca1168520 float first try...
kono
parents: 80
diff changeset
890 g_expr(e2);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
891 emit_push();
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
892 g_expr(e4);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
893 e2 = emit_pop(0);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
894 code_dassign(e2,d);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
895 emit_pop_free(e2);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
896 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
897 }
f94ca1168520 float first try...
kono
parents: 80
diff changeset
898
f94ca1168520 float first try...
kono
parents: 80
diff changeset
899 void
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
900 assop(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
901 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
902 int e2,e3,byte,op;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
903
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
904 /* e2 op= e3 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
905 byte = (car(e1) == CASSOP);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
906 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
907 if (car(e2)==INDIRECT) e2=cadr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
908 e3 = caddr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
909 op = cadddr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
910
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
911 g_expr(e3);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
912 if (car(e2)==REGISTER) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
913 code_register_assop(cadr(e2),op,byte);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
914 regv[creg]=1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
915 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
916 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
917 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
918 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
919 code_assop(op,byte);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
920 regv[creg]=1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
921 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
922 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
923
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
924 void
f94ca1168520 float first try...
kono
parents: 80
diff changeset
925 dassop(int e1)
f94ca1168520 float first try...
kono
parents: 80
diff changeset
926 {
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
927 int e2,e3,op,d;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
928
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
929 /* e2 op= e3 */
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
930 d = (car(e1) == DASSOP);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
931 e2 = cadr(e1);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
932 if (car(e2)==INDIRECT) e2=cadr(e2);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
933 e3 = caddr(e1);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
934 op = cadddr(e1);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
935
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
936 g_expr(e3);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
937 emit_dpush();
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
938 g_expr(e2);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
939 code_dassop(op,d);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
940 regv[creg]=1;
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
941 return;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
942 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
943
95
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
944 void
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
945 cmpdimm(int e, int csreg)
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
946 {
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
947 code_cmpdimm(e, csreg);
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
948 }
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
949
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
950 int
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
951 csvalue()
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
952 {
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
953 return code_csvalue();
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
954 }
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
955
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
956
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
957 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
958 fwdlabel(void)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
959 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
960 return labelno++;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
961 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
962
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
963 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
964 fwddef(int l)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
965 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
966 control=1;
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
967 if (!chk)
92
e7f8515ba882 *** empty log message ***
kono
parents: 91
diff changeset
968 code_label(l);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
969 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
970
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
971 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
972 backdef(void)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
973 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
974 control=1;
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
975 if (!chk)
92
e7f8515ba882 *** empty log message ***
kono
parents: 91
diff changeset
976 code_label(labelno);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
977 return labelno++;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
978 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
979
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
980 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
981 def_label(int cslabel, int dlabel)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
982 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
983 int fl;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
984
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
985 fl = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
986 if (control) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
987 jmp(fl=fwdlabel());
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
988 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
989 fwddef(cslabel);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
990 if (dlabel)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
991 jmp(dlabel);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
992 if (fl) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
993 fwddef(fl);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
994 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
995 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
996
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
997 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
998 gen_source(char *s)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
999 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1000 printf("%s",s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1001 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1002
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1003 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1004 ret(void)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1005 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1006 code_set_fixed_creg(1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1007 jmp(retlabel);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1008 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1009
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1010 void
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1011 opening(char *filename)
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1012 {
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1013 emit_init();
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1014 if (!chk)
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1015 code_opening(filename);
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1016 }
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1017
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1018 void
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1019 closing()
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1020 {
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1021 if (!chk)
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1022 code_closing();
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1023 }
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1024
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1025 int
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1026 contains_in_list(int e,int type)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1027 {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1028 while(e) {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1029 if(contains(car(e),type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1030 e = cadr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1031 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1032 return 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1033 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1034
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1035 int
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1036 contains(int e,int type)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1037 {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1038 while(e) {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1039 if (car(e)==type) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1040 switch (car(e)){
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1041 /* list arguments */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1042 case FUNCTION: case CODE:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1043 return contains_in_list(caddr(e),type);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1044 /* unary operators */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1045 case INDIRECT: case RINDIRECT: case CRINDIRECT:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1046 case DRINDIRECT: case FRINDIRECT: case ADDRESS: case MINUS: case DMINUS:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1047 case I2D: case D2I: case U2D: case D2U: case BNOT: case LNOT:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1048 case PREINC: case POSTINC: case DPREINC: case DPOSTINC:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1049 case FPREINC: case FPOSTINC: case CPOSTINC:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1050 case CPREINC: case CPOSTDEC: case CPREDEC:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1051 case RSTRUCT:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1052 e = cadr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1053 continue;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1054 /* biary operators */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1055 case MUL: case UMUL: case DIV: case UDIV: case MOD: case UMOD:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1056 case LSHIFT: case ULSHIFT: case RSHIFT: case URSHIFT:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1057 case ADD: case SUB: case BAND: case EOR: case BOR: case CMP:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1058 case DMUL: case DDIV: case DADD: case DSUB: case DCMP: case DCMPGE:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1059 case SASS: case ASS: case CASS: case FASS: case DASS: case LASS:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1060 case ASSOP: case CASSOP: case DASSOP: case FASSOP: case COMMA:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1061 if (contains(cadr(e),type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1062 e = caddr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1063 continue;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1064 /* tarary operators */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1065 case COND:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1066 if (contains(cadr(e), type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1067 if (contains(caddr(e),type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1068 e = cadddr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1069 continue;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1070 default:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1071 /* nullary operators
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1072 case GVAR: case RGVAR: case CRGVAR: case LVAR:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1073 case REGISTER: case DREGISTER:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1074 case RLVAR: case CRLVAR: case FRLVAR: case FRGVAR:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1075 case DRLVAR: case DRGVAR:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1076 case FNAME: case CONST: case DCONST: case STRING:
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1077 case RETURN: case ENVIRONMENT: */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1078 return 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1079 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1080 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1081 return 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1082 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1083
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1084 /* end */