Mercurial > hg > CbC > old > device
comparison mc-codegen.c @ 516:bfa4c834a3b8
data/text/rodata segment fix (incomplete)
author | kono |
---|---|
date | Mon, 26 Dec 2005 10:55:15 +0900 |
parents | a2047e4555be |
children | d686497e8fd2 |
comparison
equal
deleted
inserted
replaced
515:3d921f7a8e74 | 516:bfa4c834a3b8 |
---|---|
2905 | 2905 |
2906 static void | 2906 static void |
2907 emit_data(int e, int t, NMTBL *n) | 2907 emit_data(int e, int t, NMTBL *n) |
2908 { | 2908 { |
2909 int l; | 2909 int l; |
2910 char *name; | |
2911 t = type_value(t); | 2910 t = type_value(t); |
2912 name = n->nm; | |
2913 if(mode!=GDECL && mode!=STADECL) { | 2911 if(mode!=GDECL && mode!=STADECL) { |
2914 error(-1); return; | 2912 error(-1); return; |
2915 } | 2913 } |
2916 if (chk) return; | 2914 if (chk) return; |
2917 if ((car(e)!=STRING && n->dsp != -1)) { | 2915 if (n->dsp != -1) { |
2918 n->dsp = -1; /* initialized flag */ | 2916 n->dsp = -1; /* initialized flag */ |
2919 emit_global(name,t); | 2917 emit_global(n,t,e); |
2920 } | 2918 } |
2921 switch(t) { | 2919 switch(t) { |
2922 case EMPTY: | 2920 case EMPTY: |
2923 if(car(e)!=CONST) error(-1); | 2921 if(car(e)!=CONST) error(-1); |
2924 emit_space(cadr(e)); | 2922 emit_space(cadr(e)); |
2972 emit_address(((NMTBL *)caddr(e))->nm,0); | 2970 emit_address(((NMTBL *)caddr(e))->nm,0); |
2973 return; | 2971 return; |
2974 case STRING: | 2972 case STRING: |
2975 if (car(type_value(n->ty))!=ARRAY || cadr(type_value(n->ty))!=CHAR) { | 2973 if (car(type_value(n->ty))!=ARRAY || cadr(type_value(n->ty))!=CHAR) { |
2976 l = emit_string_label(); | 2974 l = emit_string_label(); |
2977 if (n->dsp != -1) { | |
2978 n->dsp = -1; /* initialized flag */ | |
2979 emit_global(name,t); | |
2980 } | |
2981 ascii((char *)cadr(e)); | 2975 ascii((char *)cadr(e)); |
2982 emit_label(l); | 2976 emit_label(l); |
2983 } else { | 2977 } else { |
2984 if (n->dsp != -1) { | |
2985 n->dsp = -1; /* initialized flag */ | |
2986 emit_global(name,t); | |
2987 } | |
2988 ascii((char *)cadr(e)); | 2978 ascii((char *)cadr(e)); |
2989 } | 2979 } |
2990 return; | 2980 return; |
2991 } | 2981 } |
2992 // fprintf(stderr,"## type= %d\n",t); | 2982 // fprintf(stderr,"## type= %d\n",t); |