comparison mc-codegen.c @ 484:f84d4525ffc8

lvar alignment
author kono
date Mon, 12 Dec 2005 12:40:48 +0900
parents 77cab9687d3f
children b4d9809d6ee2
comparison
equal deleted inserted replaced
483:77cab9687d3f 484:f84d4525ffc8
16 int size_of_float; 16 int size_of_float;
17 int size_of_double; 17 int size_of_double;
18 int size_of_longlong; 18 int size_of_longlong;
19 int bit_of_byte; 19 int bit_of_byte;
20 int endian; 20 int endian;
21 int disp_align;
22 21
23 static void assign(int e1); 22 static void assign(int e1);
24 #if ASM_CODE 23 #if ASM_CODE
25 static void gen_asm(int asm0,int in,int out,int opt,int e); 24 static void gen_asm(int asm0,int in,int out,int opt,int e);
26 #endif 25 #endif
2823 #endif 2822 #endif
2824 } else error(DCERR); 2823 } else error(DCERR);
2825 nsc = car(ndsp); 2824 nsc = car(ndsp);
2826 ndsp = cadr(ndsp); 2825 ndsp = cadr(ndsp);
2827 } else { 2826 } else {
2828 if (sz%size_of_int==0) { 2827 /* local variable alignment is done by new_lvar */
2829 disp = ((disp+(size_of_int-1))&~(size_of_int-1));
2830 }
2831 nsc = LVAR; 2828 nsc = LVAR;
2832 ndsp = new_lvar(sz); 2829 ndsp = new_lvar(sz);
2833 } 2830 }
2834 n->sc = nsc; 2831 n->sc = nsc;
2835 n->dsp = ndsp; 2832 n->dsp = ndsp;
3969 static int lvar_list,lvar_free_list; 3966 static int lvar_list,lvar_free_list;
3970 3967
3971 extern int 3968 extern int
3972 new_lvar0(int sz) 3969 new_lvar0(int sz)
3973 { 3970 {
3974 switch (disp_align) { 3971 disp-=sz;
3975 default: 3972 #if 1
3976 case 0: return disp-=sz; 3973 if (sz>=4 && (disp & (4-1))) {
3977 case 4: 3974 disp &= ~(4-1);
3978 disp-=sz; 3975 }
3979 if (sz>=4) disp &= -4; 3976 #endif
3980 return disp; 3977 return disp;
3981 }
3982 } 3978 }
3983 3979
3984 extern int 3980 extern int
3985 new_lvar(int size) 3981 new_lvar(int size)
3986 { 3982 {