Mercurial > hg > CbC > old > device
comparison mc-codegen.c @ 365:5ac17fa9d7e0
bit-field constant assignment
author | kono |
---|---|
date | Wed, 07 Jul 2004 14:34:25 +0900 |
parents | f3f2b7906d50 |
children | 2d510935c37d |
comparison
equal
deleted
inserted
replaced
364:c29eebf3eaf4 | 365:5ac17fa9d7e0 |
---|---|
2444 case LTDECL: | 2444 case LTDECL: |
2445 nsc = TYPE; | 2445 nsc = TYPE; |
2446 break; | 2446 break; |
2447 case LLDECL: | 2447 case LLDECL: |
2448 nsc = FLABEL; | 2448 nsc = FLABEL; |
2449 n->dsp = fwdlabel(); | 2449 ndsp = fwdlabel(); |
2450 break; | 2450 break; |
2451 case ADECL: | 2451 case ADECL: |
2452 if(!integral(type)&&(car(type)==FUNCTION||car(type)==CODE)) { | 2452 if(!integral(type)&&(car(type)==FUNCTION||car(type)==CODE)) { |
2453 type=list2(POINTER,type); n->ty = type; | 2453 type=list2(POINTER,type); n->ty = type; |
2454 } | 2454 } |
3438 } | 3438 } |
3439 | 3439 |
3440 static int | 3440 static int |
3441 bit_field_repl(int e1,int e2,int t) | 3441 bit_field_repl(int e1,int e2,int t) |
3442 { | 3442 { |
3443 /* e2 = e1 */ | 3443 /* e1 = e2 */ |
3444 int lo = is_long_type(cadr(t)); | 3444 int lo = is_long_type(cadr(t)); |
3445 if ((car(e2)==CONST||car(e2)==LCONST)) { | |
3446 g_expr(e1); | |
3447 code_bit_replace_const(e2,USE_CREG, | |
3448 t /* type */,caddr(t) /* bit offset */); | |
3449 return cadr(t); | |
3450 } | |
3445 g_expr(e1); | 3451 g_expr(e1); |
3446 if (lo) emit_lpush(); else emit_push(); | 3452 if (lo) emit_lpush(); else emit_push(); |
3447 g_expr(e2); | 3453 g_expr(e2); |
3448 code_bit_replace(USE_CREG,(e2=lo?emit_lpop():pop_register()), | 3454 code_bit_replace(USE_CREG,(e2=lo?emit_lpop():pop_register()), |
3449 t /* type */,caddr(t) /* bit offset */); | 3455 t /* type */,caddr(t) /* bit offset */); |