Mercurial > hg > CbC > old > device
annotate mc-codegen.h @ 715:83e18db76c96
architecture depenedent argument alignment
author | kono |
---|---|
date | Wed, 14 Nov 2007 19:36:55 +0900 |
parents | 0554b7f985ee |
children | 21f770a3b298 |
rev | line source |
---|---|
144 | 1 /* for mc-codegen.c */ |
61 | 2 |
607 | 3 |
4 /************************************************************************ | |
5 ** Copyright (C) 2006 Shinji Kono | |
6 ** 連絡先: 琉球大学情報工学科 河野 真治 | |
7 ** (E-Mail Address: kono@ie.u-ryukyu.ac.jp) | |
8 ** | |
9 ** このソースのいかなる複写,改変,修正も許諾します。ただし、 | |
10 ** その際には、誰が貢献したを示すこの部分を残すこと。 | |
11 ** 再配布や雑誌の付録などの問い合わせも必要ありません。 | |
12 ** 営利利用も上記に反しない範囲で許可します。 | |
13 ** バイナリの配布の際にはversion messageを保存することを条件とします。 | |
14 ** このプログラムについては特に何の保証もしない、悪しからず。 | |
15 ** | |
16 ** Everyone is permitted to do anything on this program | |
17 ** including copying, modifying, improving, | |
18 ** as long as you don't try to pretend that you wrote it. | |
19 ** i.e., the above copyright notice has to appear in all copies. | |
20 ** Binary distribution requires original version messages. | |
21 ** You don't have to ask before copying, redistribution or publishing. | |
22 ** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. | |
23 ***********************************************************************/ | |
452 | 24 extern int use; /* generated value will be used in gexpr */ |
25 extern char *init_src; /* internal defenition string for each file */ | |
26 | |
27 /* these architecture dependent values are defined in mc-code-*.c */ | |
28 | |
715 | 29 extern int size_of_pointer; |
327 | 30 extern int size_of_int; |
31 extern int size_of_short; | |
32 extern int size_of_float; | |
33 extern int size_of_double; | |
34 extern int size_of_longlong; | |
35 extern int bit_of_byte; | |
36 extern int endian; | |
83 | 37 |
221 | 38 #define USE_CREG (-1) |
320 | 39 #define ASM_INPUT 1 |
40 #define ASM_OUTPUT 2 | |
41 #define ASM_USED 3 | |
42 #define MAX_ASM_REG 30 | |
61 | 43 |
327 | 44 /* used by mc-parse */ |
104 | 45 |
445 | 46 extern NMTBL * def(NMTBL *n,int ctmode); |
331 | 47 extern int arg_reorder(int arg,int new_arg); |
692 | 48 extern int assign_data(int e, int t, int v,int offset); |
331 | 49 extern int assign_expr(int e1,int e2,int t); |
50 extern int assign_expr0(int e1,int e2,int t,int type0); | |
51 extern int assop(int e1,int e2,int op,int t,int no_float); | |
52 extern int backdef(void); | |
53 extern int binop(int op, int e1, int e2, int t1, int t2); | |
705 | 54 extern int binop0(int op, int e1, int e2, int t1, int t2); // no inline |
331 | 55 extern int cexpr(int e); |
56 extern int cond(int t,int e1,int e2,int e3); | |
57 extern int correct_type(int e,int t); | |
682 | 58 extern int skip_cast(int e); |
331 | 59 extern int csvalue(); |
60 extern int function_type(int e1,int *dots); | |
61 extern int gexpr(int e1,int use0); | |
62 extern int indop(int e); | |
63 extern int integral(int t); | |
64 extern int new_lvar(int size); | |
648 | 65 extern int new_lvar0(int sz, int align); |
327 | 66 extern int rvalue(int e); |
67 extern int rvalue_t(int e,int t); | |
331 | 68 extern int search_struct_type(int type,char *name,int *dsp); |
69 extern int strop(int e,int ind); | |
137 | 70 extern void arg_register(NMTBL *fnptr); |
438
626d705471d5
Unexecuted code in conditional. Lazy jmp code generation.
kono
parents:
397
diff
changeset
|
71 extern int bexpr(int e1, char cond, int l1); |
552 | 72 extern void checkret(void); // check delayed jump, delayed last exp |
327 | 73 extern void closing(); |
74 extern void cmpdimm(int e, int csreg,int label,int cond); | |
331 | 75 extern void codegen_decl_init(); /* called before each declaration */ |
327 | 76 extern void codegen_init(); /* called only once */ |
77 extern void codegen_reinit(); /* called for each file */ | |
692 | 78 extern void data_closing(int v); |
648 | 79 extern void df_label(int cslabel, int dlabel); |
327 | 80 extern void emit_init_vars(void); |
331 | 81 extern void fcheck(NMTBL *n); |
327 | 82 extern void fdecl_struct(int fntype); |
83 extern void free_lvar(int disp); | |
456 | 84 extern void gen_comment(char *s); |
327 | 85 extern void gen_code_enter(char *name); |
86 extern void gen_code_enter1(int args); | |
87 extern void gen_code_leave(char *name); | |
88 extern void gen_enter(char *name); | |
89 extern void gen_enter1(); | |
331 | 90 extern void gen_jmp(int l); |
363 | 91 extern void gen_indirect_goto(int e1); |
327 | 92 extern void gen_leave(int control, char *name); |
331 | 93 extern void init_free_lvar_list(); |
94 extern void lcheck(int e); | |
95 extern void opening(char *filename); | |
96 extern void parallel_rassign(int assigns); | |
97 extern void replace_return_struct(int func,int left); | |
327 | 98 extern void ret(void); |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
99 extern void gen_ret(void); |
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
100 extern void gen_label_call(int l); |
692 | 101 extern void flush_delayed_decl_data(int v); |
696 | 102 extern void jump(int e,int env); |
715 | 103 extern int arg_alignment(int disp0,NMTBL *n,int type0,int sz); |
327 | 104 |
681 | 105 |
552 | 106 /* used by mc-inline */ |
107 | |
108 extern void checkjmp(int l); // generate delayed jump, l = current label | |
557 | 109 extern int reference(int e1); // recover lvalue from rvalue of memory or register |
110 extern int type_of_bop(int op); | |
111 extern int type_of_conv(int op); | |
681 | 112 extern int type_compatible(int t1, int t2); |
701 | 113 extern int gen_decl_data(int e,int v); |
552 | 114 |
115 /* used by mc-code-* */ | |
327 | 116 |
117 extern int assign_expr0(int e1,int e2,int t,int type0) ; | |
438
626d705471d5
Unexecuted code in conditional. Lazy jmp code generation.
kono
parents:
397
diff
changeset
|
118 extern int b_expr(int e1, char cond, int l1,int err); |
327 | 119 extern int contains_p(int e,int (*p)(int)); |
449 | 120 extern int contains_p1(int arg,int e,int (*p)(int,int)); |
609 | 121 extern int contains_p2(int arg,int e,int (*p)(int,int)); |
61 | 122 extern void fwddef(int l); |
327 | 123 extern int fwdlabel(void); |
124 extern int g_expr(int e1); | |
125 extern int g_expr0(int e1); | |
126 extern int g_expr_u(int e1); | |
456 | 127 extern int is_const(int e); |
463 | 128 extern int is_memory(int e); |
547 | 129 extern int is_local_memory(int e1); |
98 | 130 extern int is_code(NMTBL *fnptr); |
131 extern int is_function(NMTBL *fnptr); | |
453 | 132 extern int is_inline(NMTBL *fnptr); |
327 | 133 extern int scalar(int t); |
336 | 134 extern int make_mask(int from,int to); |
135 | |
341 | 136 extern void init_ptr_cache(); |
137 extern void clear_ptr_cache_reg(int r); | |
138 extern int last_ptr_cache(); | |
139 extern void clear_ptr_cache() ; | |
140 extern int get_ptr_cache(NMTBL *nptr); | |
61 | 141 |
715 | 142 // standard 32bit alignment |
143 extern int code_arg_alignment0(int disp0,NMTBL *n,int type0,int sz); | |
144 extern int code_lvar_alignment0(int disp0,NMTBL *n,int type0,int sz); | |
145 | |
366 | 146 extern int ilog(int i); |
147 | |
648 | 148 extern char * nm(NMTBL *n) ; |
149 extern int new_lvar_align(int size,int align); | |
150 | |
596 | 151 /* used by mc-tree */ |
152 | |
153 extern NMTBL str_ret; | |
154 | |
609 | 155 /* used by conv */ |
156 extern int rop_dual(int op); | |
157 extern int copy_expr(int e); | |
158 | |
648 | 159 |
160 | |
61 | 161 /* end */ |