annotate mc-codegen.c @ 297:0f79c95df73a

switch index no compile error
author kono
date Sun, 06 Jun 2004 20:19:36 +0900
parents 284aa4eaab0d
children 117baacd1ed0
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
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
9 int use; /* generated value will be used */
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
10
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
11 static void remove0(int *parent,int e) ;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
12 /* static void remove0_all(int *parent,int e) ; */
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
13 static int is_same_type(int e1,int e2);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
14 static void jump(int e1, int env);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
15 static void machinop(int e1);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
16 static void sassign(int e1);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
17 static void assign(int e1);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
18 static void assop(int e1);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
19 static int g_expr0(int e1);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
20 static int register_to_lvar(int e);
289
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
21 static void bexpr_u(int e1, char cond, int l1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
22
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
23 #if FLOAT_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
24
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
25 /* floating point */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
26
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
27 static void dassop(int e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
28 static void dmachinop(int e1,int d);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
29 static void dassign(int e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
30
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
31 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
32 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
33 static void lassop(int e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
34 static void lmachinop(int e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
35 static void lassign(int e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
36 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
37
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
38
102
3cf2f8c120b9 *** empty log message ***
kono
parents: 99
diff changeset
39 void
3cf2f8c120b9 *** empty log message ***
kono
parents: 99
diff changeset
40 codegen_init()
3cf2f8c120b9 *** empty log message ***
kono
parents: 99
diff changeset
41 {
3cf2f8c120b9 *** empty log message ***
kono
parents: 99
diff changeset
42 code_init();
3cf2f8c120b9 *** empty log message ***
kono
parents: 99
diff changeset
43 }
3cf2f8c120b9 *** empty log message ***
kono
parents: 99
diff changeset
44
137
9fb09db54436 fix powerpc get_fregister_var's regs error.
kono
parents: 135
diff changeset
45 void
9fb09db54436 fix powerpc get_fregister_var's regs error.
kono
parents: 135
diff changeset
46 arg_register(NMTBL *fnptr)
9fb09db54436 fix powerpc get_fregister_var's regs error.
kono
parents: 135
diff changeset
47 {
9fb09db54436 fix powerpc get_fregister_var's regs error.
kono
parents: 135
diff changeset
48 code_arg_register(fnptr);
9fb09db54436 fix powerpc get_fregister_var's regs error.
kono
parents: 135
diff changeset
49 }
9fb09db54436 fix powerpc get_fregister_var's regs error.
kono
parents: 135
diff changeset
50
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
51 int
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
52 gexpr(int e1,int use0)
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
53 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
54 if (chk) return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
55 gexpr_init();
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
56 use = use0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
57 #if 0
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
58 if(lineno==2862) {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
59 return g_expr0(e1); /*break here*/
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
60 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
61 #endif
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
62 return g_expr0(e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
63 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
64
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
65 int
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
66 g_expr_u(int e1)
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
67 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
68 int t;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
69 int suse = use; use=0;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
70 t=g_expr0(e1);
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
71 code_gexpr(e1);
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
72
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
73 use=suse;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
74 return t;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
75 }
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
76
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
77 int
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
78 g_expr(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
79 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
80 int t;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
81 int suse = use; use=1;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
82 t=g_expr0(e1);
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
83 code_gexpr(e1);
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
84
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
85 use=suse;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
86 return t;
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
87 }
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
88
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
89 int
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
90 g_expr0(int e1)
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
91 {
191
8646a4a9cde9 *** empty log message ***
kono
parents: 189
diff changeset
92 int e2,e3,t,d,t1;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
93 NMTBL *n;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
94
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
95 code_gexpr(e1);
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
96
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
97 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
98 switch (car(e1)){
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
99 case GVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
100 code_gvar(e1,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
101 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
102 case RGVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
103 code_rgvar(e1,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
104 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
105 case CRGVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
106 code_crgvar(e1,USE_CREG,1,1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
107 return CHAR;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
108 case CURGVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
109 code_crgvar(e1,USE_CREG,0,1);
165
kono
parents: 164
diff changeset
110 return UCHAR;
kono
parents: 164
diff changeset
111 case SRGVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
112 code_crgvar(e1,USE_CREG,1,size_of_short);
165
kono
parents: 164
diff changeset
113 return CHAR;
kono
parents: 164
diff changeset
114 case SURGVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
115 code_crgvar(e1,USE_CREG,0,size_of_short);
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
116 return UCHAR;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
117 case LVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
118 code_lvar(e2,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
119 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
120 case REGISTER:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
121 code_register(e2,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
122 return INT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
123 #if FLOAT_CODE
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
124 case DREGISTER:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
125 code_dregister(e2,USE_CREG,1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
126 return DOUBLE;
137
9fb09db54436 fix powerpc get_fregister_var's regs error.
kono
parents: 135
diff changeset
127 case FREGISTER:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
128 code_dregister(e2,USE_CREG,0);
137
9fb09db54436 fix powerpc get_fregister_var's regs error.
kono
parents: 135
diff changeset
129 return FLOAT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
130 #endif
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
131 #if LONGLONG_CODE
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
132 case LREGISTER:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
133 code_lregister(e2,USE_CREG);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
134 return LONGLONG;
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
135 #endif
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
136 case RLVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
137 code_rlvar(e2,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
138 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
139 case CRLVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
140 code_crlvar(e2,USE_CREG,1,1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
141 return CHAR;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
142 case CURLVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
143 code_crlvar(e2,USE_CREG,0,1);
165
kono
parents: 164
diff changeset
144 return UCHAR;
kono
parents: 164
diff changeset
145 case SRLVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
146 code_crlvar(e2,USE_CREG,1,size_of_short);
165
kono
parents: 164
diff changeset
147 return CHAR;
kono
parents: 164
diff changeset
148 case SURLVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
149 code_crlvar(e2,USE_CREG,0,size_of_short);
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
150 return UCHAR;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
151 #if FLOAT_CODE
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
152 case FRLVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
153 code_drlvar(e2,0,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
154 return FLOAT;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
155 case FRGVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
156 code_drgvar(e1,0,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
157 return FLOAT;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
158 case DRLVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
159 code_drlvar(e2,1,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
160 return DOUBLE;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
161 case DRGVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
162 code_drgvar(e1,1,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
163 return DOUBLE;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
164 #endif
202
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
165 #if LONGLONG_CODE
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
166 case LRLVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
167 code_lrlvar(e2,USE_CREG);
202
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
168 return LONGLONG;
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
169 case LRGVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
170 code_lrgvar(e1,USE_CREG);
202
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
171 return LONGLONG;
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
172 case LURLVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
173 code_lrlvar(e2,USE_CREG);
202
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
174 return ULONGLONG;
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
175 case LURGVAR:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
176 code_lrgvar(e1,USE_CREG);
202
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
177 return ULONGLONG;
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
178 #endif
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
179 case FNAME:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
180 code_fname((NMTBL *)(e2),USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
181 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
182 case CONST: /* ÂåÆþ¤¹¤ëÃͤ¬0¤Ç¤âÆÃÊ̤ʽèÍý¤Ï¤·¤Ê¤¤ */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
183 code_const(e2,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
184 return INT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
185 #if FLOAT_CODE
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
186 case DCONST:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
187 code_dconst(e1,USE_CREG,1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
188 return DOUBLE;
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
189 case FCONST:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
190 code_dconst(e1,USE_CREG,0);
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
191 return FLOAT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
192 #endif
206
4170cefb48f6 *** empty log message ***
kono
parents: 205
diff changeset
193 #if LONGLONG_CODE
202
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
194 case LCONST:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
195 code_lconst(e1,USE_CREG);
202
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
196 return LONGLONG;
601301152d9c *** empty log message ***
kono
parents: 197
diff changeset
197 #endif
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
198 case STRING:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
199 code_string(e1,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
200 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
201 case FUNCTION:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
202 t = function(e1);
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
203 return t;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
204 case CODE:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
205 jump(e2,caddr(e1));
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
206 return VOID;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
207 case INDIRECT:
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
208 return g_expr0(e2);
196
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
209 case RINDIRECT:
245
8a72b0afccfc *** empty log message ***
kono
parents: 240
diff changeset
210 return code_rindirect(e2,USE_CREG,caddr(e1),1);
196
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
211 case URINDIRECT:
245
8a72b0afccfc *** empty log message ***
kono
parents: 240
diff changeset
212 return code_rindirect(e2,USE_CREG,caddr(e1),0);
196
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
213 case CRINDIRECT:
245
8a72b0afccfc *** empty log message ***
kono
parents: 240
diff changeset
214 return code_crindirect(e2,USE_CREG,caddr(e1),1);
196
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
215 case CURINDIRECT:
245
8a72b0afccfc *** empty log message ***
kono
parents: 240
diff changeset
216 return code_crindirect(e2,USE_CREG,caddr(e1),0);
196
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
217 case SRINDIRECT:
245
8a72b0afccfc *** empty log message ***
kono
parents: 240
diff changeset
218 return code_srindirect(e2,USE_CREG,caddr(e1),1);
8a72b0afccfc *** empty log message ***
kono
parents: 240
diff changeset
219 case SURINDIRECT:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
220 return code_srindirect(e2,USE_CREG,caddr(e1),0);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
221 #if FLOAT_CODE
197
b5f49f32c2ee *** empty log message ***
kono
parents: 196
diff changeset
222 case FRINDIRECT:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
223 return code_drindirect(e2,USE_CREG,caddr(e1),0);
196
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
224 case DRINDIRECT:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
225 return code_drindirect(e2,USE_CREG,caddr(e1),1);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
226 #endif
196
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
227 #if LONGLONG_CODE
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
228 case LRINDIRECT:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
229 return code_lrindirect(e2,USE_CREG,caddr(e1),0);
196
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
230 case LURINDIRECT:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
231 return code_lrindirect(e2,USE_CREG,caddr(e1),1);
196
5f70abd9453d *** empty log message ***
kono
parents: 195
diff changeset
232 #endif
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
233 case ADDRESS:
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
234 if (car(e2)==REGISTER||car(e2)==DREGISTER||car(e2)==FREGISTER)
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
235 return register_to_lvar(e2); /* too late? */
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
236 else
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
237 return g_expr0(e2);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
238 case MINUS: /* ¥ì¥¸¥¹¥¿¤ËÂФ·¡¢negl¤ò¼Â¹Ô¤¹¤ì¤Ð¼Â¸½²Äǽ */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
239 g_expr0(e2); code_neg(USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
240 return INT;
212
32f54ab63b35 *** empty log message ***
kono
parents: 210
diff changeset
241 #if LONGLONG_CODE
32f54ab63b35 *** empty log message ***
kono
parents: 210
diff changeset
242 case LMINUS:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
243 g_expr0(e2); code_lneg(USE_CREG);
212
32f54ab63b35 *** empty log message ***
kono
parents: 210
diff changeset
244 return LONGLONG;
32f54ab63b35 *** empty log message ***
kono
parents: 210
diff changeset
245 #endif
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
246 #if FLOAT_CODE
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
247 case DMINUS:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
248 g_expr0(e2); code_dneg(USE_CREG,1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
249 return DOUBLE;
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
250 case FMINUS:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
251 g_expr0(e2); code_dneg(USE_CREG,0);
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
252 return FLOAT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
253 #endif
108
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
254 case CONV:
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
255 g_expr0(e2);
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
256 switch(caddr(e1)) {
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
257 #if FLOAT_CODE
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
258 case I2D: code_i2d(USE_CREG); return DOUBLE;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
259 case D2I: code_d2i(USE_CREG); return INT;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
260 case U2D: code_u2d(USE_CREG); return DOUBLE;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
261 case F2U: code_f2u(USE_CREG); return UNSIGNED;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
262 case I2F: code_i2f(USE_CREG); return FLOAT;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
263 case F2I: code_f2i(USE_CREG); return INT;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
264 case U2F: code_u2f(USE_CREG); return FLOAT;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
265 case D2U: code_d2u(USE_CREG); return UNSIGNED;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
266 case D2F: code_d2f(USE_CREG); return FLOAT;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
267 case F2D: code_f2d(USE_CREG); return DOUBLE;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
268 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
269 #if LONGLONG_CODE
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
270 case I2LL: code_i2ll(USE_CREG); return LONGLONG;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
271 case I2ULL: code_i2ull(USE_CREG); return ULONGLONG;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
272 case U2LL: code_u2ll(USE_CREG); return LONGLONG;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
273 case U2ULL: code_u2ull(USE_CREG); return ULONGLONG;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
274 case LL2I: code_ll2i(USE_CREG); return INT;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
275 case LL2U: code_ll2u(USE_CREG); return UNSIGNED;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
276 case ULL2I: code_ull2i(USE_CREG); return INT;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
277 case ULL2U: code_ull2u(USE_CREG); return UNSIGNED;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
278 #if FLOAT_CODE
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
279 case D2LL: code_d2ll(USE_CREG); return LONGLONG;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
280 case D2ULL: code_d2ull(USE_CREG); return ULONGLONG;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
281 case F2LL: code_f2ll(USE_CREG); return LONGLONG;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
282 case F2ULL: code_f2ull(USE_CREG); return ULONGLONG;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
283 case LL2D: code_ll2d(USE_CREG); return DOUBLE;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
284 case LL2F: code_ll2f(USE_CREG); return FLOAT;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
285 case ULL2D: code_ull2d(USE_CREG); return DOUBLE;
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
286 case ULL2F: code_ull2f(USE_CREG); return FLOAT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
287 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
288 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
289
108
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
290 default:
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
291 error(-1); return INT;
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
292 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
293 case BNOT: /* ~ */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
294 g_expr0(e2); code_not(USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
295 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
296 case LNOT: /* ! */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
297 g_expr0(e2); code_lnot(USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
298 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
299 case PREINC:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
300 code_preinc(e1,e2,caddr(e1),1,cadddr(e1),USE_CREG);
168
b1297c82e926 cpostinc removal
kono
parents: 167
diff changeset
301 return INT;
b1297c82e926 cpostinc removal
kono
parents: 167
diff changeset
302 case UPREINC:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
303 code_preinc(e1,e2,caddr(e1),0,cadddr(e1),USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
304 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
305 case POSTINC:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
306 code_postinc(e1,e2,caddr(e1),1,cadddr(e1),USE_CREG);
168
b1297c82e926 cpostinc removal
kono
parents: 167
diff changeset
307 return INT;
b1297c82e926 cpostinc removal
kono
parents: 167
diff changeset
308 case UPOSTINC:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
309 code_postinc(e1,e2,caddr(e1),0,cadddr(e1),USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
310 return INT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
311 #if FLOAT_CODE
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
312 case DPREINC: /* ++d */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
313 code_dpreinc(e1,e2,1,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
314 return DOUBLE;
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
315 case DPOSTINC: /* d++ */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
316 code_dpostinc(e1,e2,1,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
317 return DOUBLE;
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
318 case FPREINC: /* ++f */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
319 code_dpreinc(e1,e2,0,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
320 return FLOAT;
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
321 case FPOSTINC: /* f++ */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
322 code_dpostinc(e1,e2,0,USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
323 return FLOAT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
324 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
325 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
326 case LPREINC: /* ++d */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
327 code_lpreinc(e1,e2,USE_CREG);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
328 return LONGLONG;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
329 case LPOSTINC: /* d++ */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
330 code_lpostinc(e1,e2,USE_CREG);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
331 return LONGLONG;
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
332 case LUPREINC: /* ++d */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
333 code_lpreinc(e1,e2,USE_CREG);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
334 return ULONGLONG;
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
335 case LUPOSTINC: /* d++ */
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
336 code_lpostinc(e1,e2,USE_CREG);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
337 return ULONGLONG;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
338 #endif
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
339 case MUL: case UMUL:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
340 case DIV: case UDIV:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
341 case MOD: case UMOD:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
342 case LSHIFT: case ULSHIFT: case RSHIFT: case URSHIFT:
246
0dcc0ec81ed2 MIPS on going (90%)
kono
parents: 245
diff changeset
343 case ADD: case SUB: case BAND: case EOR: case BOR: case CMP: case CMPGE:
278
5b50813d0c45 MIPS 90% test passed. Self compile core dumped.
kono
parents: 277
diff changeset
344 case UCMP: case CMPEQ: case CMPNEQ: case UCMPGE:
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
345 machinop(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
346 return INT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
347 #if FLOAT_CODE
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
348 case DMUL: case DDIV:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
349 case DADD: case DSUB:
250
7637295c4fb8 *** empty log message ***
kono
parents: 249
diff changeset
350 case DCMP: case DCMPGE: case DCMPEQ: case DCMPNEQ:
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
351 dmachinop(e1,1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
352 return DOUBLE;
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
353 case FMUL: case FDIV:
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
354 case FADD: case FSUB:
250
7637295c4fb8 *** empty log message ***
kono
parents: 249
diff changeset
355 case FCMP: case FCMPGE: case FCMPEQ: case FCMPNEQ:
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
356 dmachinop(e1,0);
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
357 return FLOAT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
358 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
359 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
360 case LMUL: case LUMUL:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
361 case LDIV: case LUDIV:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
362 case LMOD: case LUMOD:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
363 case LLSHIFT: case LULSHIFT: case LRSHIFT: case LURSHIFT:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
364 case LADD: case LSUB: case LBAND: case LEOR: case LBOR: case LCMP:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
365 lmachinop(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
366 return INT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
367 #endif
222
3d214303bae9 *** empty log message ***
kono
parents: 221
diff changeset
368 case LCOND:
3d214303bae9 *** empty log message ***
kono
parents: 221
diff changeset
369 case DCOND:
3d214303bae9 *** empty log message ***
kono
parents: 221
diff changeset
370 case FCOND:
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
371 case COND: /* a?0:1 should consider non-brach instruction */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
372 d = (car(e1)==LCOND?LONGLONG:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
373 car(e1)==COND?INT:car(e1)==DCOND?DOUBLE:FLOAT);
108
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
374 e2=fwdlabel();
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
375 b_expr(cadr(e1),0,e2,0);
187
dffcccf8b1cb nested COND
kono
parents: 186
diff changeset
376 g_expr0(caddr(e1));
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
377 t = code_get_fixed_creg(USE_CREG,d);
108
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
378 jmp(e3=fwdlabel());
69e2e763cce5 object assemble first try.
kono
parents: 107
diff changeset
379 fwddef(e2);
191
8646a4a9cde9 *** empty log message ***
kono
parents: 189
diff changeset
380 t1=g_expr0(cadddr(e1));
187
dffcccf8b1cb nested COND
kono
parents: 186
diff changeset
381 code_set_fixed_creg(t,1,d);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
382 fwddef(e3);
191
8646a4a9cde9 *** empty log message ***
kono
parents: 189
diff changeset
383 return t1;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
384 case STASS:
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
385 sassign(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
386 return RSTRUCT;
165
kono
parents: 164
diff changeset
387 case ASS: case CASS: case SASS:
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
388 assign(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
389 return INT;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
390 case ASSOP: case CASSOP: case CUASSOP:
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
391 assop(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
392 return INT;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
393 #if FLOAT_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
394 case FASS: case DASS:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
395 dassign(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
396 return DOUBLE;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
397 case DASSOP: case FASSOP:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
398 dassop(e1);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
399 return DOUBLE;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
400 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
401 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
402 case LASS:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
403 lassign(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
404 return LONGLONG;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
405 case LASSOP: case LUASSOP:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
406 lassop(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
407 return LONGLONG ;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
408 #endif
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
409 case RSTRUCT:
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
410 g_expr0(e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
411 return RSTRUCT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
412 case COMMA:
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
413 g_expr_u(e2);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
414 return g_expr0(caddr(e1));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
415 case RETURN:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
416 n = (NMTBL *)e2;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
417 if (retcont==0)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
418 retcont=fwdlabel();
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
419 code_return(USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
420 return VOID;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
421 case ENVIRONMENT:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
422 code_environment(USE_CREG);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
423 return ADDRESS;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
424 default:
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
425 code_bool(e1,USE_CREG); /* type? */
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
426 return INT;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
427 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
428 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
429
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
430 #define dual_ops(op) \
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
431 (op==GT|| op==UGT|| op==GE|| op==UGE|| op==LT|| \
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
432 op==ULT|| op==LE|| op==ULE|| \
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
433 op==DOP+GT|| op==DOP+GE|| op==DOP+LT|| op==DOP+LE || \
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
434 op==FOP+GT|| op==FOP+GE|| op==FOP+LT|| op==FOP+LE || \
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
435 op==FOP+EQ|| op==FOP+NEQ || \
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
436 op==EQ|| op==NEQ|| op==DOP+EQ|| op==DOP+NEQ)
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
437
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
438 int
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
439 rop_dual(op)
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
440 {
232
8a23c20ac92d *** empty log message ***
kono
parents: 231
diff changeset
441 // x op y => y dual(op) x
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
442 switch(op) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
443 case GT: return LT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
444 case UGT: return ULT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
445 case GE: return LE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
446 case UGE: return ULE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
447 case LT: return GT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
448 case ULT: return UGT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
449 case LE: return GE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
450 case ULE: return UGE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
451 case DOP+GT: return DOP+LT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
452 case DOP+GE: return DOP+LE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
453 case DOP+LT: return DOP+GT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
454 case DOP+LE: return DOP+GE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
455 case FOP+GT: return FOP+LT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
456 case FOP+GE: return FOP+LE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
457 case FOP+LT: return FOP+GT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
458 case FOP+LE: return FOP+GE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
459
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
460 case LOP+GT: return LOP+LT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
461 case LOP+GE: return LOP+LE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
462 case LOP+LT: return LOP+GT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
463 case LOP+LE: return LOP+GE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
464 case LOP+UGT: return FOP+ULT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
465 case LOP+UGE: return FOP+ULE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
466 case LOP+ULT: return FOP+UGT;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
467 case LOP+ULE: return FOP+UGE;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
468 }
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
469 return op;
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
470 }
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
471
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
472 void
289
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
473 bexpr_u(int e1, char cond, int l1)
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
474 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
475 int op = car(e1);
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
476 if (chk) return;
292
6d4231b6f9fe switch statement prepare
kono
parents: 289
diff changeset
477 // gexpr_init();
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
478 if (dual_ops(op) && (car(caddr(e1))==CONST||(car(caddr(e1))==DCONST)))
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
479 b_expr(list3(rop_dual(op),caddr(e1),cadr(e1)),cond,l1,0);
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
480 else
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
481 b_expr(e1,cond,l1,0);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
482 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
483
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
484 void
289
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
485 bexpr(int e1, char cond, int l1)
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
486 {
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
487 int uses = use; use=1;
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
488 bexpr_u(e1, cond, l1);
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
489 use = uses;
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
490 }
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
491
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
492 void
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
493 b_expr(int e1, char cond, int l1,int err)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
494 {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
495 int e2,l2,t;
132
07eb1249f07a *** empty log message ***
kono
parents: 128
diff changeset
496 if (!control) return;
127
eb4d8975926c Intel float fix
kono
parents: 126
diff changeset
497 l2 = 0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
498 e2=cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
499 switch(car(e1)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
500 case LNOT:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
501 b_expr(e2,!cond,l1,0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
502 return;
280
affb054fe920 lrexpr fix. rexpr in MIPS fix.
kono
parents: 278
diff changeset
503 case GT: case GE: case LT: case LE:
affb054fe920 lrexpr fix. rexpr in MIPS fix.
kono
parents: 278
diff changeset
504 case EQ: case NEQ:
affb054fe920 lrexpr fix. rexpr in MIPS fix.
kono
parents: 278
diff changeset
505 rexpr(e1,l1,cond,INT);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
506 return;
280
affb054fe920 lrexpr fix. rexpr in MIPS fix.
kono
parents: 278
diff changeset
507 case UGT: case UGE: case ULT: case ULE:
affb054fe920 lrexpr fix. rexpr in MIPS fix.
kono
parents: 278
diff changeset
508 rexpr(e1,l1,cond,UNSIGNED);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
509 return;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
510 #if FLOAT_CODE
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
511 case DOP+GT:
194
114e9d64b5cc *** empty log message ***
kono
parents: 191
diff changeset
512 case DOP+GE:
114e9d64b5cc *** empty log message ***
kono
parents: 191
diff changeset
513 case DOP+EQ:
114e9d64b5cc *** empty log message ***
kono
parents: 191
diff changeset
514 case DOP+NEQ:
114e9d64b5cc *** empty log message ***
kono
parents: 191
diff changeset
515 case FOP+GT:
114e9d64b5cc *** empty log message ***
kono
parents: 191
diff changeset
516 case FOP+GE:
114e9d64b5cc *** empty log message ***
kono
parents: 191
diff changeset
517 case FOP+EQ:
114e9d64b5cc *** empty log message ***
kono
parents: 191
diff changeset
518 case FOP+NEQ:
229
d793c84b3679 *** empty log message ***
kono
parents: 223
diff changeset
519 drexpr(cadr(e1),caddr(e1),l1,car(e1),cond);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
520 return;
194
114e9d64b5cc *** empty log message ***
kono
parents: 191
diff changeset
521 case FOP+LT:
231
f5efe15629d4 *** empty log message ***
kono
parents: 230
diff changeset
522 case FOP+LE:
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
523 case DOP+LT:
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
524 case DOP+LE:
232
8a23c20ac92d *** empty log message ***
kono
parents: 231
diff changeset
525 drexpr(caddr(e1),cadr(e1),l1,rop_dual(car(e1)),cond);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
526 return;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
527 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
528 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
529 case LOP+GT:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
530 case LOP+GE:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
531 case LOP+EQ:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
532 case LOP+NEQ:
210
f21651f85344 *** empty log message ***
kono
parents: 206
diff changeset
533 case LOP+UGT:
f21651f85344 *** empty log message ***
kono
parents: 206
diff changeset
534 case LOP+UGE:
231
f5efe15629d4 *** empty log message ***
kono
parents: 230
diff changeset
535 lrexpr(cadr(e1),caddr(e1),l1,car(e1),cond);
210
f21651f85344 *** empty log message ***
kono
parents: 206
diff changeset
536 return;
232
8a23c20ac92d *** empty log message ***
kono
parents: 231
diff changeset
537 case LOP+LT:
8a23c20ac92d *** empty log message ***
kono
parents: 231
diff changeset
538 case LOP+LE:
210
f21651f85344 *** empty log message ***
kono
parents: 206
diff changeset
539 case LOP+ULT:
f21651f85344 *** empty log message ***
kono
parents: 206
diff changeset
540 case LOP+ULE:
232
8a23c20ac92d *** empty log message ***
kono
parents: 231
diff changeset
541 lrexpr(caddr(e1),cadr(e1),l1,rop_dual(car(e1)),cond);
210
f21651f85344 *** empty log message ***
kono
parents: 206
diff changeset
542 return;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
543 #endif
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
544 case LAND:
289
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
545 bexpr(e2,0,cond?(l2=fwdlabel()):l1);
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
546 bexpr_u(caddr(e1),cond,l1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
547 if(cond) fwddef(l2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
548 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
549 case LOR:
289
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
550 bexpr(e2,1,cond?l1:(l2=fwdlabel()));
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
551 bexpr_u(caddr(e1),cond,l1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
552 if(!cond) fwddef(l2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
553 return;
167
0197ca125567 mips short
kono
parents: 166
diff changeset
554 case CRGVAR: case CURGVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
555 code_cmp_crgvar(e1,USE_CREG,1,l1,cond);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
556 return;
167
0197ca125567 mips short
kono
parents: 166
diff changeset
557 case SRGVAR: case SURGVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
558 code_cmp_crgvar(e1,USE_CREG,size_of_short,l1,cond);
167
0197ca125567 mips short
kono
parents: 166
diff changeset
559 return;
0197ca125567 mips short
kono
parents: 166
diff changeset
560 case CRLVAR: case CURLVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
561 code_cmp_crlvar(e2,USE_CREG,1,l1,cond);
167
0197ca125567 mips short
kono
parents: 166
diff changeset
562 return;
0197ca125567 mips short
kono
parents: 166
diff changeset
563 case SRLVAR: case SURLVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
564 code_cmp_crlvar(e2,USE_CREG,size_of_short,l1,cond);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
565 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
566 case RGVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
567 code_cmp_rgvar(e1,USE_CREG,l1,cond);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
568 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
569 case RLVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
570 code_cmp_rlvar(e2,USE_CREG,l1,cond);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
571 return;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
572 #if FLOATC_DOE
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
573 case DRLVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
574 code_cmp_drlvar(e2,USE_CREG,1,l1,cond);
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
575 return;
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
576 case FRLVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
577 code_cmp_drlvar(e2,USE_CREG,0,l1,cond);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
578 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
579 case DRGVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
580 code_cmp_drgvar(e2,USE_CREG,1,l1,cond);
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
581 return;
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
582 case FRGVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
583 code_cmp_drgvar(e2,USE_CREG,0,l1,cond);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
584 return;
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
585 case FREGISTER:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
586 code_cmp_dregister(e2,0,l1,cond);
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
587 return;
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
588 case DREGISTER:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
589 code_cmp_dregister(e2,1,l1,cond);
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
590 return;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
591 case DCONST:
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
592 case FCONST:
132
07eb1249f07a *** empty log message ***
kono
parents: 128
diff changeset
593 if(control&&((dcadr(e2)!=0.0)^cond)) jmp(l1);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
594 return;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
595 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
596 #if LONGLONG_DOE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
597 case LRLVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
598 code_cmp_lrlvar(e2,1,l1,cond);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
599 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
600 case LRGVAR:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
601 code_cmp_lrgvar(e2,1,l1,cond);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
602 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
603 case LREGISTER:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
604 code_cmp_lregister(e2,1,l1,cond);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
605 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
606 case LCONST:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
607 if(control&&((lcadr(e2)!=0)^cond)) jmp(l1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
608 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
609 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
610 case REGISTER:
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
611 code_cmp_register(e2,l1,cond);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
612 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
613 case CONST:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
614 if(control&&((cond&&e2)||(!cond&&!e2))) jmp(l1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
615 return;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
616 default:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
617 if(err) {
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
618 error(-1); return; /* recursive g_expr/b_expr */
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
619 }
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
620 t=g_expr(e1);
289
55e611476cba *** empty log message ***
kono
parents: 287
diff changeset
621 if (!use) return;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
622 if (0) ;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
623 #if FLOAT_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
624 else if(t==FLOAT)
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
625 code_cmp_dregister(USE_CREG,0,l1,cond);
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
626 else if(t==DOUBLE)
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
627 code_cmp_dregister(USE_CREG,1,l1,cond);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
628 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
629 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
630 else if(t==LONGLONG||t==ULONGLONG)
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
631 code_cmp_lregister(USE_CREG,l1,cond);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
632 #endif
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
633 else
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
634 code_cmp_register(USE_CREG,l1,cond);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
635 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
636 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
637 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
638
126
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
639 int
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
640 is_code(NMTBL *fnptr)
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
641 {
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
642 int type = fnptr->ty;
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
643 return type==CODE|| (type>0 && car(type)==CODE);
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
644 }
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
645
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
646 int
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
647 is_function(NMTBL *fnptr)
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
648 {
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
649 int type = fnptr->ty;
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
650 return type==FUNCTION || (type>0 && car(type)==FUNCTION);
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
651 }
1d1612fe705a *** empty log message ***
kono
parents: 119
diff changeset
652
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
653
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
654 static int
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
655 register_to_lvar(int e)
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
656 {
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
657 error(REG_ERR);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
658 return 0;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
659 #if 0
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
660 ÅÓÃæ¤Ç¥ì¥¸¥¹¥¿¤«¤éLVAR¤ËÊѹ¹¤·¤Æ¤â¡¢´Ö¤Ë¹ç¤ï¤Ê¤¤¡£
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
661
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
662 NMTBL *n = (NMTBL*)caddr(e);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
663 int reg = cadr(e);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
664 int tag = car(e);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
665 int lvar;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
666 int t;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
667 if (!n||n==&null_nptr) error(REG_ERR);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
668 if (tag==REGISTER) {
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
669 n->dsp = new_lvar(size_of_int);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
670 t = INT;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
671 } else if (tag==DREGISTER) {
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
672 n->dsp = new_lvar(size_of_double);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
673 t = DOUBLE;
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
674 } else if (tag==FREGISTER) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
675 n->dsp = new_lvar(size_of_float);
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
676 t = DOUBLE;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
677 } else if (tag==LREGISTER) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
678 n->dsp = new_lvar(size_of_longlong);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
679 t = LONGLONG;
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
680 } else error(-1);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
681 n->sc = LVAR;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
682 lvar = list2(LVAR,n->dsp);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
683 g_expr_u(assign_expr0(list2(LVAR,n->dsp),list3(tag,reg,(int)n),t,t));
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
684 if (tag==REGISTER||tag==DREGISTER||tag==FREGISTER||tag==LREGISTER) {
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
685 free_register(reg);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
686 return g_expr0(lvar);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
687 #endif
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
688 }
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
689
277
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
690 // parallel assignment of registers.
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
691 //
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
692 // target = list3(target_regnum,next,source_regnum);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
693
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
694 void
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
695 parallel_rassign(int assigns)
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
696 {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
697 int free,tmp,tmp_target,remains,t0,t2,src;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
698 tmp = 0;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
699 for(;;) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
700 remains = 0;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
701 // find free target
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
702 for(free=assigns;free;free=cadr(free)) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
703 if (!caddr(free)) continue; // already done
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
704 remains++;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
705 t0 = car(free); // target register
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
706 // check target is free
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
707 for(src=assigns;src;src=cadr(src)) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
708 if ((t2=caddr(src)) && t0==t2) break; // target is in source
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
709 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
710 if (src==0) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
711 break; // free is a free target
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
712 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
713 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
714 if (remains==0) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
715 if (tmp) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
716 code_rlvar(tmp,tmp_target);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
717 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
718 return;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
719 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
720 if (free) { // free target
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
721 if (t0!=caddr(free))
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
722 code_assign_register(t0,0,caddr(free));
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
723 } else { // no free target
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
724 for(free=assigns;free;free=cadr(free)) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
725 if (caddr(free)) break; // not yet done
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
726 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
727 if (!free) error(-1);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
728 tmp = new_lvar(size_of_int);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
729 tmp_target = car(free);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
730 code_assign_lvar(tmp,caddr(free),0);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
731 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
732 caddr(free)=0; // mark it done
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
733 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
734 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
735
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
736 /* goto arguments list */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
737 /* target list4(list2(tag,disp),cdr,ty,source_expr) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
738 /* source expr=listn(tag,...) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
739 /* source (after) list2(tag,disp) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
740 /* source list list3(e,cdr,sz) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
741
284
ec1a68133f6a MIPS f2u bug fix.
kono
parents: 280
diff changeset
742 #define DEBUG_PARALLEL_ASSIGN 0
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
743
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
744 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
745 overrap(int t,int sz,int source)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
746 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
747 int s,s0,s1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
748 int t0=cadr(t);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
749 int t1=t0+sz;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
750 for(;source;source=cadr(source)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
751 s=car(source); s0=cadr(s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
752 if(car(s)==REGISTER && car(t)==REGISTER) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
753 if(s0==t0) return s;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
754 } else if (is_same_type(s,t)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
755 s1=s0+caddr(source);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
756 #if DEBUG_PARALLEL_ASSIGN>1
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
757 printf("# ovedrrap source %d t0 %d t1 %d\n",car(car(t)),t0,t1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
758 printf("# ovedrrap target %d s0 %d s1 %d\n",car(car(source)),s0,s1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
759 printf("# ovedrrap equal = %d\n",((t0<=s0&&s0<t1)||(t0<s1&&s1<=t1)));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
760 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
761 if((t0<=s0&&s0<t1)||(t0<s1&&s1<=t1)) return s;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
762 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
763 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
764 return 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
765 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
766
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
767 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
768 remove_target(int *target,int t,int *use)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
769 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
770 int use0=*use;
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
771 int reg;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
772 while(use0) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
773 if (car(use0)==t) {
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
774 reg = car(caddr(use0));
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
775 if (reg==REGISTER||reg==FREGISTER||reg==DREGISTER)
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
776 free_register(cadr(caddr(use0)));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
777 break;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
778 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
779 use0 = cadr(use0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
780 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
781 remove0(target,t);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
782 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
783
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
784 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
785 save_target(int t,int s,int *target,int *use,int sz,int ty)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
786 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
787 int e1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
788 /*¿·¤·¤¤¥ì¥¸¥¹¥¿(or ¥¹¥¿¥Ã¥¯)¤ò¼èÆÀ¤¹¤ë*/
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
789 if (sz==size_of_int && (e1=get_register())!=-1) {
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
790 e1=list3(REGISTER,e1,0);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
791 *use=list3(t,*use,e1);
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
792 g_expr_u(assign_expr0(e1,s,ty,ty));
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
793 *target = append4(*target,t,ty,e1);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
794 #if FLOAT_CODE
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
795 } else if (sz==size_of_double && (e1=get_dregister(1))!=-1) {
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
796 e1=list3(DREGISTER,e1,0);
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
797 *use=list3(t,*use,e1);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
798 g_expr_u(assign_expr0(e1,s,ty,ty));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
799 *target = append4(*target,t,ty,e1);
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
800 } else if (sz==size_of_float && (e1=get_dregister(0))!=-1) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
801 e1=list3(FREGISTER,e1,0);
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
802 *use=list3(t,*use,e1);
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
803 g_expr_u(assign_expr0(e1,s,ty,ty));
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
804 *target = append4(*target,t,ty,e1);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
805 #endif
205
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
806 #if LONGLONG_CODE
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
807 } else if (sz==size_of_longlong && (e1=get_lregister())!=-1) {
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
808 e1=list3(LREGISTER,e1,0);
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
809 *use=list3(t,*use,e1);
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
810 g_expr_u(assign_expr0(e1,s,ty,ty));
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
811 *target = append4(*target,t,ty,e1);
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
812 #endif
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
813 } else {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
814 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
815 *target = append4(*target,t,ty,e1);
117
2d5a203cc3a6 lvar reuse
kono
parents: 116
diff changeset
816 *use=list3(t,*use,e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
817 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
818 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
819
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
820 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
821 circular_dependency(int t,int s,int *target,int *source)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
822 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
823 int target0=*target;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
824 int t1,sz,ty,s1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
825 while(target0) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
826 if (cadddr(target0)==s) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
827 t1=car(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
828 s=cadddr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
829 sz=size(ty=caddr(target0));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
830 if(t==t1) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
831 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
832 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
833 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
834 return 1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
835 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
836 if ((s1=overrap(t1,sz,*source))) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
837 /* another overrap start over */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
838 return circular_dependency(t,s1,target,source);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
839 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
840 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
841 target0=cadr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
842 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
843 return 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
844 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
845
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
846 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
847 parallel_assign(int *target,int *source,int *processing,int *use)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
848 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
849 int t,s,sz,ty,target0,s1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
850 while(*target) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
851 target0=*target;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
852 while(target0) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
853 t=car(target0); s=cadddr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
854 sz=size(ty=caddr(target0));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
855 if(car(t)==car(s) && cadr(t)==cadr(s)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
856 /*½ñ¤­¹þ¤ßÀ褬¼«Ê¬¼«¿È*/
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
857 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
858 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
859 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
860 remove_target(target,t,use);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
861 /* Ç˲õ¤µ¤ì¤Æ¤Ïº¤¤ë¤Î¤Ç¡¢source list¤«¤é¤Ï½ü¤«¤Ê¤¤ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
862 } else if (!(s1=overrap(t,sz,*source))) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
863 /* ½Å¤Ê¤Ã¤Æ¤Ê¤¤¤Î¤Ç°Â¿´¤·¤Æ½ñ¤­¹þ¤á¤ë */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
864 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
865 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
866 #endif
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
867 g_expr_u(assign_expr0(t,s,ty,ty));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
868 remove_target(target,t,use); remove0(source,s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
869 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
870 if(circular_dependency(t,s1,target,source)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
871 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
872 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
873 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
874 remove_target(target,t,use); remove0(source,s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
875 save_target(t,s,target,use,sz,ty);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
876 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
877 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
878 target0=cadr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
879 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
880 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
881 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
882
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
883 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
884 remove0(int *parent,int e)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
885 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
886 int list;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
887 while ((list=*parent)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
888 if (car(list)==e) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
889 *parent= cadr(list); return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
890 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
891 parent=&cadr(list);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
892 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
893 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
894 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
895
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
896 /*
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
897 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
898 remove0_all(int *parent,int e)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
899 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
900 int list;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
901 while ((list=*parent)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
902 if (car(list)==e) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
903 *parent= cadr(list);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
904 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
905 parent=&cadr(list);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
906 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
907 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
908 }
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
909 */
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
910
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
911 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
912 is_simple(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
913 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
914 return (
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
915 e1==CONST || e1==FNAME || e1==LVAR || e1==REGISTER ||e1==DREGISTER ||
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
916 e1==FREGISTER || e1==LREGISTER ||
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
917 e1==GVAR || e1==RGVAR || e1==RLVAR || e1==CRLVAR || e1==CRGVAR ||
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
918 e1==DRLVAR || e1==FRLVAR || e1==LRLVAR ||
165
kono
parents: 164
diff changeset
919 e1==CURLVAR || e1==SURLVAR || e1==CURGVAR || e1==SURGVAR
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
920 );
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
921 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
922
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
923 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
924 is_same_type(int e1,int e2)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
925 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
926 int ce1=car(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
927 int ce2=car(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
928 return (
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
929 (ce1==LVAR && (ce2==RLVAR||ce2==CRLVAR||ce2==FRLVAR||ce2==DRLVAR))
165
kono
parents: 164
diff changeset
930 || (ce1==LVAR && (ce2==SRLVAR||ce2==SURLVAR||ce2==CURLVAR))
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
931 || (ce2==LVAR && (ce1==RLVAR||ce1==CRLVAR||ce1==FRLVAR||ce1==DRLVAR))
165
kono
parents: 164
diff changeset
932 || (ce2==LVAR && (ce1==SRLVAR||ce1==SURLVAR||ce1==CURLVAR))
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
933 || (ce2==LVAR && (ce1==LRLVAR))
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
934 || (ce1==GVAR && (ce2==RGVAR||ce2==CRGVAR||ce2==FRGVAR||ce2==DRGVAR))
165
kono
parents: 164
diff changeset
935 || (ce1==GVAR && (ce2==SRGVAR||ce2==SURGVAR||ce2==CURGVAR))
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
936 || (ce2==GVAR && (ce1==RGVAR||ce1==CRGVAR||ce1==FRGVAR||ce1==DRGVAR))
165
kono
parents: 164
diff changeset
937 || (ce2==GVAR && (ce1==SRGVAR||ce1==SURGVAR||ce1==CURGVAR))
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
938 || (ce2==GVAR && (ce1==LRGVAR))
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
939 );
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
940 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
941
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
942 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
943 is_memory(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
944 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
945 int ce1=car(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
946 return (
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
947 ce1==LVAR ||ce1==RLVAR||ce1==CRLVAR || ce1==DRLVAR || ce1==LRLVAR ||
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
948 ce1==GVAR ||ce1==RGVAR||ce1==CRGVAR || ce1==DRGVAR || ce1==LRGVAR ||
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
949 ce1==FRLVAR || ce1==FRGVAR ||
165
kono
parents: 164
diff changeset
950 ce1==CURGVAR ||ce1==SURGVAR||ce1==SRGVAR ||
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
951 ce1==REGISTER|| ce1==DREGISTER || ce1==FREGISTER ||
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
952 ce1==LREGISTER
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
953 );
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
954 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
955
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
956
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
957 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
958 jump(int e1, int env)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
959 {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
960 int e2,e3,e4,sz,arg_size,ty,regs,fregs;
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
961 int t0,s0,r,reg;
127
eb4d8975926c Intel float fix
kono
parents: 126
diff changeset
962 NMTBL *code0 = 0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
963 int target = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
964 int source = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
965 int processing = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
966 int use = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
967
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
968 /* ¤Þ¤º¡¢¥µ¥¤¥º¤ò·×»»¤·¤Ê¤¬¤é¡¢·è¤Þ¤Ã¤¿·Á¤ËÍ¡£ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
969
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
970 arg_size = 0; regs = 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
971 fregs = 0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
972 for (e3 = reverse0(caddr(e1)); e3; e3 = cadr(e3)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
973 e2 = car(e3); sz = size(ty=caddr(e3));
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
974 if (scalar(ty) && (r = get_input_register_var(regs,0,1))) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
975 target=list4(r,target,ty,e2); regs++;
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
976 } else if (ty==FLOAT && (r = get_input_dregister_var(fregs,0,1,0))) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
977 target=list4(r, target,ty,e2); fregs++;
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
978 } else if (ty==DOUBLE && (r = get_input_dregister_var(fregs,0,1,1))) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
979 target=list4(r, target,ty,e2); fregs++;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
980 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
981 target=list4(list2(LVAR,0), target,ty,e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
982 }
128
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
983 /* keep arg space for register variables */
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
984 arg_size += sz;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
985 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
986 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
987 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
988 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
989
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
990 /* disp ¤òÈô¤ÓÀè»÷¹ç¤ï¤»¤Æ½¤Àµ */
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
991 if (is_code(fnptr)) {
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
992 if (-arg_size<disp) disp = -arg_size;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
993 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
994 if (disp_offset-arg_size<disp) disp = disp_offset-arg_size;
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 /* Ê£»¨¤Ê¼°¤òÁ°¤â¤Ã¤Æ·×»»¤·¤Æ¤ª¤¯ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
998 /* ɬÍפʤé¶É½êÊÑ¿ô¤òÍѤ¤¤ë¡£ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
999 /* ¶É½êÊÑ¿ô¤Ø¤Î¥ª¥Õ¥»¥Ã¥È¤ò³Ð¤¨¤Æ¤ª¤¯ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1000
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1001 for (e2 = target; e2; e2 = cadr(e2)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1002 t0=car(e2); s0=cadddr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1003 sz=size(ty=caddr(e2));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1004 if(car(t0)==LVAR) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1005 /* ¤³¤³¤Ç¡¢½ñ¹þÀ襢¥É¥ì¥¹¤ò·è¤á¤ë */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1006 cadr(t0)=-arg_size;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1007 }
128
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1008 arg_size-=sz;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1009 if (!is_simple(car(s0))) {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
1010 g_expr_u(assign_expr0((e4=list2(LVAR,new_lvar(sz))),s0,ty,ty));
117
2d5a203cc3a6 lvar reuse
kono
parents: 116
diff changeset
1011 use=list3(ty,use,e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1012 cadddr(e2)=e4;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1013 s0=e4;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1014 } else if (is_same_type(t0,s0)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1015 if(cadr(t0)==cadr(s0)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1016 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1017 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
1018 #endif
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1019 /* we should check size also (but currently useless) */
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1020 remove0(&target,t0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1021 /* still we have source to avoid overwrite */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1022 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1023 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1024 if(is_memory(s0)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1025 source=list3(s0,source,sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1026 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1027 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
1028 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1029 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1030 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1031
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1032 /* compute jump address */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1033 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1034 if (car(e2) == FNAME) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1035 code0=(NMTBL *)cadr(e2);
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
1036 if (!is_code(code0)) {
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1037 error(TYERR); return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1038 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1039 } else { /* indirect */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1040 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1041 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1042 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1043 if (env) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1044 g_expr(env);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1045 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1046 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1047
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1048 /* ÊÂÎóÂåÆþ¤ò¼Â¹Ô */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1049 parallel_assign(&target,&source,&processing,&use);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1050 while (use) {
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
1051 reg = car(caddr(use));
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1052 if (reg==REGISTER||reg==FREGISTER||reg==DREGISTER||reg==LREGISTER)
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1053 free_register(cadr(caddr(use)));
117
2d5a203cc3a6 lvar reuse
kono
parents: 116
diff changeset
1054 else if (car(caddr(use))==LVAR)
2d5a203cc3a6 lvar reuse
kono
parents: 116
diff changeset
1055 free_lvar(cadr(caddr(use)));
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1056 use=cadr(use);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1057 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1058 if(target) error(-1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1059
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1060 if (env) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1061 /* change the frame pointer */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1062 e3 = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1063 code_frame_pointer(e3);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1064 emit_pop_free(e3);
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
1065 } else if (is_function(fnptr)) {
128
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1066 if (car(e2) != FNAME) {
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1067 e2 = emit_pop(0);
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1068 code_fix_frame_pointer(disp_offset);
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1069 code_indirect_jmp(e2);
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1070 emit_pop_free(e2);
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1071 return;
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1072 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1073 code_fix_frame_pointer(disp_offset);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1074 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1075
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1076 if (car(e2) == FNAME) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1077 code_jmp(code0->nm);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1078 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1079 e2 = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1080 code_indirect_jmp(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1081 emit_pop_free(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1082 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1083 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1084
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1085 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1086 machinop(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1087 {
240
b59364f5b030 *** empty log message ***
kono
parents: 239
diff changeset
1088 int e2,e3,op;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1089
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1090 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1091 op = car(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1092 e3 = caddr(e1);
240
b59364f5b030 *** empty log message ***
kono
parents: 239
diff changeset
1093 if (code_const_op_p(op,e3)) {
189
f53d70110377 immediate instructions.
kono
parents: 187
diff changeset
1094 g_expr(e2);
240
b59364f5b030 *** empty log message ***
kono
parents: 239
diff changeset
1095 oprtc(op,USE_CREG,e3);
189
f53d70110377 immediate instructions.
kono
parents: 187
diff changeset
1096 return;
f53d70110377 immediate instructions.
kono
parents: 187
diff changeset
1097 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1098 g_expr(e3);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1099 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1100 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1101 tosop(op,USE_CREG,(e2=pop_register()));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1102 emit_pop_free(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1103 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1104 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1105
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1106 #if FLOAT_CODE
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1107 void
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
1108 dmachinop(int e1,int d)
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1109 {
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1110 int e2,e3,op;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1111
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1112 e2 = cadr(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1113 op = car(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1114 e3 = caddr(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1115 g_expr(e3);
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
1116 emit_dpush(d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1117 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1118 dtosop(car(e1),USE_CREG,(e2=emit_dpop(d)));
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1119 emit_dpop_free(e2,d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1120 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1121 }
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1122 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1123
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1124 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1125 void
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1126 lmachinop(int e1)
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1127 {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1128 int e2,e3,op;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1129
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1130 e2 = cadr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1131 op = car(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1132 e3 = caddr(e1);
213
kono
parents: 212
diff changeset
1133 if (code_lconst_op_p(op,e3)) {
kono
parents: 212
diff changeset
1134 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1135 loprtc(op,USE_CREG,e3);
213
kono
parents: 212
diff changeset
1136 return;
kono
parents: 212
diff changeset
1137 }
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1138 g_expr(e3);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1139 emit_lpush();
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1140 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1141 ltosop(car(e1),USE_CREG,(e2=emit_lpop()));
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1142 emit_lpop_free(e2);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1143 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1144 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1145 #endif
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1146
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1147 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1148 sassign(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1149 {
258
22949117768f Complex function argments. Struct is done. Long long is odd.
kono
parents: 256
diff changeset
1150 int e2,e3,e4,sz,xreg,det,offset;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1151
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1152 /* structure assignment */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1153 e2 = cadr(e1); /* pointer variable to the struct */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1154 e3 = cadr(e2); /* offset of the variable (distination) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1155 e4 = caddr(e1); /* right value (source) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1156 sz = cadddr(e1); /* size of struct or union */
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1157 if (is_same_type(e2,e4)&&cadr(e2)==cadr(e4)) {
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1158 if (use) g_expr(e4);
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1159 return;
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1160 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1161 g_expr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1162 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1163 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1164 xreg = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1165 /* °ìÈÌŪ¤Ë¤Ï¥³¥Ô¡¼¤Î¥ª¡¼¥Ð¥é¥Ã¥×¤Î¾õ¶·¤Ï¼Â¹Ô»þ¤Ë¤·¤«¤ï¤«¤é¤Ê¤¤ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1166 /* ¤·¤«¤·¡¢¤ï¤«¤ë¾ì¹ç¤â¤¢¤ë */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1167 if (car(e4)==RSTRUCT) e4=cadr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1168 if (is_same_type(e2,e4)) {
258
22949117768f Complex function argments. Struct is done. Long long is odd.
kono
parents: 256
diff changeset
1169 if(cadr(e2)<cadr(e4)) { offset=sz; sz=-sz;}
22949117768f Complex function argments. Struct is done. Long long is odd.
kono
parents: 256
diff changeset
1170 det=1;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1171 } else {
258
22949117768f Complex function argments. Struct is done. Long long is odd.
kono
parents: 256
diff changeset
1172 det = 0; offset=0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1173 }
258
22949117768f Complex function argments. Struct is done. Long long is odd.
kono
parents: 256
diff changeset
1174 emit_copy(xreg,USE_CREG,sz,offset,1,det);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1175 emit_pop_free(xreg);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1176 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1177 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1178
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1179 static void
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1180 assign_opt(int e5,int e2,int e4,int byte)
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1181 {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1182 int reg;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1183 /* e2=e4 */
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1184 if (e5==REGISTER) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1185 reg = cadr(e4);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1186 switch(car(e2)) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1187 case GVAR: code_assign_gvar(e2,reg,byte); return;
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1188 case LVAR: code_assign_lvar(cadr(e2),reg,byte); return;
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1189 case REGISTER: code_assign_register(cadr(e2),byte,reg); return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1190 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1191 g_expr(e2);
233
2208a18f3799 *** empty log message ***
kono
parents: 232
diff changeset
1192 code_assign(USE_CREG,byte,reg);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1193 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1194 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1195 /* e2 is register now */
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1196 if (car(e2)!=REGISTER) error(-1);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1197 reg = cadr(e2);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1198 switch(e5) {
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1199 case CRGVAR:
165
kono
parents: 164
diff changeset
1200 case CURGVAR: code_crgvar(e4,reg,e5==CRGVAR,1); return;
kono
parents: 164
diff changeset
1201 case SRGVAR:
kono
parents: 164
diff changeset
1202 case SURGVAR: code_crgvar(e4,reg,e5==SRGVAR,size_of_short); return;
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1203 case RGVAR: code_rgvar(e4,reg); return;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1204 case CRLVAR:
165
kono
parents: 164
diff changeset
1205 case CURLVAR: code_crlvar(cadr(e4),reg,e5==CRLVAR,1); return;
kono
parents: 164
diff changeset
1206 case SRLVAR:
kono
parents: 164
diff changeset
1207 case SURLVAR: code_crlvar(cadr(e4),reg,e5==SRLVAR,size_of_short); return;
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1208 case RLVAR: code_rlvar(cadr(e4),reg); return;
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1209 case GVAR: code_gvar(e4,reg); return;
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1210 case LVAR: code_lvar(cadr(e4),reg); return;
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1211 case CONST: code_const(cadr(e4),reg); return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1212 case ADDRESS:
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1213 if (car(cadr(e4))==STRING) code_string(cadr(e4),reg);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1214 else code_gvar(cadr(e4),reg);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1215 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1216 case FNAME: code_fname((NMTBL*)cadr(e4),reg); return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1217 case STRING: code_string(e4,reg); return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1218 default: error(-1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1219 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1220 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1221
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1222 void
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1223 assign(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1224 {
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1225 int e2,e4,byte,e5;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1226
166
9e55cc5551fb *** empty log message ***
kono
parents: 165
diff changeset
1227 byte=(car(e1) == CASS)?1:(car(e1) == SASS)?size_of_short:0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1228 /* e2=e4 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1229 e2 = cadr(e1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1230 e4 = caddr(e1);e5=car(e4);
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1231 if (is_same_type(e2,e4)&&cadr(e2)==cadr(e4)) {
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1232 if (use) g_expr(e4);
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1233 return;
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1234 }
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1235 if (!use && (
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1236 (e5==REGISTER) ||
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1237 (car(e2)==REGISTER&&(
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1238 e5== CRGVAR || e5== CRLVAR || e5== RGVAR || e5== RLVAR ||
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1239 e5== CURGVAR || e5== CURLVAR ||
165
kono
parents: 164
diff changeset
1240 e5== SURGVAR || e5== SURLVAR ||
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1241 e5== GVAR || e5== LVAR ||
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1242 e5== CONST || e5== FNAME || e5== STRING ||
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1243 (e5==ADDRESS&&car(cadr(e4))==STRING) ||
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1244 (e5==ADDRESS&&car(cadr(e4))==GVAR) )))) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1245 assign_opt(e5,e2,e4,byte);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1246 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1247 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1248 switch(car(e2)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1249 case GVAR: /* i=3 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1250 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1251 code_assign_gvar(e2,USE_CREG,byte);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1252 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1253 case LVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1254 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1255 code_assign_lvar(cadr(e2),USE_CREG,byte);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1256 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1257 case REGISTER:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1258 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1259 code_assign_register(cadr(e2),byte,USE_CREG);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1260 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1261 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1262 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1263 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1264 g_expr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1265 e2 = emit_pop(0);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1266 code_assign(e2,byte,USE_CREG);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1267 emit_pop_free(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1268 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1269 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1270
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1271 #if FLOAT_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1272
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1273 static void
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1274 dassign_opt(int e5,int e2,int e4,int d)
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1275 {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1276 int reg;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1277 /* e2=e4 */
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1278 if (e5==DREGISTER||e5==FREGISTER) {
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1279 reg = cadr(e4);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1280 switch(car(e2)) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1281 case GVAR: /* i=3 */
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1282 code_dassign_gvar(e2,reg,d);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1283 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1284 case LVAR:
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1285 code_dassign_lvar(cadr(e2),reg,d);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1286 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1287 case DREGISTER:
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1288 case FREGISTER:
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1289 if (reg!=cadr(e2))
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1290 code_dassign_dregister(cadr(e2),d,reg);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1291 return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1292 default:
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1293 error(-1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1294 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1295 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1296 /* e2 is register now */
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1297 if (car(e2)!=DREGISTER && car(e2)!=FREGISTER) error(-1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1298 reg = cadr(e2);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1299 switch(e5) {
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1300 case FRGVAR:
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1301 case DRGVAR: code_drgvar(e4,d,reg); return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1302 case FRLVAR:
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1303 case DRLVAR: code_drlvar(cadr(e4),d,reg); return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1304 case FCONST:
264
7de200d88747 MIPS first binary run (inomplete)
kono
parents: 258
diff changeset
1305 case DCONST: code_dconst(e4,reg,d); return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1306 default:
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1307 error(-1);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1308 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1309 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1310
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1311 void
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1312 dassign(int e1)
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1313 {
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1314 int e2,e3,e4,d,e5;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1315
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1316 /* e2=e4 */
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1317 e2 = cadr(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1318 e3 = cadr(e2);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1319 e4 = caddr(e1); e5=car(e4);
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1320 if (is_same_type(e2,e4)&&cadr(e2)==cadr(e4)) {
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1321 if (use) g_expr(e4);
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1322 return;
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1323 }
249
8313c965c0e2 *** empty log message ***
kono
parents: 246
diff changeset
1324 if (car(e1)==DASS) d=1;
8313c965c0e2 *** empty log message ***
kono
parents: 246
diff changeset
1325 else if (car(e1)==FASS) d=0;
8313c965c0e2 *** empty log message ***
kono
parents: 246
diff changeset
1326 else error(-1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1327 if (!use && (
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1328 (e5==DREGISTER) || (e5==FREGISTER) ||
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
1329 (car(e2)==DREGISTER&&(e5==DRGVAR||e5==DRLVAR||e5==DCONST))||
249
8313c965c0e2 *** empty log message ***
kono
parents: 246
diff changeset
1330 (car(e2)==FREGISTER&&(e5==FRGVAR||e5==FRLVAR||e5==FCONST))
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1331 )) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1332 dassign_opt(e5,e2,e4,d);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1333 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1334 }
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1335 switch(car(e2)) {
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
1336 case GVAR:
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1337 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1338 code_dassign_gvar(e2,USE_CREG,d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1339 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1340 case LVAR:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1341 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1342 code_dassign_lvar(cadr(e2),USE_CREG,d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1343 return;
111
7aa449aff3e6 floating point
kono
parents: 109
diff changeset
1344 case DREGISTER:
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1345 case FREGISTER:
111
7aa449aff3e6 floating point
kono
parents: 109
diff changeset
1346 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1347 code_dassign_dregister(cadr(e2),d,USE_CREG);
111
7aa449aff3e6 floating point
kono
parents: 109
diff changeset
1348 return;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1349 }
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1350 g_expr(e2);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
1351 emit_push();
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1352 g_expr(e4);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
1353 e2 = emit_pop(0);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1354 code_dassign(e2,USE_CREG,d);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
1355 emit_pop_free(e2);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1356 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1357 }
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1358
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1359 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1360
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1361 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1362
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1363 void
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1364 lassign_opt(int e5,int e2,int e4)
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1365 {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1366 int reg;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1367 /* e2=e4 */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1368 if (e5==LREGISTER) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1369 reg = cadr(e4);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1370 switch(car(e2)) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1371 case GVAR: /* i=3 */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1372 code_lassign_gvar(e2,reg);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1373 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1374 case LVAR:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1375 code_lassign_lvar(cadr(e2),reg);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1376 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1377 case LREGISTER:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1378 if (reg!=cadr(e2))
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1379 code_lassign_lregister(cadr(e2),reg);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1380 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1381 default:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1382 error(-1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1383 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1384 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1385 /* e2 is register now */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1386 if (car(e2)!=LREGISTER) error(-1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1387 reg = cadr(e2);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1388 switch(e5) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1389 case LRGVAR: code_lrgvar(e4,reg); return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1390 case LRLVAR: code_lrlvar(cadr(e4),reg); return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1391 case LCONST: code_lconst(e4,reg); return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1392 default:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1393 error(-1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1394 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1395 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1396
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1397 void
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1398 lassign(int e1)
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1399 {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1400 int e2,e3,e4,e5;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1401
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1402 /* e2=e4 */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1403 e2 = cadr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1404 e3 = cadr(e2);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1405 e4 = caddr(e1); e5=car(e4);
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1406 if (is_same_type(e2,e4)&&cadr(e2)==cadr(e4)) {
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1407 if (use) g_expr(e4);
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1408 return;
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1409 }
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1410 if (!use && (
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1411 (e5==LREGISTER) ||
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1412 (car(e2)==LREGISTER&&(e5==LRGVAR||e5==LRLVAR||e5==LCONST))
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1413 )) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1414 lassign_opt(e5,e2,e4);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1415 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1416 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1417 switch(car(e2)) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1418 case GVAR:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1419 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1420 code_lassign_gvar(e2,USE_CREG);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1421 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1422 case LVAR:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1423 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1424 code_lassign_lvar(cadr(e2),USE_CREG);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1425 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1426 case LREGISTER:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1427 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1428 code_lassign_lregister(cadr(e2),USE_CREG);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1429 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1430 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1431 g_expr(e2);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
1432 emit_push();
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1433 g_expr(e4);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
1434 e2 = emit_pop(0);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1435 code_lassign(e2,USE_CREG);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
1436 emit_pop_free(e2);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1437 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1438 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1439
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1440 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1441
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1442 void
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1443 assop(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1444 {
165
kono
parents: 164
diff changeset
1445 int e2,e3,byte,op,sign,size;
255
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1446 int n,t;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1447
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1448 /* e2 op= e3 */
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1449 if (car(e1) == CUASSOP) {
165
kono
parents: 164
diff changeset
1450 byte = 1; sign = 0; size = 1;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1451 } else if (car(e1) == CASSOP) {
165
kono
parents: 164
diff changeset
1452 byte = 1; sign = 1; size = 1;
kono
parents: 164
diff changeset
1453 } else if (car(e1) == SUASSOP) {
kono
parents: 164
diff changeset
1454 byte = size_of_short; sign = 0; size = size_of_short;
kono
parents: 164
diff changeset
1455 } else if (car(e1) == SASSOP) {
kono
parents: 164
diff changeset
1456 byte = size_of_short; sign = 1; size = size_of_short;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1457 } else {
165
kono
parents: 164
diff changeset
1458 byte = 0; sign = 1; size = size_of_int;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1459 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1460 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1461 if (car(e2)==INDIRECT) e2=cadr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1462 e3 = caddr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1463 op = cadddr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1464
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1465 if (car(e2)==REGISTER) {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1466 if (code_const_op_p(op,e3)) {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1467 oprtc(op,cadr(e2),e3);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1468 } else {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1469 g_expr(e3);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1470 code_register_assop(cadr(e2),USE_CREG,op,byte);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1471 }
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1472 if (use) {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1473 code_register(cadr(e2),USE_CREG);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1474 }
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1475 return;
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1476 }
255
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1477 if (car(e3)==CONST) {
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1478 /* e2 = e2 op e3; */
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1479 t = sign?INT:UNSIGNED;
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1480 // oprtc expected
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1481 if (car(e2)==LVAR||car(e2)==GVAR) {
255
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1482 g_expr(assign_expr0(e2,list3(op,rvalue_t(e2,t),e3),t,t));
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1483 return;
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1484 }
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1485 /* new = &e2 */
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1486 /* *new = *new op e3 */
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1487 n = list2(LVAR,new_lvar(size_of_int));
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1488 g_expr_u(assign_expr0(n,list2(ADDRESS,e2),INT,INT));
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1489 g_expr(assign_expr0(list2(INDIRECT,n),list3(op,n,e3),t,t));
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1490 free_lvar(cadr(n));
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1491 return;
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1492 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1493 g_expr(e3);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1494 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1495 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1496 code_assop(op,USE_CREG,byte,sign);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1497 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1498 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1499
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1500 #if FLOAT_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1501
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1502 void
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1503 dassop(int e1)
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1504 {
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1505 int e2,e3,op,d;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1506
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1507 /* e2 op= e3 */
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1508 d = (car(e1) == DASSOP);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1509 e2 = cadr(e1);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1510 if (car(e2)==INDIRECT) e2=cadr(e2);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1511 e3 = caddr(e1);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1512 op = cadddr(e1);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1513
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1514 g_expr(e3);
144
56211702f298 creg/freg continue
kono
parents: 139
diff changeset
1515 if (car(e2)==DREGISTER||car(e2)==FREGISTER) {
273
87b9cfc86a10 *** empty log message ***
kono
parents: 269
diff changeset
1516 emit_dpush(d);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
1517 code_register_dassop(cadr(e2),op,d);
273
87b9cfc86a10 *** empty log message ***
kono
parents: 269
diff changeset
1518 if (use)
87b9cfc86a10 *** empty log message ***
kono
parents: 269
diff changeset
1519 code_dregister(cadr(e2),USE_CREG,d);
87b9cfc86a10 *** empty log message ***
kono
parents: 269
diff changeset
1520 return;
144
56211702f298 creg/freg continue
kono
parents: 139
diff changeset
1521 }
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1522 emit_dpush(d);
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1523 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1524 code_dassop(op,USE_CREG,d);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1525 return;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1526 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1527
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1528 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1529
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1530 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1531
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1532 static int
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1533 long_sign(int op)
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1534 {
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1535 return (op==LUDIV||op==LUMOD||op==LULSHIFT||op==LURSHIFT)?ULONGLONG:LONGLONG;
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1536 }
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1537
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1538 void
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1539 lassop(int e1)
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1540 {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1541 int e2,e3,op;
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1542 int n,t;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1543
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1544 /* e2 op= e3 */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1545 e2 = cadr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1546 if (car(e2)==INDIRECT) e2=cadr(e2);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1547 e3 = caddr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1548 op = cadddr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1549
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1550 if (car(e2)==LREGISTER) {
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1551 if (code_lconst_op_p(op,e3)) {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1552 loprtc(op,cadr(e2),e3);
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1553 if (use) {
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1554 code_lregister(cadr(e2),USE_CREG);
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1555 }
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1556 return;
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1557 }
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1558 if (code_lassop_p) {
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1559 g_expr(e3);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1560 emit_lpush();
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1561 code_register_lassop(cadr(e2),op);
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1562 if (use) {
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1563 code_lregister(cadr(e2),USE_CREG);
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1564 }
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1565 return;
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1566 }
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1567 }
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1568 if (!code_lassop_p||car(e3)==LCONST) {
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1569 /* e2 = e2 op e3; */
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1570 t = long_sign(op);
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1571 if (car(e2)==LREGISTER||car(e2)==LVAR||car(e2)==GVAR) {
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1572 g_expr(assign_expr0(e2,list3(op,rvalue_t(e2,t),e3),t,t));
239
1849e0079f08 ia32 long long continue
kono
parents: 238
diff changeset
1573 return;
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1574 }
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1575 /* new = &e2 */
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1576 /* *new = *new op e3 */
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1577 n = list2(LVAR,new_lvar(size_of_int));
239
1849e0079f08 ia32 long long continue
kono
parents: 238
diff changeset
1578 g_expr_u(assign_expr0(n,list2(ADDRESS,e2),INT,INT));
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1579 g_expr(assign_expr0(list2(INDIRECT,n),list3(op,n,e3),t,t));
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1580 free_lvar(cadr(n));
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1581 return;
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1582 }
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1583
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1584 g_expr(e3);
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1585 if (car(e2)==LREGISTER) {
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1586 emit_lpush();
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1587 code_register_lassop(cadr(e2),op);
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1588 if (use)
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1589 code_lregister(cadr(e2),USE_CREG);
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1590 return;
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1591 }
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1592 emit_lpush();
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1593 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1594 code_lassop(op,USE_CREG);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1595 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1596 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1597
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1598 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1599
95
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1600 void
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
1601 cmpdimm(int e, int csreg,int label,int cond)
95
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1602 {
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
1603 code_cmpdimm(e, csreg,label,cond);
95
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1604 }
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1605
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1606 int
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1607 csvalue()
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1608 {
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1609 return code_csvalue();
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1610 }
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1611
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1612
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1613 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1614 fwdlabel(void)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1615 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1616 return labelno++;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1617 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1618
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1619 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1620 fwddef(int l)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1621 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1622 control=1;
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1623 if (!chk)
92
e7f8515ba882 *** empty log message ***
kono
parents: 91
diff changeset
1624 code_label(l);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1625 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1626
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1627 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1628 backdef(void)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1629 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1630 control=1;
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1631 if (!chk)
92
e7f8515ba882 *** empty log message ***
kono
parents: 91
diff changeset
1632 code_label(labelno);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1633 return labelno++;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1634 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1635
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1636 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1637 def_label(int cslabel, int dlabel)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1638 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1639 int fl;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1640
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1641 fl = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1642 if (control) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1643 jmp(fl=fwdlabel());
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1644 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1645 fwddef(cslabel);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1646 if (dlabel)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1647 jmp(dlabel);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1648 if (fl) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1649 fwddef(fl);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1650 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1651 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1652
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1653 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1654 gen_source(char *s)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1655 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1656 printf("%s",s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1657 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1658
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1659 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1660 ret(void)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1661 {
107
06f72222d6b5 prevent destorying function argument (incomeplete)
kono
parents: 105
diff changeset
1662 code_set_return_register(1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1663 jmp(retlabel);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1664 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1665
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1666 void
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1667 opening(char *filename)
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1668 {
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1669 emit_init();
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1670 if (!chk)
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1671 code_opening(filename);
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1672 }
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1673
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1674 void
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1675 closing()
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1676 {
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1677 if (!chk)
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1678 code_closing();
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1679 }
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1680
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1681 int
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1682 contains_in_list(int e,int type)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1683 {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1684 while(e) {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1685 if(contains(car(e),type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1686 e = cadr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1687 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1688 return 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1689 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1690
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1691 int
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1692 contains(int e,int type)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1693 {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1694 while(e) {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1695 if (car(e)==type) return 1;
256
d80e6387c539 powerpc function call complex arugment pre computation.
kono
parents: 255
diff changeset
1696 if (!car(e)) return 0;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1697 if (LIST_ARGS(car(e))){
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1698 /* list arguments */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1699 return contains_in_list(caddr(e),type);
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1700 } else if (UNARY_ARGS(car(e))) {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1701 /* unary operators */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1702 e = cadr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1703 continue;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1704 } else if (BINARY_ARGS(car(e))) {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1705 /* biary operators */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1706 if (contains(cadr(e),type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1707 e = caddr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1708 continue;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1709 } else if (TARNARY_ARGS(car(e))) {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1710 /* tarary operators */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1711 if (contains(cadr(e), type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1712 if (contains(caddr(e),type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1713 e = cadddr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1714 continue;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1715 } else if (NULLARY_ARGS(car(e))) {
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1716 /* nullary operators */
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1717 return 0;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1718 } else {
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1719 fprintf(stderr,"Unknown Tree ID %d\n",car(e));
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1720 error(-1);
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1721 return 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1722 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1723 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1724 return 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1725 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1726
223
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1727 int
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1728 contains_in_list_p(int e,int (*p)(int))
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1729 {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1730 while(e) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1731 if(contains_p(car(e),p)) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1732 e = cadr(e);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1733 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1734 return 0;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1735 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1736
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1737 int
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1738 contains_p(int e,int (*p)(int))
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1739 {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1740 while(e) {
256
d80e6387c539 powerpc function call complex arugment pre computation.
kono
parents: 255
diff changeset
1741 if (!car(e)) return 0;
223
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1742 if (p(car(e))) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1743 if (LIST_ARGS(car(e))){
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1744 /* list arguments */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1745 return contains_in_list_p(caddr(e),p);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1746 } else if (UNARY_ARGS(car(e))) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1747 /* unary operators */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1748 e = cadr(e);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1749 continue;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1750 } else if (BINARY_ARGS(car(e))) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1751 /* biary operators */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1752 if (contains_p(cadr(e),p)) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1753 e = caddr(e);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1754 continue;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1755 } else if (TARNARY_ARGS(car(e))) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1756 /* tarary operators */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1757 if (contains_p(cadr(e), p)) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1758 if (contains_p(caddr(e),p)) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1759 e = cadddr(e);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1760 continue;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1761 } else if (NULLARY_ARGS(car(e))) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1762 /* nullary operators */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1763 return 0;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1764 } else {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1765 fprintf(stderr,"Unknown Tree ID %d\n",car(e));
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1766 error(-1);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1767 return 0;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1768 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1769 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1770 return 0;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1771 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1772
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1773 /* end */