annotate mc-codegen.c @ 307:fda28752d301 stdarg-support

stdarg (varargs done... PowerPC, IA32 checked)
author kono
date Wed, 09 Jun 2004 23:01:18 +0900
parents 117baacd1ed0
children f73b93de216a
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
305
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
653 int
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
654 function_type(int e1,int *dots)
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
655 {
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
656 int ret_type,t;
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
657 ret_type = cadr(e1);
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
658 if (ret_type==CHAR) ret_type=INT;
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
659
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
660 /* check argments type is DOTS? */
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
661 t = caddr(e1);
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
662 if (t==0 || t==DOTS) *dots = 1;
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
663 else {
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
664 *dots = 0;
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
665 for(;t;t = cadr(t)) {
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
666 if (car(t)==DOTS) *dots = 1;
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
667 }
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
668 }
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
669
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
670 return ret_type;
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 297
diff changeset
671 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
672
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
673 static int
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
674 register_to_lvar(int e)
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
675 {
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
676 error(REG_ERR);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
677 return 0;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
678 #if 0
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
679 ÅÓÃæ¤Ç¥ì¥¸¥¹¥¿¤«¤éLVAR¤ËÊѹ¹¤·¤Æ¤â¡¢´Ö¤Ë¹ç¤ï¤Ê¤¤¡£
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
680
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
681 NMTBL *n = (NMTBL*)caddr(e);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
682 int reg = cadr(e);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
683 int tag = car(e);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
684 int lvar;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
685 int t;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
686 if (!n||n==&null_nptr) error(REG_ERR);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
687 if (tag==REGISTER) {
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
688 n->dsp = new_lvar(size_of_int);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
689 t = INT;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
690 } else if (tag==DREGISTER) {
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
691 n->dsp = new_lvar(size_of_double);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
692 t = DOUBLE;
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
693 } else if (tag==FREGISTER) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
694 n->dsp = new_lvar(size_of_float);
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
695 t = DOUBLE;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
696 } else if (tag==LREGISTER) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
697 n->dsp = new_lvar(size_of_longlong);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
698 t = LONGLONG;
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
699 } else error(-1);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
700 n->sc = LVAR;
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
701 lvar = list2(LVAR,n->dsp);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
702 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
703 if (tag==REGISTER||tag==DREGISTER||tag==FREGISTER||tag==LREGISTER) {
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
704 free_register(reg);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
705 return g_expr0(lvar);
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
706 #endif
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
707 }
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
708
277
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
709 // parallel assignment of registers.
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
710 //
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
711 // target = list3(target_regnum,next,source_regnum);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
712
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
713 void
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
714 parallel_rassign(int assigns)
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
715 {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
716 int free,tmp,tmp_target,remains,t0,t2,src;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
717 tmp = 0;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
718 for(;;) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
719 remains = 0;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
720 // find free target
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
721 for(free=assigns;free;free=cadr(free)) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
722 if (!caddr(free)) continue; // already done
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
723 remains++;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
724 t0 = car(free); // target register
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
725 // check target is free
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
726 for(src=assigns;src;src=cadr(src)) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
727 if ((t2=caddr(src)) && t0==t2) break; // target is in source
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
728 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
729 if (src==0) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
730 break; // free is a free target
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
731 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
732 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
733 if (remains==0) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
734 if (tmp) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
735 code_rlvar(tmp,tmp_target);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
736 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
737 return;
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
738 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
739 if (free) { // free target
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
740 if (t0!=caddr(free))
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
741 code_assign_register(t0,0,caddr(free));
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
742 } else { // no free target
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
743 for(free=assigns;free;free=cadr(free)) {
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
744 if (caddr(free)) break; // not yet done
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
745 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
746 if (!free) error(-1);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
747 tmp = new_lvar(size_of_int);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
748 tmp_target = car(free);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
749 code_assign_lvar(tmp,caddr(free),0);
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
750 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
751 caddr(free)=0; // mark it done
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
752 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
753 }
d5467cf30f58 Prallel Register Assignment
kono
parents: 273
diff changeset
754
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
755 /* goto arguments list */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
756 /* target list4(list2(tag,disp),cdr,ty,source_expr) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
757 /* source expr=listn(tag,...) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
758 /* source (after) list2(tag,disp) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
759 /* source list list3(e,cdr,sz) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
760
284
ec1a68133f6a MIPS f2u bug fix.
kono
parents: 280
diff changeset
761 #define DEBUG_PARALLEL_ASSIGN 0
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
762
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
763 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
764 overrap(int t,int sz,int source)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
765 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
766 int s,s0,s1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
767 int t0=cadr(t);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
768 int t1=t0+sz;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
769 for(;source;source=cadr(source)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
770 s=car(source); s0=cadr(s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
771 if(car(s)==REGISTER && car(t)==REGISTER) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
772 if(s0==t0) return s;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
773 } else if (is_same_type(s,t)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
774 s1=s0+caddr(source);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
775 #if DEBUG_PARALLEL_ASSIGN>1
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
776 printf("# ovedrrap source %d t0 %d t1 %d\n",car(car(t)),t0,t1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
777 printf("# ovedrrap target %d s0 %d s1 %d\n",car(car(source)),s0,s1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
778 printf("# ovedrrap equal = %d\n",((t0<=s0&&s0<t1)||(t0<s1&&s1<=t1)));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
779 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
780 if((t0<=s0&&s0<t1)||(t0<s1&&s1<=t1)) return s;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
781 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
782 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
783 return 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
784 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
785
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
786 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
787 remove_target(int *target,int t,int *use)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
788 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
789 int use0=*use;
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
790 int reg;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
791 while(use0) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
792 if (car(use0)==t) {
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
793 reg = car(caddr(use0));
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
794 if (reg==REGISTER||reg==FREGISTER||reg==DREGISTER)
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
795 free_register(cadr(caddr(use0)));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
796 break;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
797 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
798 use0 = cadr(use0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
799 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
800 remove0(target,t);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
801 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
802
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
803 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
804 save_target(int t,int s,int *target,int *use,int sz,int ty)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
805 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
806 int e1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
807 /*¿·¤·¤¤¥ì¥¸¥¹¥¿(or ¥¹¥¿¥Ã¥¯)¤ò¼èÆÀ¤¹¤ë*/
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
808 if (sz==size_of_int && (e1=get_register())!=-1) {
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
809 e1=list3(REGISTER,e1,0);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
810 *use=list3(t,*use,e1);
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
811 g_expr_u(assign_expr0(e1,s,ty,ty));
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
812 *target = append4(*target,t,ty,e1);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
813 #if FLOAT_CODE
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
814 } else if (sz==size_of_double && (e1=get_dregister(1))!=-1) {
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
815 e1=list3(DREGISTER,e1,0);
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
816 *use=list3(t,*use,e1);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
817 g_expr_u(assign_expr0(e1,s,ty,ty));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
818 *target = append4(*target,t,ty,e1);
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
819 } else if (sz==size_of_float && (e1=get_dregister(0))!=-1) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
820 e1=list3(FREGISTER,e1,0);
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
821 *use=list3(t,*use,e1);
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
822 g_expr_u(assign_expr0(e1,s,ty,ty));
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
823 *target = append4(*target,t,ty,e1);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
824 #endif
205
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
825 #if LONGLONG_CODE
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
826 } else if (sz==size_of_longlong && (e1=get_lregister())!=-1) {
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
827 e1=list3(LREGISTER,e1,0);
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
828 *use=list3(t,*use,e1);
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
829 g_expr_u(assign_expr0(e1,s,ty,ty));
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
830 *target = append4(*target,t,ty,e1);
a50f90d0b63a *** empty log message ***
kono
parents: 202
diff changeset
831 #endif
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
832 } else {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
833 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
834 *target = append4(*target,t,ty,e1);
117
2d5a203cc3a6 lvar reuse
kono
parents: 116
diff changeset
835 *use=list3(t,*use,e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
836 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
837 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
838
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
839 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
840 circular_dependency(int t,int s,int *target,int *source)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
841 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
842 int target0=*target;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
843 int t1,sz,ty,s1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
844 while(target0) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
845 if (cadddr(target0)==s) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
846 t1=car(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
847 s=cadddr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
848 sz=size(ty=caddr(target0));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
849 if(t==t1) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
850 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
851 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
852 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
853 return 1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
854 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
855 if ((s1=overrap(t1,sz,*source))) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
856 /* another overrap start over */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
857 return circular_dependency(t,s1,target,source);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
858 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
859 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
860 target0=cadr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
861 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
862 return 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
863 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
864
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
865 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
866 parallel_assign(int *target,int *source,int *processing,int *use)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
867 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
868 int t,s,sz,ty,target0,s1;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
869 while(*target) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
870 target0=*target;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
871 while(target0) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
872 t=car(target0); s=cadddr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
873 sz=size(ty=caddr(target0));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
874 if(car(t)==car(s) && cadr(t)==cadr(s)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
875 /*½ñ¤­¹þ¤ßÀ褬¼«Ê¬¼«¿È*/
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
876 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
877 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
878 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
879 remove_target(target,t,use);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
880 /* Ç˲õ¤µ¤ì¤Æ¤Ïº¤¤ë¤Î¤Ç¡¢source list¤«¤é¤Ï½ü¤«¤Ê¤¤ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
881 } else if (!(s1=overrap(t,sz,*source))) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
882 /* ½Å¤Ê¤Ã¤Æ¤Ê¤¤¤Î¤Ç°Â¿´¤·¤Æ½ñ¤­¹þ¤á¤ë */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
883 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
884 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
885 #endif
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
886 g_expr_u(assign_expr0(t,s,ty,ty));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
887 remove_target(target,t,use); remove0(source,s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
888 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
889 if(circular_dependency(t,s1,target,source)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
890 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
891 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
892 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
893 remove_target(target,t,use); remove0(source,s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
894 save_target(t,s,target,use,sz,ty);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
895 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
896 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
897 target0=cadr(target0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
898 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
899 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
900 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
901
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
902 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
903 remove0(int *parent,int e)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
904 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
905 int list;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
906 while ((list=*parent)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
907 if (car(list)==e) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
908 *parent= cadr(list); return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
909 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
910 parent=&cadr(list);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
911 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
912 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
913 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
914
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
915 /*
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
916 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
917 remove0_all(int *parent,int e)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
918 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
919 int list;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
920 while ((list=*parent)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
921 if (car(list)==e) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
922 *parent= cadr(list);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
923 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
924 parent=&cadr(list);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
925 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
926 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
927 }
105
7e3d59e56a53 save register ( incomplete )
kono
parents: 104
diff changeset
928 */
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
929
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
930 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
931 is_simple(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
932 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
933 return (
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
934 e1==CONST || e1==FNAME || e1==LVAR || e1==REGISTER ||e1==DREGISTER ||
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
935 e1==FREGISTER || e1==LREGISTER ||
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
936 e1==GVAR || e1==RGVAR || e1==RLVAR || e1==CRLVAR || e1==CRGVAR ||
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
937 e1==DRLVAR || e1==FRLVAR || e1==LRLVAR ||
165
kono
parents: 164
diff changeset
938 e1==CURLVAR || e1==SURLVAR || e1==CURGVAR || e1==SURGVAR
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_same_type(int e1,int e2)
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 int ce2=car(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
947 return (
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
948 (ce1==LVAR && (ce2==RLVAR||ce2==CRLVAR||ce2==FRLVAR||ce2==DRLVAR))
165
kono
parents: 164
diff changeset
949 || (ce1==LVAR && (ce2==SRLVAR||ce2==SURLVAR||ce2==CURLVAR))
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
950 || (ce2==LVAR && (ce1==RLVAR||ce1==CRLVAR||ce1==FRLVAR||ce1==DRLVAR))
165
kono
parents: 164
diff changeset
951 || (ce2==LVAR && (ce1==SRLVAR||ce1==SURLVAR||ce1==CURLVAR))
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
952 || (ce2==LVAR && (ce1==LRLVAR))
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
953 || (ce1==GVAR && (ce2==RGVAR||ce2==CRGVAR||ce2==FRGVAR||ce2==DRGVAR))
165
kono
parents: 164
diff changeset
954 || (ce1==GVAR && (ce2==SRGVAR||ce2==SURGVAR||ce2==CURGVAR))
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
955 || (ce2==GVAR && (ce1==RGVAR||ce1==CRGVAR||ce1==FRGVAR||ce1==DRGVAR))
165
kono
parents: 164
diff changeset
956 || (ce2==GVAR && (ce1==SRGVAR||ce1==SURGVAR||ce1==CURGVAR))
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
957 || (ce2==GVAR && (ce1==LRGVAR))
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
958 );
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
959 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
960
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
961 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
962 is_memory(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
963 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
964 int ce1=car(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
965 return (
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
966 ce1==LVAR ||ce1==RLVAR||ce1==CRLVAR || ce1==DRLVAR || ce1==LRLVAR ||
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
967 ce1==GVAR ||ce1==RGVAR||ce1==CRGVAR || ce1==DRGVAR || ce1==LRGVAR ||
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
968 ce1==FRLVAR || ce1==FRGVAR ||
165
kono
parents: 164
diff changeset
969 ce1==CURGVAR ||ce1==SURGVAR||ce1==SRGVAR ||
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
970 ce1==REGISTER|| ce1==DREGISTER || ce1==FREGISTER ||
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
971 ce1==LREGISTER
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
972 );
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
973 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
974
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
975
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
976 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
977 jump(int e1, int env)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
978 {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
979 int e2,e3,e4,sz,arg_size,ty,regs,fregs;
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
980 int t0,s0,r,reg;
127
eb4d8975926c Intel float fix
kono
parents: 126
diff changeset
981 NMTBL *code0 = 0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
982 int target = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
983 int source = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
984 int processing = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
985 int use = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
986
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
987 /* ¤Þ¤º¡¢¥µ¥¤¥º¤ò·×»»¤·¤Ê¤¬¤é¡¢·è¤Þ¤Ã¤¿·Á¤ËÍ¡£ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
988
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
989 arg_size = 0; regs = 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
990 fregs = 0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
991 for (e3 = reverse0(caddr(e1)); e3; e3 = cadr(e3)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
992 e2 = car(e3); sz = size(ty=caddr(e3));
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
993 if (scalar(ty) && (r = get_input_register_var(regs,0,1))) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
994 target=list4(r,target,ty,e2); regs++;
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
995 } else if (ty==FLOAT && (r = get_input_dregister_var(fregs,0,1,0))) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
996 target=list4(r, target,ty,e2); fregs++;
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
997 } else if (ty==DOUBLE && (r = get_input_dregister_var(fregs,0,1,1))) {
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
998 target=list4(r, target,ty,e2); fregs++;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
999 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1000 target=list4(list2(LVAR,0), target,ty,e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1001 }
128
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1002 /* keep arg space for register variables */
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1003 arg_size += sz;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1004 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1005 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
1006 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1007 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1008
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1009 /* disp ¤òÈô¤ÓÀè»÷¹ç¤ï¤»¤Æ½¤Àµ */
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
1010 if (is_code(fnptr)) {
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1011 if (-arg_size<disp) disp = -arg_size;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1012 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1013 if (disp_offset-arg_size<disp) disp = disp_offset-arg_size;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1014 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1015
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1016 /* Ê£»¨¤Ê¼°¤òÁ°¤â¤Ã¤Æ·×»»¤·¤Æ¤ª¤¯ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1017 /* ɬÍפʤé¶É½êÊÑ¿ô¤òÍѤ¤¤ë¡£ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1018 /* ¶É½êÊÑ¿ô¤Ø¤Î¥ª¥Õ¥»¥Ã¥È¤ò³Ð¤¨¤Æ¤ª¤¯ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1019
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1020 for (e2 = target; e2; e2 = cadr(e2)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1021 t0=car(e2); s0=cadddr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1022 sz=size(ty=caddr(e2));
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1023 if(car(t0)==LVAR) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1024 /* ¤³¤³¤Ç¡¢½ñ¹þÀ襢¥É¥ì¥¹¤ò·è¤á¤ë */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1025 cadr(t0)=-arg_size;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1026 }
128
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1027 arg_size-=sz;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1028 if (!is_simple(car(s0))) {
94
1ad7045741a7 float dbinop fix
kono
parents: 92
diff changeset
1029 g_expr_u(assign_expr0((e4=list2(LVAR,new_lvar(sz))),s0,ty,ty));
117
2d5a203cc3a6 lvar reuse
kono
parents: 116
diff changeset
1030 use=list3(ty,use,e1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1031 cadddr(e2)=e4;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1032 s0=e4;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1033 } else if (is_same_type(t0,s0)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1034 if(cadr(t0)==cadr(s0)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1035 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1036 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
1037 #endif
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1038 /* we should check size also (but currently useless) */
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1039 remove0(&target,t0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1040 /* still we have source to avoid overwrite */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1041 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1042 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1043 if(is_memory(s0)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1044 source=list3(s0,source,sz);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1045 #if DEBUG_PARALLEL_ASSIGN
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1046 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
1047 #endif
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1048 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1049 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1050
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1051 /* compute jump address */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1052 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1053 if (car(e2) == FNAME) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1054 code0=(NMTBL *)cadr(e2);
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
1055 if (!is_code(code0)) {
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1056 error(TYERR); return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1057 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1058 } else { /* indirect */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1059 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1060 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1061 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1062 if (env) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1063 g_expr(env);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1064 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1065 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1066
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1067 /* ÊÂÎóÂåÆþ¤ò¼Â¹Ô */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1068 parallel_assign(&target,&source,&processing,&use);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1069 while (use) {
147
cb7aa0089681 creg/ireg done for powerpc.
kono
parents: 144
diff changeset
1070 reg = car(caddr(use));
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1071 if (reg==REGISTER||reg==FREGISTER||reg==DREGISTER||reg==LREGISTER)
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1072 free_register(cadr(caddr(use)));
117
2d5a203cc3a6 lvar reuse
kono
parents: 116
diff changeset
1073 else if (car(caddr(use))==LVAR)
2d5a203cc3a6 lvar reuse
kono
parents: 116
diff changeset
1074 free_lvar(cadr(caddr(use)));
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1075 use=cadr(use);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1076 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1077 if(target) error(-1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1078
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1079 if (env) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1080 /* change the frame pointer */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1081 e3 = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1082 code_frame_pointer(e3);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1083 emit_pop_free(e3);
98
07c2554e1cfa *** empty log message ***
kono
parents: 97
diff changeset
1084 } else if (is_function(fnptr)) {
128
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1085 if (car(e2) != FNAME) {
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1086 e2 = emit_pop(0);
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1087 code_fix_frame_pointer(disp_offset);
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1088 code_indirect_jmp(e2);
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1089 emit_pop_free(e2);
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1090 return;
d497c39add36 arg.c works (?)
kono
parents: 127
diff changeset
1091 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1092 code_fix_frame_pointer(disp_offset);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1093 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1094
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1095 if (car(e2) == FNAME) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1096 code_jmp(code0->nm);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1097 } else {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1098 e2 = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1099 code_indirect_jmp(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1100 emit_pop_free(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1101 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1102 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1103
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1104 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1105 machinop(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1106 {
240
b59364f5b030 *** empty log message ***
kono
parents: 239
diff changeset
1107 int e2,e3,op;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1108
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1109 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1110 op = car(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1111 e3 = caddr(e1);
240
b59364f5b030 *** empty log message ***
kono
parents: 239
diff changeset
1112 if (code_const_op_p(op,e3)) {
189
f53d70110377 immediate instructions.
kono
parents: 187
diff changeset
1113 g_expr(e2);
240
b59364f5b030 *** empty log message ***
kono
parents: 239
diff changeset
1114 oprtc(op,USE_CREG,e3);
189
f53d70110377 immediate instructions.
kono
parents: 187
diff changeset
1115 return;
f53d70110377 immediate instructions.
kono
parents: 187
diff changeset
1116 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1117 g_expr(e3);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1118 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1119 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1120 tosop(op,USE_CREG,(e2=pop_register()));
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1121 emit_pop_free(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1122 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1123 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1124
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1125 #if FLOAT_CODE
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1126 void
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
1127 dmachinop(int e1,int d)
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1128 {
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1129 int e2,e3,op;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1130
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1131 e2 = cadr(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1132 op = car(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1133 e3 = caddr(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1134 g_expr(e3);
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
1135 emit_dpush(d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1136 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1137 dtosop(car(e1),USE_CREG,(e2=emit_dpop(d)));
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1138 emit_dpop_free(e2,d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1139 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1140 }
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1141 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1142
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1143 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1144 void
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1145 lmachinop(int e1)
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1146 {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1147 int e2,e3,op;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1148
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1149 e2 = cadr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1150 op = car(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1151 e3 = caddr(e1);
213
kono
parents: 212
diff changeset
1152 if (code_lconst_op_p(op,e3)) {
kono
parents: 212
diff changeset
1153 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1154 loprtc(op,USE_CREG,e3);
213
kono
parents: 212
diff changeset
1155 return;
kono
parents: 212
diff changeset
1156 }
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1157 g_expr(e3);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1158 emit_lpush();
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1159 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1160 ltosop(car(e1),USE_CREG,(e2=emit_lpop()));
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1161 emit_lpop_free(e2);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1162 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1163 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1164 #endif
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1165
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1166 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1167 sassign(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1168 {
258
22949117768f Complex function argments. Struct is done. Long long is odd.
kono
parents: 256
diff changeset
1169 int e2,e3,e4,sz,xreg,det,offset;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1170
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1171 /* structure assignment */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1172 e2 = cadr(e1); /* pointer variable to the struct */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1173 e3 = cadr(e2); /* offset of the variable (distination) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1174 e4 = caddr(e1); /* right value (source) */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1175 sz = cadddr(e1); /* size of struct or union */
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1176 if (is_same_type(e2,e4)&&cadr(e2)==cadr(e4)) {
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1177 if (use) g_expr(e4);
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1178 return;
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1179 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1180 g_expr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1181 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1182 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1183 xreg = emit_pop(0);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1184 /* °ìÈÌŪ¤Ë¤Ï¥³¥Ô¡¼¤Î¥ª¡¼¥Ð¥é¥Ã¥×¤Î¾õ¶·¤Ï¼Â¹Ô»þ¤Ë¤·¤«¤ï¤«¤é¤Ê¤¤ */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1185 /* ¤·¤«¤·¡¢¤ï¤«¤ë¾ì¹ç¤â¤¢¤ë */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1186 if (car(e4)==RSTRUCT) e4=cadr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1187 if (is_same_type(e2,e4)) {
258
22949117768f Complex function argments. Struct is done. Long long is odd.
kono
parents: 256
diff changeset
1188 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
1189 det=1;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1190 } else {
258
22949117768f Complex function argments. Struct is done. Long long is odd.
kono
parents: 256
diff changeset
1191 det = 0; offset=0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1192 }
258
22949117768f Complex function argments. Struct is done. Long long is odd.
kono
parents: 256
diff changeset
1193 emit_copy(xreg,USE_CREG,sz,offset,1,det);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1194 emit_pop_free(xreg);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1195 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1196 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1197
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1198 static void
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1199 assign_opt(int e5,int e2,int e4,int byte)
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1200 {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1201 int reg;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1202 /* e2=e4 */
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1203 if (e5==REGISTER) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1204 reg = cadr(e4);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1205 switch(car(e2)) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1206 case GVAR: code_assign_gvar(e2,reg,byte); return;
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1207 case LVAR: code_assign_lvar(cadr(e2),reg,byte); return;
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1208 case REGISTER: code_assign_register(cadr(e2),byte,reg); return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1209 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1210 g_expr(e2);
233
2208a18f3799 *** empty log message ***
kono
parents: 232
diff changeset
1211 code_assign(USE_CREG,byte,reg);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1212 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1213 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1214 /* e2 is register now */
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1215 if (car(e2)!=REGISTER) error(-1);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1216 reg = cadr(e2);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1217 switch(e5) {
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1218 case CRGVAR:
165
kono
parents: 164
diff changeset
1219 case CURGVAR: code_crgvar(e4,reg,e5==CRGVAR,1); return;
kono
parents: 164
diff changeset
1220 case SRGVAR:
kono
parents: 164
diff changeset
1221 case SURGVAR: code_crgvar(e4,reg,e5==SRGVAR,size_of_short); return;
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1222 case RGVAR: code_rgvar(e4,reg); return;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1223 case CRLVAR:
165
kono
parents: 164
diff changeset
1224 case CURLVAR: code_crlvar(cadr(e4),reg,e5==CRLVAR,1); return;
kono
parents: 164
diff changeset
1225 case SRLVAR:
kono
parents: 164
diff changeset
1226 case SURLVAR: code_crlvar(cadr(e4),reg,e5==SRLVAR,size_of_short); return;
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1227 case RLVAR: code_rlvar(cadr(e4),reg); return;
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1228 case GVAR: code_gvar(e4,reg); return;
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1229 case LVAR: code_lvar(cadr(e4),reg); return;
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1230 case CONST: code_const(cadr(e4),reg); return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1231 case ADDRESS:
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1232 if (car(cadr(e4))==STRING) code_string(cadr(e4),reg);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1233 else code_gvar(cadr(e4),reg);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1234 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1235 case FNAME: code_fname((NMTBL*)cadr(e4),reg); return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1236 case STRING: code_string(e4,reg); return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1237 default: error(-1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1238 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1239 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1240
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1241 void
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1242 assign(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1243 {
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1244 int e2,e4,byte,e5;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1245
166
9e55cc5551fb *** empty log message ***
kono
parents: 165
diff changeset
1246 byte=(car(e1) == CASS)?1:(car(e1) == SASS)?size_of_short:0;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1247 /* e2=e4 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1248 e2 = cadr(e1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1249 e4 = caddr(e1);e5=car(e4);
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1250 if (is_same_type(e2,e4)&&cadr(e2)==cadr(e4)) {
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1251 if (use) g_expr(e4);
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1252 return;
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1253 }
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1254 if (!use && (
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1255 (e5==REGISTER) ||
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1256 (car(e2)==REGISTER&&(
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1257 e5== CRGVAR || e5== CRLVAR || e5== RGVAR || e5== RLVAR ||
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1258 e5== CURGVAR || e5== CURLVAR ||
165
kono
parents: 164
diff changeset
1259 e5== SURGVAR || e5== SURLVAR ||
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1260 e5== GVAR || e5== LVAR ||
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1261 e5== CONST || e5== FNAME || e5== STRING ||
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1262 (e5==ADDRESS&&car(cadr(e4))==STRING) ||
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1263 (e5==ADDRESS&&car(cadr(e4))==GVAR) )))) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1264 assign_opt(e5,e2,e4,byte);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1265 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1266 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1267 switch(car(e2)) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1268 case GVAR: /* i=3 */
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1269 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1270 code_assign_gvar(e2,USE_CREG,byte);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1271 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1272 case LVAR:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1273 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1274 code_assign_lvar(cadr(e2),USE_CREG,byte);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1275 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1276 case REGISTER:
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1277 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1278 code_assign_register(cadr(e2),byte,USE_CREG);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1279 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1280 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1281 g_expr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1282 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1283 g_expr(e4);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1284 e2 = emit_pop(0);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1285 code_assign(e2,byte,USE_CREG);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1286 emit_pop_free(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1287 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1288 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1289
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1290 #if FLOAT_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1291
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1292 static void
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1293 dassign_opt(int e5,int e2,int e4,int d)
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1294 {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1295 int reg;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1296 /* e2=e4 */
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1297 if (e5==DREGISTER||e5==FREGISTER) {
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1298 reg = cadr(e4);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1299 switch(car(e2)) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1300 case GVAR: /* i=3 */
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1301 code_dassign_gvar(e2,reg,d);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1302 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1303 case LVAR:
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1304 code_dassign_lvar(cadr(e2),reg,d);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1305 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1306 case DREGISTER:
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1307 case FREGISTER:
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1308 if (reg!=cadr(e2))
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1309 code_dassign_dregister(cadr(e2),d,reg);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1310 return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1311 default:
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1312 error(-1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1313 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1314 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1315 /* e2 is register now */
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1316 if (car(e2)!=DREGISTER && car(e2)!=FREGISTER) error(-1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1317 reg = cadr(e2);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1318 switch(e5) {
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1319 case FRGVAR:
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1320 case DRGVAR: code_drgvar(e4,d,reg); return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1321 case FRLVAR:
119
b815fcd57b9d input var ( incomplete )
kono
parents: 118
diff changeset
1322 case DRLVAR: code_drlvar(cadr(e4),d,reg); return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1323 case FCONST:
264
7de200d88747 MIPS first binary run (inomplete)
kono
parents: 258
diff changeset
1324 case DCONST: code_dconst(e4,reg,d); return;
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1325 default:
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1326 error(-1);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1327 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1328 }
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1329
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1330 void
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1331 dassign(int e1)
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1332 {
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1333 int e2,e3,e4,d,e5;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1334
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1335 /* e2=e4 */
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1336 e2 = cadr(e1);
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1337 e3 = cadr(e2);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1338 e4 = caddr(e1); e5=car(e4);
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1339 if (is_same_type(e2,e4)&&cadr(e2)==cadr(e4)) {
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1340 if (use) g_expr(e4);
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1341 return;
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1342 }
249
8313c965c0e2 *** empty log message ***
kono
parents: 246
diff changeset
1343 if (car(e1)==DASS) d=1;
8313c965c0e2 *** empty log message ***
kono
parents: 246
diff changeset
1344 else if (car(e1)==FASS) d=0;
8313c965c0e2 *** empty log message ***
kono
parents: 246
diff changeset
1345 else error(-1);
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1346 if (!use && (
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1347 (e5==DREGISTER) || (e5==FREGISTER) ||
133
7d436c08e949 separate float / double flow
kono
parents: 132
diff changeset
1348 (car(e2)==DREGISTER&&(e5==DRGVAR||e5==DRLVAR||e5==DCONST))||
249
8313c965c0e2 *** empty log message ***
kono
parents: 246
diff changeset
1349 (car(e2)==FREGISTER&&(e5==FRGVAR||e5==FRLVAR||e5==FCONST))
118
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1350 )) {
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1351 dassign_opt(e5,e2,e4,d);
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1352 return;
07b91b625f84 assignment optimization
kono
parents: 117
diff changeset
1353 }
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1354 switch(car(e2)) {
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
1355 case GVAR:
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1356 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1357 code_dassign_gvar(e2,USE_CREG,d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1358 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1359 case LVAR:
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1360 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1361 code_dassign_lvar(cadr(e2),USE_CREG,d);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1362 return;
111
7aa449aff3e6 floating point
kono
parents: 109
diff changeset
1363 case DREGISTER:
138
e6e77af048a1 float/dobule configuration
kono
parents: 137
diff changeset
1364 case FREGISTER:
111
7aa449aff3e6 floating point
kono
parents: 109
diff changeset
1365 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1366 code_dassign_dregister(cadr(e2),d,USE_CREG);
111
7aa449aff3e6 floating point
kono
parents: 109
diff changeset
1367 return;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1368 }
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1369 g_expr(e2);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
1370 emit_push();
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1371 g_expr(e4);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
1372 e2 = emit_pop(0);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1373 code_dassign(e2,USE_CREG,d);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
1374 emit_pop_free(e2);
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1375 return;
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1376 }
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1377
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1378 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1379
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1380 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1381
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1382 void
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1383 lassign_opt(int e5,int e2,int e4)
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1384 {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1385 int reg;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1386 /* e2=e4 */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1387 if (e5==LREGISTER) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1388 reg = cadr(e4);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1389 switch(car(e2)) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1390 case GVAR: /* i=3 */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1391 code_lassign_gvar(e2,reg);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1392 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1393 case LVAR:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1394 code_lassign_lvar(cadr(e2),reg);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1395 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1396 case LREGISTER:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1397 if (reg!=cadr(e2))
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1398 code_lassign_lregister(cadr(e2),reg);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1399 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1400 default:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1401 error(-1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1402 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1403 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1404 /* e2 is register now */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1405 if (car(e2)!=LREGISTER) error(-1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1406 reg = cadr(e2);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1407 switch(e5) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1408 case LRGVAR: code_lrgvar(e4,reg); return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1409 case LRLVAR: code_lrlvar(cadr(e4),reg); return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1410 case LCONST: code_lconst(e4,reg); return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1411 default:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1412 error(-1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1413 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1414 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1415
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1416 void
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1417 lassign(int e1)
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1418 {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1419 int e2,e3,e4,e5;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1420
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1421 /* e2=e4 */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1422 e2 = cadr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1423 e3 = cadr(e2);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1424 e4 = caddr(e1); e5=car(e4);
269
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1425 if (is_same_type(e2,e4)&&cadr(e2)==cadr(e4)) {
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1426 if (use) g_expr(e4);
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1427 return;
d9f4026de4e3 MIPS continue...
kono
parents: 264
diff changeset
1428 }
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1429 if (!use && (
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1430 (e5==LREGISTER) ||
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1431 (car(e2)==LREGISTER&&(e5==LRGVAR||e5==LRLVAR||e5==LCONST))
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1432 )) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1433 lassign_opt(e5,e2,e4);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1434 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1435 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1436 switch(car(e2)) {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1437 case GVAR:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1438 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1439 code_lassign_gvar(e2,USE_CREG);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1440 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1441 case LVAR:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1442 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1443 code_lassign_lvar(cadr(e2),USE_CREG);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1444 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1445 case LREGISTER:
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1446 g_expr(e4);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1447 code_lassign_lregister(cadr(e2),USE_CREG);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1448 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1449 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1450 g_expr(e2);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
1451 emit_push();
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1452 g_expr(e4);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
1453 e2 = emit_pop(0);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1454 code_lassign(e2,USE_CREG);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
1455 emit_pop_free(e2);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1456 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1457 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1458
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1459 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1460
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1461 void
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1462 assop(int e1)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1463 {
165
kono
parents: 164
diff changeset
1464 int e2,e3,byte,op,sign,size;
255
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1465 int n,t;
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1466
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1467 /* e2 op= e3 */
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1468 if (car(e1) == CUASSOP) {
165
kono
parents: 164
diff changeset
1469 byte = 1; sign = 0; size = 1;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1470 } else if (car(e1) == CASSOP) {
165
kono
parents: 164
diff changeset
1471 byte = 1; sign = 1; size = 1;
kono
parents: 164
diff changeset
1472 } else if (car(e1) == SUASSOP) {
kono
parents: 164
diff changeset
1473 byte = size_of_short; sign = 0; size = size_of_short;
kono
parents: 164
diff changeset
1474 } else if (car(e1) == SASSOP) {
kono
parents: 164
diff changeset
1475 byte = size_of_short; sign = 1; size = size_of_short;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1476 } else {
165
kono
parents: 164
diff changeset
1477 byte = 0; sign = 1; size = size_of_int;
162
0c604d2ff585 *** empty log message ***
kono
parents: 160
diff changeset
1478 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1479 e2 = cadr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1480 if (car(e2)==INDIRECT) e2=cadr(e2);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1481 e3 = caddr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1482 op = cadddr(e1);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1483
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1484 if (car(e2)==REGISTER) {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1485 if (code_const_op_p(op,e3)) {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1486 oprtc(op,cadr(e2),e3);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1487 } else {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1488 g_expr(e3);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1489 code_register_assop(cadr(e2),USE_CREG,op,byte);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1490 }
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1491 if (use) {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1492 code_register(cadr(e2),USE_CREG);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1493 }
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1494 return;
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1495 }
255
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1496 if (car(e3)==CONST) {
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1497 /* e2 = e2 op e3; */
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1498 t = sign?INT:UNSIGNED;
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1499 // oprtc expected
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1500 if (car(e2)==LVAR||car(e2)==GVAR) {
255
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1501 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
1502 return;
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1503 }
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1504 /* new = &e2 */
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1505 /* *new = *new op e3 */
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1506 n = list2(LVAR,new_lvar(size_of_int));
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1507 g_expr_u(assign_expr0(n,list2(ADDRESS,e2),INT,INT));
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1508 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
1509 free_lvar(cadr(n));
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1510 return;
8cd8d72286ae PowerPC long long complex function call fix.
kono
parents: 250
diff changeset
1511 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1512 g_expr(e3);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1513 emit_push();
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1514 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1515 code_assop(op,USE_CREG,byte,sign);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1516 return;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1517 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1518
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1519 #if FLOAT_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1520
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1521 void
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1522 dassop(int e1)
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1523 {
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1524 int e2,e3,op,d;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1525
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1526 /* e2 op= e3 */
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1527 d = (car(e1) == DASSOP);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1528 e2 = cadr(e1);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1529 if (car(e2)==INDIRECT) e2=cadr(e2);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1530 e3 = caddr(e1);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1531 op = cadddr(e1);
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1532
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1533 g_expr(e3);
144
56211702f298 creg/freg continue
kono
parents: 139
diff changeset
1534 if (car(e2)==DREGISTER||car(e2)==FREGISTER) {
273
87b9cfc86a10 *** empty log message ***
kono
parents: 269
diff changeset
1535 emit_dpush(d);
219
6190d24e178c long long code generation level 4
kono
parents: 218
diff changeset
1536 code_register_dassop(cadr(e2),op,d);
273
87b9cfc86a10 *** empty log message ***
kono
parents: 269
diff changeset
1537 if (use)
87b9cfc86a10 *** empty log message ***
kono
parents: 269
diff changeset
1538 code_dregister(cadr(e2),USE_CREG,d);
87b9cfc86a10 *** empty log message ***
kono
parents: 269
diff changeset
1539 return;
144
56211702f298 creg/freg continue
kono
parents: 139
diff changeset
1540 }
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1541 emit_dpush(d);
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1542 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1543 code_dassop(op,USE_CREG,d);
83
f3f75911d62c *** empty log message ***
kono
parents: 82
diff changeset
1544 return;
81
f94ca1168520 float first try...
kono
parents: 80
diff changeset
1545 }
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1546
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1547 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1548
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1549 #if LONGLONG_CODE
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1550
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1551 static int
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1552 long_sign(int op)
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1553 {
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1554 return (op==LUDIV||op==LUMOD||op==LULSHIFT||op==LURSHIFT)?ULONGLONG:LONGLONG;
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1555 }
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1556
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1557 void
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1558 lassop(int e1)
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1559 {
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1560 int e2,e3,op;
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1561 int n,t;
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1562
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1563 /* e2 op= e3 */
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1564 e2 = cadr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1565 if (car(e2)==INDIRECT) e2=cadr(e2);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1566 e3 = caddr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1567 op = cadddr(e1);
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1568
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1569 if (car(e2)==LREGISTER) {
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1570 if (code_lconst_op_p(op,e3)) {
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1571 loprtc(op,cadr(e2),e3);
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1572 if (use) {
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1573 code_lregister(cadr(e2),USE_CREG);
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1574 }
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1575 return;
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1576 }
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1577 if (code_lassop_p) {
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1578 g_expr(e3);
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1579 emit_lpush();
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1580 code_register_lassop(cadr(e2),op);
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1581 if (use) {
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1582 code_lregister(cadr(e2),USE_CREG);
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1583 }
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1584 return;
285
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1585 }
912b54949344 register assop const ( int/long )
kono
parents: 284
diff changeset
1586 }
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1587 if (!code_lassop_p||car(e3)==LCONST) {
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1588 /* e2 = e2 op e3; */
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1589 t = long_sign(op);
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1590 if (car(e2)==LREGISTER||car(e2)==LVAR||car(e2)==GVAR) {
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1591 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
1592 return;
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1593 }
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1594 /* new = &e2 */
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1595 /* *new = *new op e3 */
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1596 n = list2(LVAR,new_lvar(size_of_int));
239
1849e0079f08 ia32 long long continue
kono
parents: 238
diff changeset
1597 g_expr_u(assign_expr0(n,list2(ADDRESS,e2),INT,INT));
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1598 g_expr(assign_expr0(list2(INDIRECT,n),list3(op,n,e3),t,t));
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1599 free_lvar(cadr(n));
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1600 return;
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1601 }
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1602
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1603 g_expr(e3);
286
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1604 if (car(e2)==LREGISTER) {
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1605 emit_lpush();
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1606 code_register_lassop(cadr(e2),op);
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1607 if (use)
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1608 code_lregister(cadr(e2),USE_CREG);
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1609 return;
179e22f166ef register assop fix
kono
parents: 285
diff changeset
1610 }
238
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1611 emit_lpush();
d64e9a6a66bd ia32 long long code written.
kono
parents: 233
diff changeset
1612 g_expr(e2);
221
ceae585186d9 *** empty log message ***
kono
parents: 220
diff changeset
1613 code_lassop(op,USE_CREG);
195
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1614 return;
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1615 }
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1616
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1617 #endif
c193120ee2a6 *** empty log message ***
kono
parents: 194
diff changeset
1618
95
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1619 void
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
1620 cmpdimm(int e, int csreg,int label,int cond)
95
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1621 {
287
a0779a414855 *** empty log message ***
kono
parents: 286
diff changeset
1622 code_cmpdimm(e, csreg,label,cond);
95
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1623 }
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1624
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1625 int
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1626 csvalue()
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1627 {
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1628 return code_csvalue();
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1629 }
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1630
185d2cc6a3a9 *** empty log message ***
kono
parents: 94
diff changeset
1631
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1632 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1633 fwdlabel(void)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1634 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1635 return labelno++;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1636 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1637
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1638 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1639 fwddef(int l)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1640 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1641 control=1;
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1642 if (!chk)
92
e7f8515ba882 *** empty log message ***
kono
parents: 91
diff changeset
1643 code_label(l);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1644 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1645
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1646 int
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1647 backdef(void)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1648 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1649 control=1;
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1650 if (!chk)
92
e7f8515ba882 *** empty log message ***
kono
parents: 91
diff changeset
1651 code_label(labelno);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1652 return labelno++;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1653 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1654
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1655 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1656 def_label(int cslabel, int dlabel)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1657 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1658 int fl;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1659
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1660 fl = 0;
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1661 if (control) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1662 jmp(fl=fwdlabel());
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1663 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1664 fwddef(cslabel);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1665 if (dlabel)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1666 jmp(dlabel);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1667 if (fl) {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1668 fwddef(fl);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1669 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1670 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1671
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1672 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1673 gen_source(char *s)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1674 {
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1675 printf("%s",s);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1676 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1677
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1678 void
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1679 ret(void)
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1680 {
107
06f72222d6b5 prevent destorying function argument (incomeplete)
kono
parents: 105
diff changeset
1681 code_set_return_register(1);
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1682 jmp(retlabel);
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1683 }
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1684
66
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1685 void
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1686 opening(char *filename)
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1687 {
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1688 emit_init();
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1689 if (!chk)
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1690 code_opening(filename);
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1691 }
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1692
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1693 void
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1694 closing()
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1695 {
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1696 if (!chk)
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1697 code_closing();
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1698 }
0b068058dd67 *** empty log message ***
kono
parents: 61
diff changeset
1699
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1700 int
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1701 contains_in_list(int e,int type)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1702 {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1703 while(e) {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1704 if(contains(car(e),type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1705 e = cadr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1706 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1707 return 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1708 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1709
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1710 int
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1711 contains(int e,int type)
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1712 {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1713 while(e) {
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1714 if (car(e)==type) return 1;
256
d80e6387c539 powerpc function call complex arugment pre computation.
kono
parents: 255
diff changeset
1715 if (!car(e)) return 0;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1716 if (LIST_ARGS(car(e))){
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1717 /* list arguments */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1718 return contains_in_list(caddr(e),type);
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1719 } else if (UNARY_ARGS(car(e))) {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1720 /* unary operators */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1721 e = cadr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1722 continue;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1723 } else if (BINARY_ARGS(car(e))) {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1724 /* biary operators */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1725 if (contains(cadr(e),type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1726 e = caddr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1727 continue;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1728 } else if (TARNARY_ARGS(car(e))) {
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1729 /* tarary operators */
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1730 if (contains(cadr(e), type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1731 if (contains(caddr(e),type)) return 1;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1732 e = cadddr(e);
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1733 continue;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1734 } else if (NULLARY_ARGS(car(e))) {
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1735 /* nullary operators */
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1736 return 0;
164
1c2a9232ea93 mc.h generation
kono
parents: 162
diff changeset
1737 } else {
135
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1738 fprintf(stderr,"Unknown Tree ID %d\n",car(e));
4cfd24d1b929 fix power-pc basic test
kono
parents: 133
diff changeset
1739 error(-1);
99
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1740 return 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1741 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1742 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1743 return 0;
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1744 }
53899975154c *** empty log message ***
kono
parents: 98
diff changeset
1745
223
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1746 int
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1747 contains_in_list_p(int e,int (*p)(int))
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1748 {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1749 while(e) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1750 if(contains_p(car(e),p)) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1751 e = cadr(e);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1752 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1753 return 0;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1754 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1755
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1756 int
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1757 contains_p(int e,int (*p)(int))
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1758 {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1759 while(e) {
256
d80e6387c539 powerpc function call complex arugment pre computation.
kono
parents: 255
diff changeset
1760 if (!car(e)) return 0;
223
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1761 if (p(car(e))) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1762 if (LIST_ARGS(car(e))){
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1763 /* list arguments */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1764 return contains_in_list_p(caddr(e),p);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1765 } else if (UNARY_ARGS(car(e))) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1766 /* unary operators */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1767 e = cadr(e);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1768 continue;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1769 } else if (BINARY_ARGS(car(e))) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1770 /* biary operators */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1771 if (contains_p(cadr(e),p)) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1772 e = caddr(e);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1773 continue;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1774 } else if (TARNARY_ARGS(car(e))) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1775 /* tarary operators */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1776 if (contains_p(cadr(e), p)) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1777 if (contains_p(caddr(e),p)) return 1;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1778 e = cadddr(e);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1779 continue;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1780 } else if (NULLARY_ARGS(car(e))) {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1781 /* nullary operators */
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1782 return 0;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1783 } else {
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1784 fprintf(stderr,"Unknown Tree ID %d\n",car(e));
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1785 error(-1);
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1786 return 0;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1787 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1788 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1789 return 0;
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1790 }
1ac647873577 *** empty log message ***
kono
parents: 222
diff changeset
1791
61
8ffb8ca3fe34 separation of architecture dependent part.
kono
parents:
diff changeset
1792 /* end */