Mercurial > hg > CbC > old > device
comparison mc-code-powerpc.c @ 569:1fcad06b264a
gcc4 (ia32)
author | kono |
---|---|
date | Thu, 12 Jan 2006 01:54:14 +0900 |
parents | d6ff45d719a5 |
children | 388baa7d4bee |
comparison
equal
deleted
inserted
replaced
568:559eb65d1289 | 569:1fcad06b264a |
---|---|
1456 | 1456 |
1457 #define code_uge(cond) (cond?"ge":"lt") | 1457 #define code_uge(cond) (cond?"ge":"lt") |
1458 | 1458 |
1459 #define code_eq(cond) (cond?"eq":"ne") | 1459 #define code_eq(cond) (cond?"eq":"ne") |
1460 | 1460 |
1461 static int cmpflag = 0; | 1461 static int cmpflag = 7; |
1462 | 1462 |
1463 static void | 1463 static void |
1464 inc_cmpflag() | 1464 inc_cmpflag() |
1465 { | 1465 { |
1466 cmpflag = (cmpflag+1)%8; | 1466 // gcc use cmpflag 4 and 7, and gcc4 believes flag 4 is preserved. |
1467 // cmpflag = (cmpflag+1)%8; | |
1467 } | 1468 } |
1468 | 1469 |
1469 void | 1470 void |
1470 code_cmp_crgvar(int e1,int reg,int sz,int label,int cond) { | 1471 code_cmp_crgvar(int e1,int reg,int sz,int label,int cond) { |
1471 use_int(reg); | 1472 use_int(reg); |
2005 int reg_arg_list=0,ret_type,special_lvar; | 2006 int reg_arg_list=0,ret_type,special_lvar; |
2006 NMTBL *fn = 0; | 2007 NMTBL *fn = 0; |
2007 int jmp = 0; | 2008 int jmp = 0; |
2008 char *jrn; | 2009 char *jrn; |
2009 int complex_; | 2010 int complex_; |
2010 int pnargs,preg_arg,pfreg_arg; | 2011 int pnargs=0,preg_arg=0,pfreg_arg=0; |
2011 int stargs; | 2012 int stargs; |
2012 | 2013 |
2013 special_lvar = -1; | 2014 special_lvar = -1; |
2014 ret_type = function_type(cadddr(e1),&dots); | 2015 ret_type = function_type(cadddr(e1),&dots); |
2015 if (caddr(cadddr(e1))==0) dots=1; | 2016 if (caddr(cadddr(e1))==0) dots=1; |
2710 } | 2711 } |
2711 | 2712 |
2712 int | 2713 int |
2713 rexpr(int e1, int l1, int cond,int t) | 2714 rexpr(int e1, int l1, int cond,int t) |
2714 { | 2715 { |
2715 char *s; | 2716 char *s=0; |
2716 switch(car(e1)+BNOT*(!cond)) { | 2717 switch(car(e1)+BNOT*(!cond)) { |
2717 case GT: s=code_gt(1); break; | 2718 case GT: s=code_gt(1); break; |
2718 case UGT: s=code_ugt(1); break; | 2719 case UGT: s=code_ugt(1); break; |
2719 case GE: s=code_ge(1); break; | 2720 case GE: s=code_ge(1); break; |
2720 case UGE: s=code_uge(1); break; | 2721 case UGE: s=code_uge(1); break; |
4653 loprtc(int op,int creg,int e) | 4654 loprtc(int op,int creg,int e) |
4654 { | 4655 { |
4655 char *crn_h; | 4656 char *crn_h; |
4656 char *crn_l; | 4657 char *crn_l; |
4657 char *grn; | 4658 char *grn; |
4658 int v; | 4659 int v=0; |
4659 int greg; | 4660 int greg; |
4660 | 4661 |
4661 use_longlong(creg); | 4662 use_longlong(creg); |
4662 crn_h = lregister_name_high(creg); | 4663 crn_h = lregister_name_high(creg); |
4663 crn_l = lregister_name_low(creg); | 4664 crn_l = lregister_name_low(creg); |
5356 | 5357 |
5357 static void | 5358 static void |
5358 set_bitsz(int type,int *pbitpos,int *pbitsize, | 5359 set_bitsz(int type,int *pbitpos,int *pbitsize, |
5359 int *psign,int *pbitsz,int *palign,int *pl) | 5360 int *psign,int *pbitsz,int *palign,int *pl) |
5360 { | 5361 { |
5361 int sign=0,bitsz; | 5362 int sign=0,bitsz=0; |
5362 int align,l=0; | 5363 int align=4,l=0; |
5363 *pbitpos = cadr(caddr(type)); | 5364 *pbitpos = cadr(caddr(type)); |
5364 *pbitsize = caddr(caddr(type)); | 5365 *pbitsize = caddr(caddr(type)); |
5365 switch(cadr(type)) { /* value type */ | 5366 switch(cadr(type)) { /* value type */ |
5366 case INT: sign=1; bitsz=32; align=4;break; | 5367 case INT: sign=1; bitsz=32; align=4;break; |
5367 case UNSIGNED: bitsz=32; align=4;break; | 5368 case UNSIGNED: bitsz=32; align=4;break; |
5394 int bitsize; | 5395 int bitsize; |
5395 int offset = *poffset; | 5396 int offset = *poffset; |
5396 int l; | 5397 int l; |
5397 set_bitsz(type,&bitpos0,&bitsize,&sign,&bitsz,&align,&l); | 5398 set_bitsz(type,&bitpos0,&bitsize,&sign,&bitsz,&align,&l); |
5398 | 5399 |
5399 if (bitsize>bitsz) { error(BTERR); bitsize = i; } | 5400 if (bitsize>bitsz) { error(BTERR); bitsize = bitsz; } |
5400 | 5401 |
5401 /* bfd means previous bit field bit offset */ | 5402 /* bfd means previous bit field bit offset */ |
5402 if (bitpos) { | 5403 if (bitpos) { |
5403 /* previous field is bit field and spaces may remain */ | 5404 /* previous field is bit field and spaces may remain */ |
5404 /* calc previsous offset */ | 5405 /* calc previsous offset */ |