Mercurial > hg > CbC > old > device
comparison mc-code-powerpc.c @ 227:ed92cef127f1
*** empty log message ***
author | kono |
---|---|
date | Tue, 27 Apr 2004 18:32:28 +0900 |
parents | a31e1d24c097 |
children | 21b311266011 |
comparison
equal
deleted
inserted
replaced
226:a31e1d24c097 | 227:ed92cef127f1 |
---|---|
694 { | 694 { |
695 int ll; | 695 int ll; |
696 ll = get_lregister0(); | 696 ll = get_lregister0(); |
697 if (i!=-1) { | 697 if (i!=-1) { |
698 if (is_code) { | 698 if (is_code) { |
699 if(!(i+1<REG_VAR_BASE-REG_VAR_MIN)) return 0; | 699 if(!(i<REG_VAR_BASE-REG_VAR_MIN)) return 0; |
700 i = REG_VAR_BASE-i; | 700 i = REG_VAR_BASE-i; |
701 } else { | 701 } else { |
702 if (i<0||i+1>=MAX_INPUT_REGISTER_VAR) return 0; | 702 if (i<0||i>=MAX_INPUT_REGISTER_VAR) return 0; |
703 i = i+MIN_TMP_REG; | 703 i = i+MIN_TMP_REG; |
704 } | 704 } |
705 regv_h(ll)=i; | 705 regv_h(ll)=i; |
706 regv_l(ll)=i+1; | 706 regv_l(ll)=i+1; |
707 } else { error(-1); ll=LREG_OFFSET+2; } | 707 } else { error(-1); ll=LREG_OFFSET+2; } |
1689 reg_arg_list = list2(arg,reg_arg_list); | 1689 reg_arg_list = list2(arg,reg_arg_list); |
1690 g_expr_u(assign_expr0(arg,e4,t,t)); | 1690 g_expr_u(assign_expr0(arg,e4,t,t)); |
1691 nargs ++ ; reg_arg++; | 1691 nargs ++ ; reg_arg++; |
1692 continue; | 1692 continue; |
1693 } else if (t==LONGLONG||t==ULONGLONG) { | 1693 } else if (t==LONGLONG||t==ULONGLONG) { |
1694 if (reg_arg+1>=MAX_INPUT_REGISTER_VAR) { | 1694 if (reg_arg>=MAX_INPUT_REGISTER_VAR) { |
1695 arg = list2(LVAR,caller_arg_offset_v(nargs)); | 1695 arg = list2(LVAR,caller_arg_offset_v(nargs)); |
1696 } else if (reg_arg+1>=MAX_INPUT_REGISTER_VAR) { | |
1697 // half register, half memory case | |
1698 // put whole long long anyway | |
1699 arg = list2(LVAR,caller_arg_offset_v(nargs)); | |
1700 arg_assign = list2( | |
1701 assign_expr0(get_input_register_var(reg_arg,0,0), | |
1702 arg,INT,INT), | |
1703 arg_assign); | |
1696 } else if (!simple_args(e3) && cadr(e3)) { | 1704 } else if (!simple_args(e3) && cadr(e3)) { |
1697 arg = get_lregister_var(0); | 1705 arg = get_lregister_var(0); |
1698 arg_assign = list2( | 1706 arg_assign = list2( |
1699 assign_expr0(get_input_lregister_var(reg_arg,0,0), | 1707 assign_expr0(get_input_lregister_var(reg_arg,0,0), |
1700 arg,t,t), | 1708 arg,t,t), |
3184 { | 3192 { |
3185 g_expr(list3(((op==DOP+GE)?DCMPGE:DCMP),e1,e2)); | 3193 g_expr(list3(((op==DOP+GE)?DCMPGE:DCMP),e1,e2)); |
3186 switch(op) { | 3194 switch(op) { |
3187 case DOP+GE: | 3195 case DOP+GE: |
3188 case FOP+GE: | 3196 case FOP+GE: |
3189 printf("\tcror 2,29,30\n"); | 3197 printf("\tcrnor 30,29,30\n"); |
3190 printf("\tbne\tcr0,L_%d\n",l1); | 3198 printf("\tbeq\tcr0,L_%d\n",l1); |
3191 break; | 3199 break; |
3192 case DOP+GT: | 3200 case DOP+GT: |
3193 case FOP+GT: | 3201 case FOP+GT: |
3194 printf("\tble\tcr0,L_%d\n",l1); | 3202 printf("\tble\tcr0,L_%d\n",l1); |
3195 break; | 3203 break; |
3241 | 3249 |
3242 /* 64bit int part */ | 3250 /* 64bit int part */ |
3243 static void | 3251 static void |
3244 lmove(int to,int from) | 3252 lmove(int to,int from) |
3245 { | 3253 { |
3246 if (regv_h(to)==regv_l(from)) { | 3254 int tmp; |
3255 if (regv_h(to)==regv_l(from)&&(regv_l(to)==regv_h(from))) { | |
3256 tmp = get_register(); | |
3257 printf("\tmr %s,%s\n",lregister_name_low(tmp),lregister_name_low(from)); | |
3258 printf("\tmr %s,%s\n",lregister_name_high(to),lregister_name_high(from)); | |
3259 printf("\tmr %s,%s\n",lregister_name_low(to),register_name(tmp)); | |
3260 free_register(tmp); | |
3261 } else if (regv_h(to)==regv_l(from)) { | |
3247 printf("\tmr %s,%s\n",lregister_name_low(to),lregister_name_low(from)); | 3262 printf("\tmr %s,%s\n",lregister_name_low(to),lregister_name_low(from)); |
3248 printf("\tmr %s,%s\n",lregister_name_high(to),lregister_name_high(from)); | 3263 printf("\tmr %s,%s\n",lregister_name_high(to),lregister_name_high(from)); |
3249 } else { | 3264 } else { |
3250 printf("\tmr %s,%s\n",lregister_name_high(to),lregister_name_high(from)); | 3265 printf("\tmr %s,%s\n",lregister_name_high(to),lregister_name_high(from)); |
3251 printf("\tmr %s,%s\n",lregister_name_low(to),lregister_name_low(from)); | 3266 printf("\tmr %s,%s\n",lregister_name_low(to),lregister_name_low(from)); |