Mercurial > hg > CbC > old > device
comparison mc-code-ia32.c @ 716:21f770a3b298
*** empty log message ***
author | kono |
---|---|
date | Fri, 16 Nov 2007 21:46:20 +0900 |
parents | 83e18db76c96 |
children | c1542a2482b1 |
comparison
equal
deleted
inserted
replaced
715:83e18db76c96 | 716:21f770a3b298 |
---|---|
402 #if LONGLONG_CODE | 402 #if LONGLONG_CODE |
403 static int code_l1(long long d); | 403 static int code_l1(long long d); |
404 static int code_l2(long long d); | 404 static int code_l2(long long d); |
405 #endif | 405 #endif |
406 | 406 |
407 #define round16(i) ((i+0xf)&~0xf) | 407 #define round16(i) align(i,16) |
408 #define round4(i) ((i+0x3)&~0x3) | 408 #define round4(i) align(i,4) |
409 | 409 |
410 | 410 |
411 #define func_disp_offset (16) | 411 #define func_disp_offset (16) |
412 #define code_disp_offset (16) | 412 #define code_disp_offset (16) |
413 | 413 |
670 size_of_short = SIZE_OF_SHORT; | 670 size_of_short = SIZE_OF_SHORT; |
671 size_of_float = SIZE_OF_FLOAT; | 671 size_of_float = SIZE_OF_FLOAT; |
672 size_of_double = SIZE_OF_DOUBLE; | 672 size_of_double = SIZE_OF_DOUBLE; |
673 size_of_longlong = SIZE_OF_LONGLONG; | 673 size_of_longlong = SIZE_OF_LONGLONG; |
674 endian = ENDIAN; | 674 endian = ENDIAN; |
675 struct_align = 16; | |
675 | 676 |
676 | 677 |
677 // MAX_REGISTER=6; | 678 // MAX_REGISTER=6; |
678 MAX_DATA_REG=4; | 679 MAX_DATA_REG=4; |
679 MAX_POINTER=3; | 680 MAX_POINTER=3; |
1956 for(;arg_assign;arg_assign=cadr(arg_assign)) { | 1957 for(;arg_assign;arg_assign=cadr(arg_assign)) { |
1957 g_expr_u(car(arg_assign)); | 1958 g_expr_u(car(arg_assign)); |
1958 } | 1959 } |
1959 clear_ptr_cache(); | 1960 clear_ptr_cache(); |
1960 code_call(e2,fn,jmp); | 1961 code_call(e2,fn,jmp); |
1961 for(;reg_arg_list;reg_arg_list=cadr(reg_arg_list)) { | 1962 free_register_var(reg_arg_list); |
1962 arg = car(reg_arg_list); | |
1963 if (car(arg)==REGISTER||car(arg)==DREGISTER||car(arg)==FREGISTER | |
1964 ||car(arg)==LREGISTER) | |
1965 free_register(cadr(arg)); | |
1966 else if (car(arg)==LVAR&&cadr(arg)<0) free_lvar(cadr(arg)); | |
1967 } | |
1968 if (ret_type==DOUBLE||ret_type==FLOAT) { | 1963 if (ret_type==DOUBLE||ret_type==FLOAT) { |
1969 } else if (ret_type==LONGLONG||ret_type==ULONGLONG) { | 1964 } else if (ret_type==LONGLONG||ret_type==ULONGLONG) { |
1970 use_longlong0(USE_CREG); | 1965 use_longlong0(USE_CREG); |
1971 } else if (ret_type==VOID) { | 1966 } else if (ret_type==VOID) { |
1972 } else { | 1967 } else { |
2711 } | 2706 } |
2712 return; | 2707 return; |
2713 } | 2708 } |
2714 | 2709 |
2715 void | 2710 void |
2716 align(int t) | 2711 code_align(int t) |
2717 { | 2712 { |
2718 int d; | 2713 int d; |
2719 switch(t) { | 2714 switch(t) { |
2720 case CHAR: case UCHAR: return; | 2715 case CHAR: case UCHAR: return; |
2721 case SHORT: case USHORT: d = data_alignment & 1; break; | 2716 case SHORT: case USHORT: d = data_alignment & 1; break; |
2734 if (e>0 && car(e)==STRING && t>0 && car(t)==ARRAY && | 2729 if (e>0 && car(e)==STRING && t>0 && car(t)==ARRAY && |
2735 (type_value(cadr(t))==CHAR||type_value(cadr(t))==UCHAR)) { | 2730 (type_value(cadr(t))==CHAR||type_value(cadr(t))==UCHAR)) { |
2736 cstring_mode(); | 2731 cstring_mode(); |
2737 } else | 2732 } else |
2738 data_mode(n->nm); | 2733 data_mode(n->nm); |
2739 align(a); | 2734 code_align(a); |
2740 #ifdef __APPLE__ | 2735 #ifdef __APPLE__ |
2741 if (n && n->sc!=STATIC) | 2736 if (n && n->sc!=STATIC) |
2742 printf(".globl\t_%s\n",n->nm); | 2737 printf(".globl\t_%s\n",n->nm); |
2743 printf("_%s:\n",n->nm); | 2738 printf("_%s:\n",n->nm); |
2744 #else | 2739 #else |