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