Mercurial > hg > CbC > old > device
comparison mc-code-powerpc.c @ 415:bdf900926f32
fix cpmd register
author | kono |
---|---|
date | Sat, 23 Oct 2004 23:26:33 +0900 |
parents | 32c1914308db |
children | a6ed0575d731 |
comparison
equal
deleted
inserted
replaced
414:0a4416b34d4a | 415:bdf900926f32 |
---|---|
1021 | 1021 |
1022 free_all_register(); | 1022 free_all_register(); |
1023 max_reg_var=-1; max_freg_var=-1; | 1023 max_reg_var=-1; max_freg_var=-1; |
1024 reg_sp = 0; | 1024 reg_sp = 0; |
1025 freg_sp = 0; | 1025 freg_sp = 0; |
1026 text_mode(); | |
1027 } | 1026 } |
1028 | 1027 |
1029 | 1028 |
1030 int | 1029 int |
1031 get_register_var(NMTBL *n) | 1030 get_register_var(NMTBL *n) |
2637 } | 2636 } |
2638 | 2637 |
2639 void | 2638 void |
2640 code_cmpdimm(int e, int csreg,int label,int cond) | 2639 code_cmpdimm(int e, int csreg,int label,int cond) |
2641 { | 2640 { |
2642 int reg; | 2641 int reg,regsv; |
2643 /* used in dosiwtch() */ | 2642 /* used in dosiwtch() */ |
2644 if(chk) return; | 2643 if(chk) return; |
2645 inc_cmpflag(); | 2644 inc_cmpflag(); |
2646 if (-32767<e&&e<32767) { | 2645 if (-32767<e&&e<32767) { |
2647 printf("\tcmpwi cr%d,%s,%d\n",cmpflag,register_name(csreg),e); | 2646 printf("\tcmpwi cr%d,%s,%d\n",cmpflag,register_name(csreg),e); |
2648 jcond(label,cond); | 2647 jcond(label,cond); |
2649 } else { | 2648 } else { |
2649 regsv = regs[csreg]; regs[csreg]=USING_REG; | |
2650 reg = get_register(); | 2650 reg = get_register(); |
2651 regs[csreg]= regsv; | |
2651 code_const(e,reg); | 2652 code_const(e,reg); |
2652 printf("\tcmpw cr%d,%s,%s\n",cmpflag,register_name(csreg),register_name(reg)); | 2653 printf("\tcmpw cr%d,%s,%s\n",cmpflag,register_name(csreg),register_name(reg)); |
2653 jcond(label,cond); | 2654 jcond(label,cond); |
2654 free_register(reg); | 2655 free_register(reg); |
2655 } | 2656 } |
2982 printf("L_%d:\n",lb); | 2983 printf("L_%d:\n",lb); |
2983 output_mode = RODATA_EMIT_MODE; | 2984 output_mode = RODATA_EMIT_MODE; |
2984 return lb; | 2985 return lb; |
2985 } | 2986 } |
2986 | 2987 |
2987 extern void | 2988 void |
2988 align(int t) | 2989 align(int t) |
2989 { | 2990 { |
2990 if (t!=CHAR) { | 2991 int d; |
2991 if (data_alignment & 1) | 2992 switch(t) { |
2992 printf("\t.align 2\n"); | 2993 case CHAR: case UCHAR: return; |
2993 data_alignment = 0; | 2994 case SHORT: case USHORT: d = data_alignment & 1; break; |
2995 default: d = data_alignment & 3; | |
2996 } | |
2997 if (d) { | |
2998 printf("\t.align 2\n"); | |
2999 data_alignment = 0; | |
2994 } | 3000 } |
2995 } | 3001 } |
2996 | 3002 |
2997 extern void | 3003 extern void |
2998 emit_global(char *name,int t) | 3004 emit_global(char *name,int t) |