Mercurial > hg > CbC > old > device
comparison mc-parse.c @ 677:83459d1afa0d
adhoc fix of statement expression in ia32.
author | kono |
---|---|
date | Sun, 06 May 2007 20:31:42 +0900 |
parents | 5e71527f9fd6 |
children | e16b34f2b386 |
comparison
equal
deleted
inserted
replaced
676:5e71527f9fd6 | 677:83459d1afa0d |
---|---|
924 fdecl(n); return; | 924 fdecl(n); return; |
925 } else error(DCERR); | 925 } else error(DCERR); |
926 } else { | 926 } else { |
927 conv->return_type_(type,n,sd); | 927 conv->return_type_(type,n,sd); |
928 n = def(n,ctmode); | 928 n = def(n,ctmode); |
929 if (inmode && (mode==LDECL||mode==LLDECL)) { | 929 if (inmode==INLINE && (mode==LDECL||mode==LLDECL)) { |
930 parse = list4(ST_DECL,parse,(int)n,list3(mode,stmode,ctmode)); | 930 parse = list4(ST_DECL,parse,(int)n,list3(mode,stmode,ctmode)); |
931 } | 931 } |
932 if (sym==ASS && n!=&null_nptr) { | 932 if (sym==ASS && n!=&null_nptr) { |
933 conv->op_(sym); | 933 conv->op_(sym); |
934 decl_data(type,n,0,0); data_closing(n); | 934 decl_data(type,n,0,0); data_closing(n); |
944 if (!(type>0&&car(type)==BIT_FIELD)) | 944 if (!(type>0&&car(type)==BIT_FIELD)) |
945 error(DCERR); | 945 error(DCERR); |
946 } | 946 } |
947 conv->return_type_(type,n,1); | 947 conv->return_type_(type,n,1); |
948 def(n,ctmode); | 948 def(n,ctmode); |
949 if (inmode && mode==LDECL) { | 949 if (inmode==INLINE && mode==LDECL) { |
950 parse = list4(ST_DECL,parse,(int)n,list3(mode,stmode,ctmode)); | 950 parse = list4(ST_DECL,parse,(int)n,list3(mode,stmode,ctmode)); |
951 } | 951 } |
952 if (sym==ASS && n!=&null_nptr) { | 952 if (sym==ASS && n!=&null_nptr) { |
953 conv->op_(sym); | 953 conv->op_(sym); |
954 decl_data(type,n,0,0);data_closing(n); | 954 decl_data(type,n,0,0);data_closing(n); |
2285 checkret(); | 2285 checkret(); |
2286 if (inmode) { | 2286 if (inmode) { |
2287 pparse = parse; parse = 0; | 2287 pparse = parse; parse = 0; |
2288 l1 = if0 = expr(0); | 2288 l1 = if0 = expr(0); |
2289 } else { | 2289 } else { |
2290 l1 = bexpr((if0 = expr(0)),0,fwdlabel()); | 2290 if0 = expr(0); |
2291 l1 = bexpr(if0,0,fwdlabel()); | |
2291 } | 2292 } |
2292 set_lfree(slfree); | 2293 set_lfree(slfree); |
2293 conv->if_then_(if0); | 2294 conv->if_then_(if0); |
2294 checksym(RPAR); | 2295 checksym(RPAR); |
2295 statement(0); | 2296 statement(0); |
3527 getsym(0); | 3528 getsym(0); |
3528 checksym(LPAR); | 3529 checksym(LPAR); |
3529 e=expr0(); | 3530 e=expr0(); |
3530 checksym(RPAR); | 3531 checksym(RPAR); |
3531 type=INT; | 3532 type=INT; |
3532 if (inmode) | 3533 if (inmode==INLINE) |
3533 return list2(BUILTINP,rvalue(e)); /* evalue it later */ | 3534 return list2(BUILTINP,rvalue(e)); /* evalue it later */ |
3534 else | 3535 else |
3535 return list2(CONST,is_const(e)); | 3536 return list2(CONST,is_const(e)); |
3536 case BUILTIN_EXPECT: | 3537 case BUILTIN_EXPECT: |
3537 /* builtin_expect(x,c) used in branch. x is expectet to be c */ | 3538 /* builtin_expect(x,c) used in branch. x is expectet to be c */ |
3685 type = nptr1->sc; | 3686 type = nptr1->sc; |
3686 if (type==EMPTY||type==EXTRN1||type==EXTRN) { | 3687 if (type==EMPTY||type==EXTRN1||type==EXTRN) { |
3687 nptr1->sc=EMPTY; | 3688 nptr1->sc=EMPTY; |
3688 nptr1=l_top_search(nptr->nm,0); | 3689 nptr1=l_top_search(nptr->nm,0); |
3689 nptr1->sc = FLABEL; | 3690 nptr1->sc = FLABEL; |
3690 if (inmode!=INLINE) | 3691 if (!inmode) |
3691 nptr1->dsp = fwdlabel(); | 3692 nptr1->dsp = fwdlabel(); |
3692 else | 3693 else |
3693 nptr1->dsp = --disp; | 3694 nptr1->dsp = --disp; |
3694 } | 3695 } |
3695 type = list2(POINTER,VOID); | 3696 type = list2(POINTER,VOID); |
3960 nptr0->nm = ""; | 3961 nptr0->nm = ""; |
3961 nptr0->sc = EMPTY; | 3962 nptr0->sc = EMPTY; |
3962 nptr0->attr = 0; | 3963 nptr0->attr = 0; |
3963 type = nptr0->ty = t; | 3964 type = nptr0->ty = t; |
3964 def(nptr0,0); | 3965 def(nptr0,0); |
3965 if (inmode) { | 3966 if (inmode==INLINE) { |
3966 parse = list4(ST_DECL,parse,(int)nptr0, | 3967 parse = list4(ST_DECL,parse,(int)nptr0, |
3967 list3(mode,0,0)); | 3968 list3(mode,0,0)); |
3968 } | 3969 } |
3969 #if LOCAL_STRUCT_INIT_STATIC | 3970 #if LOCAL_STRUCT_INIT_STATIC |
3970 local_struct_static(nptr0); | 3971 local_struct_static(nptr0); |
4009 if (cntl) { | 4010 if (cntl) { |
4010 gen_jmp(l2=fwdlabel()); | 4011 gen_jmp(l2=fwdlabel()); |
4011 } else l2 = 0; | 4012 } else l2 = 0; |
4012 // make it a simple call (by jmp) | 4013 // make it a simple call (by jmp) |
4013 // register stack save now | 4014 // register stack save now |
4015 // we cannot trust register variable (used as temorary) | |
4016 // either, save these register is necessary... | |
4014 e1 = list3(COMMA,list3(LCALL,b,l2),lastexp); | 4017 e1 = list3(COMMA,list3(LCALL,b,l2),lastexp); |
4015 lastexp = 0; | 4018 lastexp = 0; |
4016 if (l) fwddef(l); | 4019 if (l) fwddef(l); |
4017 control=cntl; | 4020 control=cntl; |
4018 #else | 4021 #else |
4022 int smode=mode; | |
4019 // we already have parse tree mode, why don't we? | 4023 // we already have parse tree mode, why don't we? |
4020 int sparse = parse; parse=0; | 4024 int sparse = parse; parse=0; |
4021 inmode = INLINE+1; | 4025 inmode = INLINE+1; |
4022 // this does not work well... we need some work later | 4026 // this does not work well... we need some work later |
4023 docomp(1); | 4027 docomp(1); |
4024 e1 = list3(COMMA,reverse0(parse),lastexp); | 4028 inmode = 0; mode=GDECL; |
4029 e1 = list3(COMMA,pexpr(reverse0(parse)),lastexp); | |
4030 mode = smode; | |
4025 parse = sparse; | 4031 parse = sparse; |
4026 lastexp = 0; | 4032 lastexp = 0; |
4027 inmode = 0; | |
4028 #endif | 4033 #endif |
4029 } | 4034 } |
4030 } else { | 4035 } else { |
4031 e1=expr0(); | 4036 e1=expr0(); |
4032 } | 4037 } |
4107 if (size(type)>size(tmp_struct->ty)) { | 4112 if (size(type)>size(tmp_struct->ty)) { |
4108 tmp_struct->ty = type; | 4113 tmp_struct->ty = type; |
4109 } | 4114 } |
4110 } else { | 4115 } else { |
4111 tmp_struct = def(0,0); | 4116 tmp_struct = def(0,0); |
4112 if (inmode) { | 4117 if (inmode==INLINE) { |
4113 set_attr(tmp_struct,HAS_ADDRESS,1); | 4118 set_attr(tmp_struct,HAS_ADDRESS,1); |
4114 parse = list4(ST_DECL,parse,(int)tmp_struct,list3(LDECL,0,0)); | 4119 parse = list4(ST_DECL,parse,(int)tmp_struct,list3(LDECL,0,0)); |
4115 } | 4120 } |
4116 } | 4121 } |
4117 return tmp_struct; | 4122 return tmp_struct; |