Mercurial > hg > CbC > old > device
changeset 342:3e0b1183983d
else if to switch
author | kono |
---|---|
date | Sat, 26 Jun 2004 12:35:35 +0900 |
parents | ca34f02b2056 |
children | 11f8f2e6bb72 |
files | mc-codegen.c |
diffstat | 1 files changed, 259 insertions(+), 193 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-codegen.c Sat Jun 26 11:09:11 2004 +0900 +++ b/mc-codegen.c Sat Jun 26 12:35:35 2004 +0900 @@ -493,14 +493,6 @@ } } -#define dual_ops(op) \ - (op==GT|| op==UGT|| op==GE|| op==UGE|| op==LT|| \ - op==ULT|| op==LE|| op==ULE|| \ - op==DOP+GT|| op==DOP+GE|| op==DOP+LT|| op==DOP+LE || \ - op==FOP+GT|| op==FOP+GE|| op==FOP+LT|| op==FOP+LE || \ - op==FOP+EQ|| op==FOP+NEQ || \ - op==EQ|| op==NEQ|| op==DOP+EQ|| op==DOP+NEQ) - static int rop_dual(op) { @@ -543,10 +535,19 @@ int op = car(e1); if (chk) return; // gexpr_init(); - if (dual_ops(op) && (car(caddr(e1))==CONST||(car(caddr(e1))==DCONST))) - b_expr(list3(rop_dual(op),caddr(e1),cadr(e1)),cond,l1,0); - else - b_expr(e1,cond,l1,0); + switch(op) { + case GT: case UGT: case GE: case UGE: case LT: + case ULT: case LE: case ULE: + case DOP+GT: case DOP+GE: case DOP+LT: case DOP+LE: + case FOP+GT: case FOP+GE: case FOP+LT: case FOP+LE: + case FOP+EQ: case FOP+NEQ: + case EQ: case NEQ: case DOP+EQ: case DOP+NEQ: + if ((car(caddr(e1))==CONST||(car(caddr(e1))==DCONST))) { + b_expr(list3(rop_dual(op),caddr(e1),cadr(e1)),cond,l1,0); + return; + } + } + b_expr(e1,cond,l1,0); } /* bexpr for value used */ @@ -758,19 +759,18 @@ int lvar; int t; if (!n||n==&null_nptr) error(REG_ERR); - if (tag==REGISTER) { - n->dsp = new_lvar(size_of_int); - t = INT; - } else if (tag==DREGISTER) { - n->dsp = new_lvar(size_of_double); - t = DOUBLE; - } else if (tag==FREGISTER) { - n->dsp = new_lvar(size_of_float); - t = DOUBLE; - } else if (tag==LREGISTER) { - n->dsp = new_lvar(size_of_longlong); - t = LONGLONG; - } else error(-1); + switch(tag) { + case REGISTER: + n->dsp = new_lvar(size_of_int); t = INT; break; + case DREGISTER: + n->dsp = new_lvar(size_of_double); t = DOUBLE; break; + case FREGISTER: + n->dsp = new_lvar(size_of_float); t = DOUBLE; break; + case LREGISTER: + n->dsp = new_lvar(size_of_longlong); t = LONGLONG; break; + default: + error(-1); + } n->sc = LVAR; lvar = list2(LVAR,n->dsp); g_expr_u(assign_expr0(list2(LVAR,n->dsp),list3(tag,reg,(int)n),t,t)); @@ -1004,13 +1004,14 @@ static int is_simple(int e1) { - return ( - e1==CONST || e1==FNAME || e1==LVAR || e1==REGISTER ||e1==DREGISTER || - e1==FREGISTER || e1==LREGISTER || - e1==GVAR || e1==RGVAR || e1==RLVAR || e1==CRLVAR || e1==CRGVAR || - e1==DRLVAR || e1==FRLVAR || e1==LRLVAR || - e1==CURLVAR || e1==SURLVAR || e1==CURGVAR || e1==SURGVAR - ); + switch(e1) { + case FREGISTER: case LREGISTER: + case GVAR: case RGVAR: case RLVAR: case CRLVAR: case CRGVAR: + case DRLVAR: case FRLVAR: case LRLVAR: + case CURLVAR: case SURLVAR: case CURGVAR: case SURGVAR: + return 1; + } + return 0; } static int @@ -1018,32 +1019,48 @@ { int ce1=car(e1); int ce2=car(e2); - return ( - (ce1==LVAR && (ce2==RLVAR||ce2==CRLVAR||ce2==FRLVAR||ce2==DRLVAR)) - || (ce1==LVAR && (ce2==SRLVAR||ce2==SURLVAR||ce2==CURLVAR)) - || (ce2==LVAR && (ce1==RLVAR||ce1==CRLVAR||ce1==FRLVAR||ce1==DRLVAR)) - || (ce2==LVAR && (ce1==SRLVAR||ce1==SURLVAR||ce1==CURLVAR)) - || (ce2==LVAR && (ce1==LRLVAR)) - || (ce1==GVAR && (ce2==RGVAR||ce2==CRGVAR||ce2==FRGVAR||ce2==DRGVAR)) - || (ce1==GVAR && (ce2==SRGVAR||ce2==SURGVAR||ce2==CURGVAR)) - || (ce2==GVAR && (ce1==RGVAR||ce1==CRGVAR||ce1==FRGVAR||ce1==DRGVAR)) - || (ce2==GVAR && (ce1==SRGVAR||ce1==SURGVAR||ce1==CURGVAR)) - || (ce2==GVAR && (ce1==LRGVAR)) - ); + if (ce1==LVAR) { + switch(ce2) { + case RLVAR: case CRLVAR: case FRLVAR: case DRLVAR: + case SRLVAR: case SURLVAR: case CURLVAR: + return 1; + } + } else if (ce2==LVAR) { + switch(ce1) { + case RLVAR: case CRLVAR: case FRLVAR: case DRLVAR: + case SRLVAR: case SURLVAR: case CURLVAR: case LRLVAR: + return 1; + } + } else if (ce1==GVAR) { + switch(ce2) { + case RGVAR: case CRGVAR: case FRGVAR: case DRGVAR: + case SRGVAR: case SURGVAR: case CURGVAR: + return 1; + } + } else if (ce2==GVAR) { + switch(ce1) { + case RGVAR: case CRGVAR: case FRGVAR: case DRGVAR: + case SRGVAR: case SURGVAR: case CURGVAR: case LRGVAR: + return 1; + } + } + return 0; } static int is_memory(int e1) { int ce1=car(e1); - return ( - ce1==LVAR ||ce1==RLVAR||ce1==CRLVAR || ce1==DRLVAR || ce1==LRLVAR || - ce1==GVAR ||ce1==RGVAR||ce1==CRGVAR || ce1==DRGVAR || ce1==LRGVAR || - ce1==FRLVAR || ce1==FRGVAR || - ce1==CURGVAR ||ce1==SURGVAR||ce1==SRGVAR || - ce1==REGISTER|| ce1==DREGISTER || ce1==FREGISTER || - ce1==LREGISTER - ); + switch(car(ce1)) { + case LVAR : case RLVAR: case CRLVAR : case DRLVAR : case LRLVAR : + case GVAR : case RGVAR: case CRGVAR : case DRGVAR : case LRGVAR : + case FRLVAR : case FRGVAR : + case CURGVAR : case SURGVAR: case SRGVAR : + case REGISTER : case DREGISTER : case FREGISTER : + case LREGISTER: + return 1; + } + return 0; } @@ -1325,18 +1342,24 @@ if (use) g_expr(e4); return; } - if (!use && ( - (e5==REGISTER) || - (car(e2)==REGISTER&&( - e5== CRGVAR || e5== CRLVAR || e5== RGVAR || e5== RLVAR || - e5== CURGVAR || e5== CURLVAR || - e5== SURGVAR || e5== SURLVAR || - e5== GVAR || e5== LVAR || - e5== CONST || e5== FNAME || e5== STRING || - (e5==ADDRESS&&car(cadr(e4))==STRING) || - (e5==ADDRESS&&car(cadr(e4))==GVAR) )))) { - assign_opt(e5,e2,e4,byte); - return; + if (!use) { + if (e5==REGISTER) { + assign_opt(e5,e2,e4,byte); + return; + } else if (car(e2)==REGISTER) { + switch(e5) { + case ADDRESS: + if (!((car(cadr(e4))==STRING) || car(cadr(e4))==GVAR)) + break; + case CRGVAR : case CRLVAR : case RGVAR : case RLVAR : + case CURGVAR : case CURLVAR : + case SURGVAR : case SURLVAR : + case GVAR : case LVAR : + case CONST : case FNAME : case STRING : + assign_opt(e5,e2,e4,byte); + return; + } + } } switch(car(e2)) { case GVAR: /* i=3 */ @@ -1417,13 +1440,16 @@ if (car(e1)==DASS) d=1; else if (car(e1)==FASS) d=0; else error(-1); - if (!use && ( - (e5==DREGISTER) || (e5==FREGISTER) || - (car(e2)==DREGISTER&&(e5==DRGVAR||e5==DRLVAR||e5==DCONST))|| - (car(e2)==FREGISTER&&(e5==FRGVAR||e5==FRLVAR||e5==FCONST)) - )) { - dassign_opt(e5,e2,e4,d); - return; + if (!use) { + switch(e5) { + case DRGVAR: case DRLVAR: case DCONST: + if (car(e2)!=DREGISTER) break; + dassign_opt(e5,e2,e4,d); return; + case FRGVAR: case FRLVAR: case FCONST: + if (car(e2)!=FREGISTER) break; + case DREGISTER: case FREGISTER: + dassign_opt(e5,e2,e4,d); return; + } } switch(car(e2)) { case GVAR: @@ -1538,22 +1564,31 @@ double_value(int e2) { if (type>0&&car(type)==BIT_FIELD) e2=rvalue(e2); - if (0) ; #if FLOAT_CODE + switch(car(e2)) { + case LCONST: #if LONGLONG_CODE - else if (car(e2)==LCONST) e2 = dlist2(DCONST,(double)lcadr(e2)); + e2 = dlist2(DCONST,(double)lcadr(e2)); break; #endif - else if (car(e2)==CONST) e2 = dlist2(DCONST,(double)cadr(e2)); - else if (car(e2)==FCONST) e2 = dlist2(DCONST,dcadr(e2)); - else if(type==DOUBLE) ; - else if(type==FLOAT) e2 = list3(CONV,rvalue(e2),F2D); - else if(type==UNSIGNED) e2 = list3(CONV,rvalue(e2),U2D); - else if(integral(type)) e2 = list3(CONV,rvalue(e2),I2D); - else if(type==LONGLONG) e2 = list3(CONV,rvalue(e2),LL2D); - else if(type==ULONGLONG) e2 = list3(CONV,rvalue(e2),ULL2D); - else { error(TYERR); e2 = dlist2(DCONST,1.0); } + case CONST: + e2 = dlist2(DCONST,(double)cadr(e2)); break; + case FCONST: + e2 = dlist2(DCONST,dcadr(e2)); break; + default: + switch(type) { + case DOUBLE: break; + case FLOAT: e2 = list3(CONV,rvalue(e2),F2D); break; + case INT: + case UNSIGNED: e2 = list3(CONV,rvalue(e2),U2D); break; + case LONGLONG: e2 = list3(CONV,rvalue(e2),LL2D); break; + case ULONGLONG: e2 = list3(CONV,rvalue(e2),ULL2D); break; + default: + if(integral(type)) e2 = list3(CONV,rvalue(e2),I2D); + else { error(TYERR); e2 = dlist2(DCONST,1.0); } + } + } #else - else { error(TYERR); type = DOUBLE; return list2(CONST,0); } + error(TYERR); type = DOUBLE; return list2(CONST,0); #endif type = DOUBLE; return e2; @@ -1568,15 +1603,21 @@ #if LONGLONG_CODE else if (car(e2)==LCONST) e2 = dlist2(FCONST,(double)lcadr(e2)); #endif - else if(type==LONGLONG) e2 = list3(CONV,rvalue(e2),LL2F); - else if(type==ULONGLONG) e2 = list3(CONV,rvalue(e2),ULL2F); else if (car(e2)==CONST) e2 = dlist2(FCONST,(double)cadr(e2)); else if (car(e2)==DCONST) e2 = dlist2(FCONST,dcadr(e2)); - else if(type==FLOAT) ; - else if(type==DOUBLE) e2 = list3(CONV,rvalue(e2),D2F); - else if(type==UNSIGNED) e2 = list3(CONV,rvalue(e2),U2F); - else if(integral(type)) e2 = list3(CONV,rvalue(e2),I2F); - else { error(TYERR); e2 = dlist2(DCONST,1.0); } + else { + switch(type) { + case LONGLONG: e2 = list3(CONV,rvalue(e2),LL2F); break; + case ULONGLONG: e2 = list3(CONV,rvalue(e2),ULL2F); break; + case FLOAT: break; + case DOUBLE: e2 = list3(CONV,rvalue(e2),D2F); break; + case INT: + case UNSIGNED: e2 = list3(CONV,rvalue(e2),U2F); break; + default: + if(integral(type)) e2 = list3(CONV,rvalue(e2),I2F); + else { error(TYERR); e2 = dlist2(DCONST,1.0); } + } + } #else else { error(TYERR); e2 = list2(CONST,0); } #endif @@ -1595,14 +1636,19 @@ #if FLOAT_CODE else if (car(e2)==DCONST||car(e2)==FCONST) e2 = llist2(LCONST,(long long)dcadr(e2)); - else if(type==FLOAT) e2 = list3(CONV,rvalue(e2),F2LL); - else if(type==DOUBLE) e2 = list3(CONV,rvalue(e2),D2LL); #endif - else if(type==UNSIGNED) e2 = list3(CONV,rvalue(e2),U2LL); - else if(type==LONGLONG) e2 = e2; - else if(type==ULONGLONG) e2 = e2; - else if(integral(type)) e2 = list3(CONV,rvalue(e2),I2LL); - else { error(TYERR); e2 = llist2(LCONST,0LL); } + else { + switch(type) { + case FLOAT: e2 = list3(CONV,rvalue(e2),F2LL); break; + case DOUBLE: e2 = list3(CONV,rvalue(e2),D2LL); break; + case UNSIGNED: e2 = list3(CONV,rvalue(e2),U2LL); break; + case LONGLONG: break; + case ULONGLONG: break; + default: + if(integral(type)) e2 = list3(CONV,rvalue(e2),I2LL); + else { error(TYERR); e2 = llist2(LCONST,0LL); } + } + } #else else { error(TYERR); e2 = list2(CONST,0); } #endif @@ -1621,14 +1667,19 @@ #if FLOAT_CODE else if (car(e2)==DCONST||car(e2)==FCONST) e2 = llist2(LCONST,(unsigned long long)dcadr(e2)); - else if(type==FLOAT) e2 = list3(CONV,rvalue(e2),F2ULL); - else if(type==DOUBLE) e2 = list3(CONV,rvalue(e2),D2ULL); #endif - else if(type==UNSIGNED) e2 = list3(CONV,rvalue(e2),U2ULL); - else if(type==LONGLONG) ; - else if(type==ULONGLONG) ; - else if(integral(type)) e2 = list3(CONV,rvalue(e2),I2ULL); - else { error(TYERR); e2 = llist2(LCONST,0LL); } + else { + switch(type) { + case FLOAT: e2 = list3(CONV,rvalue(e2),F2ULL); break; + case DOUBLE: e2 = list3(CONV,rvalue(e2),D2ULL); break; + case UNSIGNED: e2 = list3(CONV,rvalue(e2),U2ULL); break; + case LONGLONG: break; + case ULONGLONG: break; + default: + if(integral(type)) e2 = list3(CONV,rvalue(e2),I2ULL); + else { error(TYERR); e2 = llist2(LCONST,0LL); } + } + } #else else unsigned_value(e2); #endif @@ -1641,19 +1692,24 @@ { if (type>0&&car(type)==BIT_FIELD) e2=rvalue(e2); if (0); + else if(type>0&&car(type)==ARRAY) return e2; else if(scalar(type)) return e2; #if FLOAT_CODE else if (car(e2)==DCONST||car(e2)==FCONST) e2 = list2(CONST,(int)dcadr(e2)); - else if(type==FLOAT) e2 = list3(CONV,rvalue(e2),F2I); - else if(type==DOUBLE) e2 = list3(CONV,rvalue(e2),D2I); #endif #if LONGLONG_CODE else if (car(e2)==LCONST) e2 = list2(CONST,(int)lcadr(e2)); - else if(type==LONGLONG) e2 = list3(CONV,rvalue(e2),LL2I); - else if(type==ULONGLONG) e2 = list3(CONV,rvalue(e2),ULL2I); #endif - else if(car(type)==ARRAY) return e2; - else { error(TYERR); e2 = list2(CONST,1); } + else { + switch(type) { + case FLOAT: e2 = list3(CONV,rvalue(e2),F2I); break; + case DOUBLE: e2 = list3(CONV,rvalue(e2),D2I); break; + case LONGLONG: e2 = list3(CONV,rvalue(e2),LL2I); break; + case ULONGLONG: e2 = list3(CONV,rvalue(e2),ULL2I); break; + default: + error(TYERR); e2 = list2(CONST,1); + } + } type = INT; return e2; } @@ -1662,20 +1718,25 @@ unsigned_value(int e2) { if (type>0&&car(type)==BIT_FIELD) e2=rvalue(e2); + else if(type>0&&car(type)==ARRAY) return e2; if (0); else if(scalar(type)) return e2; #if FLOAT_CODE - // else if (car(e2)==DCONST||car(e2)==FCONST) e2 = list2(CONST,(unsigned)dcadr(e2)); else if (car(e2)==DCONST||car(e2)==FCONST) e2 = list2(CONST,(int)dcadr(e2)); - else if(type==FLOAT) e2 = list3(CONV,rvalue(e2),F2U); - else if(type==DOUBLE) e2 = list3(CONV,rvalue(e2),D2U); #endif #if LONGLONG_CODE - else if(type==LONGLONG) e2 = list3(CONV,rvalue(e2),LL2U); - else if(type==ULONGLONG) e2 = list3(CONV,rvalue(e2),ULL2U); + else if (car(e2)==LCONST) e2 = list2(CONST,(unsigned)lcadr(e2)); #endif - else if(car(type)==ARRAY) return e2; - else error(TYERR); + else { + switch(type) { + case LONGLONG: e2 = list3(CONV,rvalue(e2),LL2U); break; + case ULONGLONG: e2 = list3(CONV,rvalue(e2),ULL2U); break; + case FLOAT: e2 = list3(CONV,rvalue(e2),F2U); break; + case DOUBLE: e2 = list3(CONV,rvalue(e2),D2U); break; + default: + error(TYERR); + } + } type = UNSIGNED; return e2; } @@ -1701,48 +1762,52 @@ extern int assign_expr(int e1,int e2,int t) { - if(t==VOID) - error(TYERR); - if(t==CHAR||t==UCHAR) { + switch(t) { + case VOID: + break; + case CHAR:case UCHAR: e2=(t==UCHAR)?unsigned_value(e2):int_value(e2); return(list3(CASS,e1,e2)); - } else if(t==SHORT||t==USHORT) { + case SHORT:case USHORT: e2=(t==USHORT)?unsigned_value(e2):int_value(e2); return(list3(SASS,e1,e2)); #if FLOAT_CODE - } else if(t==DOUBLE) { + case DOUBLE: e2=double_value(e2); return(list3(DASS,e1,e2)); - } else if(t==FLOAT) { + case FLOAT: e2=float_value(e2); return(list3(FASS,e1,e2)); #endif #if LONGLONG_CODE - } else if(t==LONGLONG) { + case LONGLONG: e2=longlong_value(e2); return(list3(LASS,e1,e2)); - } else if(t==ULONGLONG) { + case ULONGLONG: e2=ulonglong_value(e2); return(list3(LASS,e1,e2)); #endif - } else if(scalar(t)) { - e2=(t==UNSIGNED)?unsigned_value(e2):int_value(e2); - return(list3(ASS,e1,e2)); - } else if (car(t)==BIT_FIELD) { - e2 = correct_type(e2,cadr(t)); - return(list4(BASS,e1,e2,list2(BASS,t))); - } else if((car(t)==STRUCT||car(t)==UNION)) { - if (size(t)!=size(type)) error(TYERR); - type=t; - if(car(e2)==RSTRUCT && car(cadr(e2))==FUNCTION) { - replace_return_struct(cadr(e2),e1); - return cadr(e2); - } else { - return (list4(STASS,e1,e2,size(t))); - } - } else { - error(TYERR); return list3(ASS,e1,e2); + default: + if(scalar(t)) { + e2=(t==UNSIGNED)?unsigned_value(e2):int_value(e2); + return(list3(ASS,e1,e2)); + } + switch(car(t)) { + case BIT_FIELD: + e2 = correct_type(e2,cadr(t)); + return(list4(BASS,e1,e2,list2(BASS,t))); + case STRUCT:case UNION: + if (size(t)!=size(type)) error(TYERR); + type=t; + if(car(e2)==RSTRUCT && car(cadr(e2))==FUNCTION) { + replace_return_struct(cadr(e2),e1); + return cadr(e2); + } else { + return (list4(STASS,e1,e2,size(t))); + } + } } + error(TYERR); return list3(ASS,e1,e2); } extern int @@ -1784,56 +1849,58 @@ extern int assop(int e1,int e2,int op,int t,int no_float) { + int ass,u = 0; if(!(integral(type)||type==FLOAT||type==DOUBLE|| type==LONGLONG||type==ULONGLONG )) error(TYERR); + switch(t) { #if FLOAT_CODE - if (t==FLOAT) { + case FLOAT: if (no_float) error(TYERR); e2=float_value(e2); return(list4(FASSOP,e1,e2,op+FOP)); - } else if (t==DOUBLE) { + case DOUBLE: if (no_float) error(TYERR); e2=double_value(e2); return(list4(DASSOP,e1,e2,op+DOP)); - } #endif #if LONGLONG_CODE - if (t==LONGLONG) { + case LONGLONG: e2=longlong_value(e2); return(list4(LASSOP,e1,e2,op+LOP)); - } else if (t==ULONGLONG) { + case ULONGLONG: e2=ulonglong_value(e2); return(list4(LASSOP,e1,e2,op+LOP+((op==MUL+AS||op==DIV+AS)?US:0))); - } #endif - if((t==UNSIGNED||t==UCHAR||t==USHORT||type==UNSIGNED)&& - (op==MUL||op==DIV||op==MOD)) - op=op+US; - if((t==UNSIGNED||t==UCHAR||t==USHORT)&&(op==RSHIFT||op==LSHIFT)) - op=op+US; - if(t==CHAR) { - type= INT; - return(list4(CASSOP,e1,e2,op)); + case CHAR: + type= INT; ass = CASSOP; break; + case SHORT: + type= INT; ass = SASSOP; break; + case INT: + type= INT; ass = ASSOP; break; + case UCHAR: + type= UNSIGNED; ass = CUASSOP; u=1; break; + case USHORT: + type= UNSIGNED; ass = SUASSOP; u=1; break; + case UNSIGNED: + type= UNSIGNED; ass = ASSOP; u=1; break; + default: + if (t>0 && car(t)==BIT_FIELD) { + e2 = correct_type(e2,cadr(t)); + return(list4(BASSOP,e1,e2,list2(op,t))); + } } - if(t==UCHAR) { - type= UNSIGNED; - return(list4(CUASSOP,e1,e2,op)); - } - if(t==SHORT) { - type= INT; - return(list4(SASSOP,e1,e2,op)); - } - if(t==USHORT) { - type= UNSIGNED; - return(list4(SUASSOP,e1,e2,op)); - } - if (t>0 && car(t)==BIT_FIELD) { - e2 = correct_type(e2,cadr(t)); - return(list4(BASSOP,e1,e2,list2(op,t))); + if (u) { + if (op==RSHIFT||op==LSHIFT) op=op+US; + else { + switch(type) { + case UCHAR: case USHORT: case UNSIGNED: + if (op==MUL||op==DIV||op==MOD) op=op+US; + } + } } type=t; - if(integral(t)) return(list4(ASSOP,e1,e2,op)); + if(integral(t)) return(list4(ass,e1,e2,op)); /* pointer += ... */ if((op!=ADD&&op!=SUB)||car(t)!=POINTER) error(TYERR); e2=binop(MUL,e2,list2(CONST,size(cadr(t))),INT,UNSIGNED); @@ -1851,16 +1918,12 @@ int n,t; /* e2 op= e3 */ - if (car(e1) == CUASSOP) { - byte = 1; sign = 0; size = 1; - } else if (car(e1) == CASSOP) { - byte = 1; sign = 1; size = 1; - } else if (car(e1) == SUASSOP) { - byte = size_of_short; sign = 0; size = size_of_short; - } else if (car(e1) == SASSOP) { - byte = size_of_short; sign = 1; size = size_of_short; - } else { - byte = 0; sign = 1; size = size_of_int; + switch(car(e1)) { + case CUASSOP: byte = 1; sign = 0; size = 1; break; + case CASSOP: byte = 1; sign = 1; size = 1; break; + case SUASSOP: byte = size_of_short; sign = 0; size = size_of_short; break; + case SASSOP: byte = size_of_short; sign = 1; size = size_of_short; break; + default: byte = 0; sign = 1; size = size_of_int; } e2 = cadr(e1); if (car(e2)==INDIRECT) e2=cadr(e2); @@ -2777,16 +2840,19 @@ lcheck(int e) { int t; - if(!(scalar(type)||type==DOUBLE||type==FLOAT|| - type==LONGLONG||type==ULONGLONG)|| - (car(e)!=GVAR&&car(e)!=LVAR&&car(e)!=INDIRECT - && car(e)!=REGISTER - && car(e)!=DREGISTER - && car(e)!=FREGISTER - && car(e)!=LREGISTER) - ) - if ((t=car(type))<0 && t!=STRUCT && t!=UNION) - error(LVERR); + if(scalar(type)) return; + switch(type) { + case DOUBLE: case FLOAT : case LONGLONG: case ULONGLONG: + return; + default: + switch(car(e)) { + case GVAR: case LVAR: case INDIRECT : + case REGISTER : case DREGISTER : case FREGISTER : case LREGISTER: + return; + } + } + if ((t=car(type))<0 && t!=STRUCT && t!=UNION) + error(LVERR); } extern int @@ -2799,7 +2865,7 @@ type=type; else error(TYERR); } else - type= CHAR; + type= CHAR; // ?! if(car(e)==ADDRESS) return(cadr(e)); return(list2(INDIRECT,e));