Mercurial > hg > CbC > old > device
comparison mc-code-powerpc.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 |
---|---|
303 "20","21","22","23","24","25","26","27","28","29", | 303 "20","21","22","23","24","25","26","27","28","29", |
304 "30","31" | 304 "30","31" |
305 }; | 305 }; |
306 #endif | 306 #endif |
307 | 307 |
308 #define round4(i) ((i+(SIZE_OF_INT-1))&~(SIZE_OF_INT-1)) | 308 #define round4(i) align(i,4) |
309 #define round16(i) align(i,16) | |
309 | 310 |
310 #define register_name(i) reg_name[i] | 311 #define register_name(i) reg_name[i] |
311 #define fregister_name(i) reg_name[i] | 312 #define fregister_name(i) reg_name[i] |
312 #define lregister_name_low(i) reg_name[regv_l(i)] | 313 #define lregister_name_low(i) reg_name[regv_l(i)] |
313 #define lregister_name_high(i) reg_name[regv_h(i)] | 314 #define lregister_name_high(i) reg_name[regv_h(i)] |
507 #else | 508 #else |
508 #define CALLEE_ARG(l) ((l)+arg_offset+((l>=arg_offset_v)?arg_offset0:0)) | 509 #define CALLEE_ARG(l) ((l)+arg_offset+((l>=arg_offset_v)?arg_offset0:0)) |
509 #endif | 510 #endif |
510 #define CALLER_ARG(l) ((l)+arg_offset1) | 511 #define CALLER_ARG(l) ((l)+arg_offset1) |
511 | 512 |
512 #define round16(a) ((a+0xf)&~0xf) | |
513 | 513 |
514 void | 514 void |
515 code_offset_set() | 515 code_offset_set() |
516 { | 516 { |
517 #if 0 | 517 #if 0 |
740 size_of_short = SIZE_OF_SHORT; | 740 size_of_short = SIZE_OF_SHORT; |
741 size_of_float = SIZE_OF_FLOAT; | 741 size_of_float = SIZE_OF_FLOAT; |
742 size_of_double = SIZE_OF_DOUBLE; | 742 size_of_double = SIZE_OF_DOUBLE; |
743 size_of_longlong = SIZE_OF_LONGLONG; | 743 size_of_longlong = SIZE_OF_LONGLONG; |
744 endian = ENDIAN; | 744 endian = ENDIAN; |
745 struct_align = 16; | |
745 | 746 |
746 regv_l(RET_LREGISTER) = RET_LREGISTER_L; | 747 regv_l(RET_LREGISTER) = RET_LREGISTER_L; |
747 regv_h(RET_LREGISTER) = RET_LREGISTER_H; | 748 regv_h(RET_LREGISTER) = RET_LREGISTER_H; |
748 } | 749 } |
749 | 750 |
2682 } else { | 2683 } else { |
2683 jrn = register_name(cadr(jmp)); | 2684 jrn = register_name(cadr(jmp)); |
2684 printf("\tmtctr %s\n",jrn); | 2685 printf("\tmtctr %s\n",jrn); |
2685 printf("\tbctrl\n"); | 2686 printf("\tbctrl\n"); |
2686 } | 2687 } |
2687 for(;reg_arg_list;reg_arg_list=cadr(reg_arg_list)) { | 2688 free_register_var(reg_arg_list); |
2688 arg = car(reg_arg_list); | |
2689 if (car(arg)==REGISTER||car(arg)==DREGISTER||car(arg)==FREGISTER | |
2690 ||car(arg)==LREGISTER) { | |
2691 // if (car(arg)==LREGISTER) | |
2692 // printf("## lreg freeing %d %s %s\n",cadr(arg), lregister_name_high(cadr(arg)), lregister_name_low(cadr(arg))); | |
2693 free_register(cadr(arg)); | |
2694 } else if (car(arg)==LVAR&&cadr(arg)<0) free_lvar(cadr(arg)); | |
2695 } | |
2696 if (ret_type==DOUBLE||ret_type==FLOAT) { | 2689 if (ret_type==DOUBLE||ret_type==FLOAT) { |
2697 set_freg(RET_FREGISTER,0); | 2690 set_freg(RET_FREGISTER,0); |
2698 } else if (ret_type==ULONGLONG||ret_type==LONGLONG) { | 2691 } else if (ret_type==ULONGLONG||ret_type==LONGLONG) { |
2699 set_lreg(RET_LREGISTER,0); | 2692 set_lreg(RET_LREGISTER,0); |
2700 use_reg(RET_LREGISTER); | 2693 use_reg(RET_LREGISTER); |
3744 } | 3737 } |
3745 return; | 3738 return; |
3746 } | 3739 } |
3747 | 3740 |
3748 void | 3741 void |
3749 align(int t) | 3742 code_align(int t) |
3750 { | 3743 { |
3751 int d; | 3744 int d; |
3752 switch(t) { | 3745 switch(t) { |
3753 case CHAR: case UCHAR: return; | 3746 case CHAR: case UCHAR: return; |
3754 case SHORT: case USHORT: d = data_alignment & 1; break; | 3747 case SHORT: case USHORT: d = data_alignment & 1; break; |