annotate mc-codegen.c @ 323:d5cb084fc3f4

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