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