annotate mc-codegen.c @ 82:25654dc29ecc

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