Mercurial > hg > CbC > old > device
annotate mc-code.h @ 547:9defd9459016
*** empty log message ***
author | kono |
---|---|
date | Tue, 03 Jan 2006 12:02:26 +0900 |
parents | 9f2d6aea201f |
children | ac181d7f9c82 |
rev | line source |
---|---|
61 | 1 /* function required by mc-codegen.c |
2 mc-code-*.c have to provied these | |
3 */ | |
4 | |
173 | 5 |
452 | 6 #define MAX_MAX 50 /* architecture independent max registers */ |
7 #define INPUT_REG 2 /* input register ( can be reused ) */ | |
8 #define USING_REG 1 /* unreusable register usage */ | |
144 | 9 |
452 | 10 extern char *l_include_path[]; /* library including path */ |
173 | 11 |
452 | 12 extern int disp_offset; /* displacement offset in code and function */ |
254 | 13 |
83 | 14 extern int MAX_REGISTER; |
15 extern int MAX_REGISTGER_VAR; | |
16 extern int MAX_FREGISTER; | |
103 | 17 |
18 extern int MAX_INPUT_REGISTER_VAR; | |
19 extern int MAX_CODE_INPUT_REGISTER_VAR; | |
20 extern int MAX_INPUT_DREGISTER_VAR; | |
138 | 21 extern int MAX_CODE_INPUT_FREGISTER_VAR; |
103 | 22 extern int MAX_CODE_INPUT_DREGISTER_VAR; |
99 | 23 |
94 | 24 #define REG_LVAR_OFFSET 2 |
83 | 25 |
340 | 26 extern int data_alignment; |
327 | 27 |
452 | 28 extern int code_lassop_p; /* architecture has code_lassop */ |
238 | 29 |
327 | 30 /* used by mc-codegen */ |
31 | |
516 | 32 extern void data_mode(char *name); |
33 extern void text_mode(int align); | |
34 extern void cstring_mode(); | |
35 | |
452 | 36 extern void gexpr_init(void); /* code generator initialize for each statement */ |
327 | 37 extern void emit_init(void); /* called before delcalartion */ |
452 | 38 extern void gen_gdecl(char *n, int gpc); /* global definition */ |
327 | 39 |
40 extern void code_init(); /* called only once */ | |
41 extern void emit_reinit(); /* called for each file */ | |
42 | |
61 | 43 extern void gexpr_code_init(void); |
327 | 44 |
45 extern void code_enter(char *name); | |
46 extern void code_enter1(int args); | |
47 extern void code_leave(char *name); | |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
48 extern void code_label_call(int i); |
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
49 extern void code_ret(); |
327 | 50 extern void enter(char *name); |
51 extern void enter1(); | |
52 extern void leave(int control, char *name); | |
53 extern void jmp(int l); | |
449 | 54 extern int not_simple_p(int l); |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
55 extern void code_save_stacks(); |
327 | 56 |
105 | 57 extern int get_register_var(NMTBL *n); |
138 | 58 extern int get_dregister_var(NMTBL *n,int d); |
195 | 59 extern int get_lregister_var(NMTBL *n); |
126 | 60 extern int get_input_register_var(int,NMTBL *,int); |
138 | 61 extern int get_input_dregister_var(int,NMTBL *,int,int); |
195 | 62 extern int get_input_lregister_var(int,NMTBL *,int); |
341 | 63 extern void code_ptr_cache_def(int r,NMTBL *nptr); |
64 extern void use_ptr_cache(int r); | |
345 | 65 extern int code_register_overlap(int s,int t); |
341 | 66 |
426 | 67 extern int emit_push(); |
61 | 68 extern int emit_pop(int type); |
69 extern void gexpr_code_init(); | |
95 | 70 extern int code_csvalue(); |
147 | 71 extern void code_gexpr(int e); |
287 | 72 extern void code_cmpdimm(int e, int csreg,int label,int cond); |
107 | 73 extern void code_gvar(int e1,int reg); |
74 extern void code_rgvar(int e1,int reg); | |
165 | 75 extern void code_crgvar(int e1,int reg,int sign,int sz); |
107 | 76 extern void code_lvar(int e2,int reg); |
77 extern void code_register(int e2,int reg); | |
94 | 78 extern void code_rlvar(int e2,int reg); |
165 | 79 extern void code_crlvar(int e2,int reg,int sign,int sz); |
109 | 80 extern void code_fname(NMTBL *n,int reg); |
107 | 81 extern void code_const(int e2,int reg); |
82 extern void code_neg(int reg); | |
83 extern void code_not(int reg); | |
84 extern void code_lnot(int reg); | |
168 | 85 extern void code_preinc(int e1,int e2,int dir,int sign,int sz,int reg); |
86 extern void code_postinc(int e1,int e2,int dir,int sign,int sz,int reg); | |
107 | 87 extern void code_return(int reg); |
88 extern void code_environment(int reg); | |
221 | 89 extern void code_bool(int e1,int reg); |
287 | 90 extern void code_cmp_crgvar(int e1,int reg,int sz,int label,int cond); |
91 extern void code_cmp_crlvar(int e1,int reg,int sz,int label,int cond); | |
92 extern void code_cmp_rgvar(int e1,int reg,int label,int cond); | |
93 extern void code_cmp_rlvar(int e1,int reg,int label,int cond); | |
94 extern void code_cmp_register(int e2,int label,int cond); | |
107 | 95 extern void code_string(int e1,int reg); |
61 | 96 extern void emit_copy(int from,int to,int length,int offset,int value,int det); |
94 | 97 extern int function(int e1); |
61 | 98 extern void code_frame_pointer(int e3); |
99 extern void code_fix_frame_pointer(int disp_offset); | |
100 extern void code_jmp(char *s); | |
101 extern void code_indirect_jmp(int e2); | |
196 | 102 |
355 | 103 extern void code_rindirect(int e1, int reg,int offset, int us,int sz); |
196 | 104 #if FLOAT_CODE |
221 | 105 extern int code_drindirect(int e1, int reg,int offset, int d); |
196 | 106 #endif |
107 #if LONGLONG_CODE | |
221 | 108 extern int code_lrindirect(int e1, int reg,int offset, int us); |
196 | 109 #endif |
110 | |
103 | 111 extern void code_assign_gvar(int e2,int reg,int byte); |
112 extern void code_assign_lvar(int e2,int reg,int byte); | |
111 | 113 extern void code_assign_register(int e2,int byte,int reg); |
118 | 114 extern void code_assign(int e2,int byte,int reg); |
221 | 115 extern void code_register_assop(int e2,int reg,int op,int byte); |
116 extern void code_assop(int op,int reg,int byte,int sign); | |
117 extern void tosop(int op,int reg,int oreg); | |
66 | 118 extern void code_opening(char *filename); |
119 extern void code_closing(); | |
438
626d705471d5
Unexecuted code in conditional. Lazy jmp code generation.
kono
parents:
430
diff
changeset
|
120 extern int rexpr(int e1, int l1, int cond,int t); |
61 | 121 extern void jmp(int l); |
187 | 122 extern int code_get_fixed_creg(int reg,int type); |
123 extern void code_set_fixed_creg(int reg,int mode,int type); | |
107 | 124 extern void code_set_return_register(int mode); |
66 | 125 extern void global_table(void); |
92 | 126 extern void code_label(int labelno); |
363 | 127 extern void code_label_value(int labelno,int reg); |
92 | 128 |
189 | 129 extern int code_const_op_p(int op,int v); |
221 | 130 extern void oprtc(int op,int reg,int v); |
189 | 131 |
340 | 132 extern void align(int t); |
516 | 133 extern void emit_global(NMTBL *n,int t,int e); |
340 | 134 extern void emit_space(int sp); |
135 extern void emit_char(int d); | |
136 extern void emit_short(int d); | |
137 extern void emit_int(int d); | |
138 extern void emit_longlong(int e); | |
139 extern void emit_double(int e); | |
140 extern void emit_float(int e); | |
367 | 141 extern void emit_address(char *s,int offset); |
340 | 142 extern void emit_label(int labelno); |
143 extern int emit_string_label(); | |
518 | 144 extern void emit_string(char *,int type); |
340 | 145 |
353 | 146 extern void code_i2c(int reg); |
147 extern void code_i2s(int reg); | |
148 extern void code_u2uc(int reg); | |
149 extern void code_u2us(int reg); | |
61 | 150 |
195 | 151 #if FLOAT_CODE |
81 | 152 /* floating point part */ |
153 | |
438
626d705471d5
Unexecuted code in conditional. Lazy jmp code generation.
kono
parents:
430
diff
changeset
|
154 extern int drexpr(int e1, int e2,int l1, int op,int cond); |
81 | 155 extern int dpop_register(); |
156 extern int emit_dpop(int); | |
138 | 157 extern void code_dregister(int e2,int reg,int d); |
287 | 158 extern void code_cmp_dregister(int,int,int,int); |
159 extern void code_cmp_drgvar(int,int,int,int,int); | |
160 extern void code_cmp_drlvar(int,int,int,int,int); | |
103 | 161 extern void code_dassign(int,int,int); |
162 extern void code_dassign_gvar(int,int,int); | |
163 extern void code_dassign_lvar(int,int,int); | |
138 | 164 extern void code_dassign_dregister(int e2,int d,int reg); |
165 extern void code_dconst(int,int,int); | |
166 extern void code_dneg(int,int); | |
107 | 167 extern void code_drgvar(int,int,int); |
168 extern void code_drlvar(int,int,int); | |
221 | 169 extern void dtosop(int,int,int); |
138 | 170 extern void emit_dpop_free(int,int); |
133 | 171 extern void emit_dpush(int); |
221 | 172 extern void code_i2d(); |
173 extern void code_d2i(); | |
174 extern void code_u2d(); | |
175 extern void code_d2u(); | |
176 extern void code_d2f(); | |
177 extern void code_f2d(); | |
178 extern void code_f2i(); | |
179 extern void code_f2u(); | |
180 extern void code_i2f(); | |
181 extern void code_u2f(); | |
133 | 182 |
81 | 183 |
107 | 184 extern void code_dpreinc(int e1,int e2,int d,int reg); |
185 extern void code_dpostinc(int e1,int e2,int d,int reg); | |
221 | 186 extern void code_dassop(int op,int reg,int d); |
219 | 187 extern void code_register_dassop(int reg,int op,int d); |
89 | 188 |
195 | 189 #endif |
190 | |
191 #if LONGLONG_CODE | |
192 /* 64bit int part */ | |
193 | |
438
626d705471d5
Unexecuted code in conditional. Lazy jmp code generation.
kono
parents:
430
diff
changeset
|
194 extern int lrexpr(int e1, int e2,int l1, int op,int cond); |
195 | 195 extern int lpop_register(); |
196 extern int emit_lpop(); | |
197 extern void code_lregister(int e2,int reg); | |
287 | 198 extern void code_cmp_lregister(int,int,int); |
199 extern void code_cmp_lrgvar(int,int,int,int); | |
200 extern void code_cmp_lrlvar(int,int,int,int); | |
195 | 201 extern void code_lassign(int,int); |
202 extern void code_lassign_gvar(int,int); | |
203 extern void code_lassign_lvar(int,int); | |
204 extern void code_lassign_lregister(int e2,int reg); | |
205 extern void code_lconst(int,int); | |
212 | 206 extern void code_lneg(int); |
195 | 207 extern void code_lrgvar(int,int); |
208 extern void code_lrlvar(int,int); | |
221 | 209 extern void ltosop(int,int,int); |
195 | 210 extern void emit_lpop_free(int); |
211 extern void emit_lpush(); | |
213 | 212 extern int code_lconst_op_p(int op,int e); |
221 | 213 extern void loprtc(int op,int reg, int e); |
239 | 214 extern void code_i2ll(int reg); |
215 extern void code_i2ull(int reg); | |
216 extern void code_u2ll(int reg); | |
217 extern void code_u2ull(int reg); | |
218 extern void code_ll2i(int reg); | |
219 extern void code_ll2u(int reg); | |
220 extern void code_ull2i(int reg); | |
221 extern void code_ull2u(int reg); | |
195 | 222 #if FLOAT_CODE |
239 | 223 extern void code_d2ll(int reg); |
224 extern void code_d2ull(int reg); | |
225 extern void code_f2ll(int reg); | |
226 extern void code_f2ull(int reg); | |
227 extern void code_ll2d(int reg); | |
228 extern void code_ll2f(int reg); | |
229 extern void code_ull2d(int reg); | |
230 extern void code_ull2f(int reg); | |
195 | 231 #endif |
232 | |
233 | |
234 | |
235 | |
236 extern void code_lpreinc(int e1,int e2,int reg); | |
237 extern void code_lpostinc(int e1,int e2,int reg); | |
221 | 238 extern void code_lassop(int op,int reg); |
219 | 239 extern void code_register_lassop(int reg,int op); |
195 | 240 |
241 #endif | |
242 | |
313 | 243 extern void code_alloca(int e,int reg); |
137 | 244 extern void code_arg_register(NMTBL *fnptr); |
89 | 245 |
430 | 246 extern int get_register(); |
247 extern int get_dregister(); | |
248 extern int get_lregister(); | |
89 | 249 extern void free_register(int i) ; |
250 extern int pop_register(void); | |
251 extern void emit_pop_free(int xreg); | |
308 | 252 extern void emit_data_closing(NMTBL *n); |
253 | |
89 | 254 |
221 | 255 // extern int use_int(int); |
256 // extern int use_float(int); | |
257 // extern int use_double(int); | |
258 // extern int use_longlong(int); | |
138 | 259 |
300 | 260 #if CASE_CODE |
382 | 261 extern int code_table_jump_p(int delta); |
302 | 262 extern void code_table_jump(int table,int csvalue,int delta,int max,int min,int dlabel); |
300 | 263 extern void code_table_open(int table); |
264 extern void code_table_value(int label,int table); | |
265 extern void code_table_close(); | |
266 #endif | |
267 | |
316 | 268 #if ASM_CODE |
320 | 269 |
327 | 270 extern void code_asm(char *asm_str,int repl); |
271 extern int code_asm_operand(char *p,int e1,int mode,int repl,int n,int repl0); | |
272 extern void code_free_asm_operand(int repl); | |
320 | 273 |
316 | 274 #endif |
275 | |
456 | 276 extern void code_comment(char *s); |
327 | 277 |
329 | 278 #if BIT_FIELD_CODE |
279 | |
280 /* bit field alignment calcuration */ | |
281 | |
331 | 282 extern int code_bit_field_disp(int type,int *offset,int *bfd,int *sz); |
329 | 283 |
284 /* bit field value */ | |
285 | |
286 /* reg contains address of bit_field, result should goto reg */ | |
426 | 287 extern void code_bit_field(int type,int adr,int reg); |
329 | 288 |
289 /* bit field replacement */ | |
290 | |
426 | 291 extern void code_bit_replace(int value,int lvalue,int type); |
329 | 292 /* register, register */ |
426 | 293 extern void code_bit_replace_const(int value,int lvalue,int type); |
365 | 294 /* exp, register */ |
329 | 295 |
296 #endif | |
297 | |
327 | 298 /* end */ |