Mercurial > hg > CbC > old > device
diff mc-code-powerpc.c @ 527:6b0fd56848e6 inline-asm
inline continue....
asm, lvar free
author | kono |
---|---|
date | Wed, 28 Dec 2005 21:21:57 +0900 |
parents | 9ff5cd7afe2f |
children | d6fff671793a |
line wrap: on
line diff
--- a/mc-code-powerpc.c Wed Dec 28 15:45:39 2005 +0900 +++ b/mc-code-powerpc.c Wed Dec 28 21:21:57 2005 +0900 @@ -1242,7 +1242,7 @@ char *crn; use_int(reg); crn = register_name(reg); - // printf("# 0x%08x\n",e2); + // printf("## 0x%08x\n",e2); if (-32768<e2&&e2<32768) printf("\tli %s,%d\n",crn,e2); else { @@ -5164,18 +5164,26 @@ int val; int clobber = 0; - printf("# constraint %s\n",p); - if (*p=='=') { + printf("## constraint %s\n",p); +retry: + switch((c=*p)) { + case '?': + case '!': + case '+': + case '%': + case '#': + case '*': + case '=': // output register p++; - } - if (*p=='&') { + goto retry; + case '&': // earlyclobber p++; clobber = 1; - } - c = *p; - if (c=='r') { + goto retry; + case 'b': // address base register (what?) + case 'r': if (mode==ASM_INPUT) { for(;repl0;repl0 = cadr(repl0)) { if (car(car(repl0))==REGISTER && caddr(repl0)==0) { @@ -5189,9 +5197,11 @@ r = get_register(); } repl = list3(list2(REGISTER,r),repl,clobber); - } else if (c=='m') { + break; + case 'm': repl = list3(list2(0,0),repl,clobber); - } else if (c=='i') { + break; + case 'i': if (car(e1)==GVAR) { e1=list3(FNAME,(int)(((NMTBL *)caddr(e1))->nm),0); } else if (car(e1)==FNAME) { @@ -5203,13 +5213,18 @@ } else if (car(e1)==CONST) { } else error(-1); repl = list3(e1,repl,clobber); - } else if (digit(c)) { + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': val = 0; do { val = val*10 + c-'0'; } while (digit(c=*p++)); if (val>MAX_ASM_REG) error(-1); // too large register if (n-val<0) error(-1); repl = list3(car(nth(n-val-1,repl0)),repl,clobber); - } else error(-1); + break; + default: + printf("### unknown asm constraint %c\n",c); + } return repl; } @@ -5325,7 +5340,7 @@ i = l+bitsize; *bfd = (i==bitsz)?0:i; *sz = (i+7)/8; -// printf("# bitpos=%d bitsize=%d bitsz=%d offset=%d\n",l,bitsize,bitsz,*poffset); +// printf("## bitpos=%d bitsize=%d bitsz=%d offset=%d\n",l,bitsize,bitsz,*poffset); return l; } } @@ -5340,7 +5355,7 @@ *bfd = (bitsize==bitsz)?0:bitsize; *sz = (bitsize+7)/8; -// printf("# bitpos=%d bitsize=%d bitsz=%d offset=%d\n",bitpos,bitsize,bitsz,*poffset); +// printf("## bitpos=%d bitsize=%d bitsz=%d offset=%d\n",bitpos,bitsize,bitsz,*poffset); return bitpos; } @@ -5354,7 +5369,7 @@ int i,size; set_bitsz(type,&bitpos,&bitsize,&sign,&bitsz,&align,&l); size = bitsz/8; -// printf("# %d: bitpos=%d bitsize=%d bitsz=%d\n",lineno,bitpos,bitsize,bitsz); +// printf("## %d: bitpos=%d bitsize=%d bitsz=%d\n",lineno,bitpos,bitsize,bitsz); /* this implementation returns -1 for int i:1; */ if (l==1) { #if LONGLONG_CODE @@ -5388,7 +5403,7 @@ static void make_mask_and_or(int mask,int tmp,char *trn,char *crn,char *lrn) { -// printf("# mask 0x%08x ~0x%08x\n",mask,~mask); +// printf("## mask 0x%08x ~0x%08x\n",mask,~mask); code_const(~mask,tmp); printf("\tor %s,%s,%s\n",trn,crn,trn); /* do conjunction */ @@ -5472,7 +5487,7 @@ { char *trn; int tmp = -1; -// printf("# mask 0x%08x ~0x%08x\n",mask,~mask); +// printf("## mask 0x%08x ~0x%08x\n",mask,~mask); if ((~mask|c)!=-1) { trn = register_name(tmp=get_register()); code_const((~mask|c),tmp);